Skip to content

fix(prompt): keep plan/build reminders stable#27867

Open
namnguyen0503 wants to merge 1 commit into
anomalyco:devfrom
namnguyen0503:fix-stable-system-reminder-history-final-20260516200628
Open

fix(prompt): keep plan/build reminders stable#27867
namnguyen0503 wants to merge 1 commit into
anomalyco:devfrom
namnguyen0503:fix-stable-system-reminder-history-final-20260516200628

Conversation

@namnguyen0503
Copy link
Copy Markdown

Issue for this PR

Closes #26749

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fixes Plan/Build <system-reminder> prompt-history drift.

Previously, a historical user message could be serialized once as Continue plus the Plan -> Build reminder, then later serialize as only Continue. That changes already-seen model input and breaks prefix cache stability for llama.cpp, vLLM, LM Studio, and other prefix-caching backends.

This PR anchors the reminder to a stable turn boundary and avoids mutating historical message parts during prompt construction.

How did you verify your code works?

Ran:

  • bun test test/session/prompt.test.ts -t "keeps plan/build system reminders anchored to the original user turn across later serializations"
  • bun test test/session/prompt.test.ts -t "static loop consumes queued replies across turns"
  • bun test test/session/prompt.test.ts
  • bun turbo typecheck

All passed.

Also ran a source-checkout smoke test with the repo fake OpenAI-compatible TestLLMServer. It verified that the historical Continue + <system-reminder> message stayed byte-stable across a later Build turn.

Screenshots / recordings

Not applicable. This is a prompt serialization bug fix covered by tests.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on the search results, I found two related PRs that might be addressing similar issues:

  1. PR fix(session): persist plan mode reminders #26743 - fix(session): persist plan mode reminders

  2. PR fix(session): drop stale plan reminders #24343 - fix(session): drop stale plan reminders

Why they might be related:

You may want to check if PR #26743 has already been merged or if there's any overlap in the fixes being applied.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plan mode reminders are not persisted in history, breaking prefix cache stability

2 participants