perf(agent-core): drop dynamic timestamp from system prompt to restore prefix-cache hits - #2533
perf(agent-core): drop dynamic timestamp from system prompt to restore prefix-cache hits#2533daofazhiran wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: 9218660 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ce756c37e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| The current date and time in ISO format is `${now}`. This was captured when the session started and does not update as the session continues, so in a long or resumed session it may be hours or days stale. Treat it only as a rough reference; whenever the real current time matters (web-result freshness, age or expiry checks, anything time-sensitive), get it fresh from the environment — for example by running `date` if you have a shell tool — instead of trusting this value. | ||
|
|
||
| ## Working Directory |
There was a problem hiding this comment.
Preserve time lookup guidance without the timestamp
For time-sensitive requests, deleting this whole section removes more than the dynamic ISO value: it also removes the only default-prompt instruction that the agent must refresh the real time from the environment. I checked the remaining default prompt and the only date mention left is the Bash tool's command list, so cases like expiry/age checks or “what is today?” can be handled from model priors or stale context instead of querying the host. Keep a static, cache-friendly reminder to check the current time when it matters, and mirror it in the legacy prompt too.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 61389c6ab — kept ## Date and Time as a static reminder ("get it fresh from the environment, e.g. via the date command") and mirrored it in the legacy template too. No per-session value remains, so byte-prefix caching is unaffected. The added tests assert the rendered prompt is byte-identical across different now values.
…eminder The ISO timestamp injected into the system prompt changes on every new session, breaking DeepSeek's byte-prefix cache from that point onward — including the ~16.8k-token tools definition that follows it. First-turn input drops from ~19.5k tokens cache-miss to ~88 after the change (measured 99.6% cache hit on the built artifact). The Date and Time section is kept as a static reminder to fetch the real current time from the environment (e.g. via the `date` command) when it matters.
…rompt Also add the required changeset (@moonshot-ai/kimi-code patch) for the prompt-cache fix.
6ce756c to
9218660
Compare
Related Issue
Resolve #2532
Problem
What changed
Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.