fix(agent): refresh the system-prompt date line when UTC rolls over - #86942
Closed
ayushnangia wants to merge 2 commits into
Closed
ayushnangia wants to merge 2 commits into
ayushnangia wants to merge 2 commits into
Conversation
Contributor
fix(agent): refresh the system-prompt date line when UTC rolls over
|
ayushnangia
force-pushed
the
fix/system-prompt-date-rollover
branch
from
August 17, 2026 09:04
4e502f6 to
528b3f3
Compare
The 'Conversation started:' line is built date-only and cached per session for prefix-cache stability (NousResearch#20451). A session running past UTC midnight kept yesterday's date forever. Record the stamped date at build time and rebuild the prompt exactly once per rollover at the turn-start hook (NousResearch#86938) — day granularity keeps the cache intact within each day.
ayushnangia
force-pushed
the
fix/system-prompt-date-rollover
branch
from
August 17, 2026 19:35
528b3f3 to
600776f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #86938: the system prompt's
Conversation started: <date>line is built date-only and cached per session for prefix-cache stability (#20451, credit @iamfoz) — but a session running past UTC midnight kept yesterday's date forever.Changes (implementation + test as separate commits)
agent/system_prompt.py:build_system_promptrecords the stamped date on the agent (_system_prompt_date,%Y-%m-%d); newsystem_prompt_date_stale(agent)helper compares it against the current date (guarded, never raises).agent/turn_context.py: the turn-start hook rebuilds the cached prompt once when the date is stale — same day-granularity as the original design, so the prefix-cache rationale is untouched (one rebuild per rollover, never per turn).Validation
scripts/run_tests.sh tests/agent/test_system_prompt.py tests/agent/test_turn_context.py→ 39 passed, 0 failedCredit: @iamfoz's #20451 rationale preserved intact; reporter of #86938 for the rollover catch.