Skip to content

Announce date changes to long-running sessions without touching the prompt cache (port from kimi-code) - #80721

Open
teknium1 wants to merge 1 commit into
mainfrom
kimi-code-port/date-change-reminder
Open

teknium1 wants to merge 1 commit into
mainfrom
kimi-code-port/date-change-reminder

Conversation

@teknium1

@teknium1 teknium1 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Sessions that run past midnight now get a one-line date-change note on the next turn, so the model stops reasoning with a stale date. The system prompt bakes in Conversation started: <date> and is deliberately byte-stable for the life of a conversation (prompt-cache invariant) — this port announces rollovers on the per-turn user-message channel instead of ever touching the prompt.

Ported from MoonshotAI/kimi-code#2564 (their date_change context-injection provider), adapted to Hermes' existing gateway-notes / api_content sidecar mechanism in the turn prologue.

Changes

  • agent/turn_context.py: new maybe_date_change_note(agent, now=None) — tracks the last announced date on agent._last_known_date; first call seeds quietly (fresh/restored agents announce only genuine rollovers, matching the source's quiet-seed behavior); on rollover returns a [System note: ... it is now <date> (was <date>) ...] line. Wired into build_turn_context alongside the gateway must-deliver notes, so it rides the existing api_content sidecar (persisted and replayed byte-for-byte — the cache prefix never diverges) and the multimodal text-part fallback for free.
  • tests/agent/test_date_change_note.py: 6 tests (quiet seed, same-day silence, rollover announce, announce-once, multi-day gap, tracker update).

Validation

Before After
Session crosses midnight model keeps stale "Conversation started" date next turn carries a date-change note
Prompt cache prompt untouched; note rides the api_content sidecar
Tests test_date_change_note (6) + test_gateway_turn_sidecar + test_api_content_sidecar: 41/41 pass

Infographic

Date-change note

…turn system note

The system prompt bakes in "Conversation started: <date>" and stays
byte-stable for the life of a conversation (prompt-cache invariant), so
a session running past midnight leaves the model with a stale idea of
today's date.

maybe_date_change_note() tracks the last announced date on the agent
and, on a genuine rollover, emits a one-line note delivered through the
existing gateway-notes / api_content sidecar channel — the same
byte-stable per-turn user-message path used for auto-reset notes — so
the system prompt and cache prefix are never touched. First call seeds
quietly (fresh/restored agents announce only real rollovers), matching
the source behavior.
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 38929da

⚠️ Warnings

OSV vulnerability scan · View job

50 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.


debug info

CI timings

CI timings · View report · View job

Wall time 3m56s vs 6m14s (-36.9%). 11 job(s) slower, 11 faster, 1 unchanged.

  • Python tests / Run tests slice 3/12: +39.0s
  • Python tests / Run tests slice 4/12: +35.0s
  • Python tests / Run tests slice 7/12: +15.0s
  • Python tests / Run tests slice 10/12: -15.0s
  • Python tests / Run tests slice 6/12: +14.0s

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint needs-decision Awaiting maintainer decision before any implementation labels Aug 7, 2026
@alt-glitch

Copy link
Copy Markdown

This was generated by AI during triage.

Related: #75425 is an open alternative for the long-lived-session date problem. This PR instead uses the per-turn api_content sidecar and leaves the prompt cache prefix untouched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants