Keep the prompt prefix stable across turns so provider caches hit (#2721)
* Keep the prompt prefix stable across turns so provider caches hit
Two things broke the prefix providers cache between turns of a tool-enabled
conversation (#2720):
- A tool round was replayed with different bytes than the live loop sent:
its preamble was trimmed, and its tool-call ids were rewritten from the
provider's to the 9-character ids replay derives from each call's uuid.
The live loop now sends those same ids (the provider id is still kept as
originalId), and the preamble is persisted and replayed byte exact.
- The system prompt carried the time to the minute. The tool preprompt now
states the date only, and ML Assistant moves Time and Budget out of its
session context line onto the end of the user's latest message, next to
the session state block.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Address review: keep stored preambles exact, drop id recovery, turn context label
- convertMessageShape only replaces a trimmed (pre-byte-exact) preamble with the streamed slice; any other mismatch skips conversion so replay keeps the bytes the live loop sent
- remove the non-stream retry for tool calls streamed without an id, since the id sent upstream is now derived from the call uuid
- label the per-turn line [Turn context: …] so it is not confused with the system prompt's session context, and include it in the harness prompt hash
- format the ISO date (and search year) in the user's timezone, like the weekday date
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: pngwn <hello@pngwn.io>