Repository navigation
feat: a turn-scoped note stops Claude repeating a long reply after a housekeeping call - #418
Merged
Merged
Conversation
Add native turnEndNote.tools policy and a shared deterministic history transform for OAuth OpenCode 1, OpenCode 2 and Pi. Require at least 350 outgoing visible text characters and all-housekeeping tool calls. Replay every earlier qualifying note; omit only a note directly before another user message to avoid Anthropic's invalid placement. Cover per-host N/N+1/N+2 serialized history prefixes, settings projection, OAuth/API exclusions, tool-name mapping, length boundaries, cache lookback, effort controls and signing. Add three mutation controls: exact dispatch catches all three; direct marked mutations each fail only their named test (nine companions green). Broad replay found unrelated custody flakes on the latest-point control; all-tools and length controls had no collateral. Verified pinned Bun 1.3.14 remote typecheck, build, focused Core/OpenCode/Pi tests, format/lint and Pi host mapping. Full unit gates encountered the offline packed OpenCode registry refusal and unrelated Pi native-relay timeouts; no unrelated tests or deadlines were changed.
packages/opencode/CHANGELOG.md holds inherited upstream history; release notes come from the root CHANGELOG.md.
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.
When Claude writes a long final reply and then calls a housekeeping tool in the same response, the response ends
tool_use, the host sends the small result back, and the model often writes the reply again. Replays of a real OpenCode request: unchanged, the model rewrote its reply 3 of 3 times; the same "don't repeat" wording inside the tool result stopped it 1 of 3; a turn-scoped system message after the result stopped it 3 of 3. On a mid-work step (short narration, then the tool, then real work) the model kept working 3 of 3 with the note.turnEndNote.tools(defaultboard,ctx_reduce;[]turns it off), the request carries{"role":"system","clear_at":"next_user_message","content":"Your reply above has already reached the user. …"}after that message's tool results.Tests: per-host sequence tests (requests N, N+1, N+2 share an identical prefix through every earlier note), the 349/350 boundary, mixed tools, API-key routes and unsupported models unchanged, no
cache_controlon the note. Mutation rows: inject only at the latest point, drop the all-tools check, drop the length minimum; all CAUGHT.Summary by cubic
Prevents Claude from repeating a long final reply after a housekeeping tool call in the same response; the model rewrote its reply 3 of 3 times on replayed OpenCode requests without the note.
turnEndNote.tools— get a turn-scoped system note (clear_at: "next_user_message") after the tool results, on OAuth routes for Fable 5.1, Opus 5.5, Sonnet 5.5, and Haiku 5.5.Configuration
turnEndNote.toolssetting, default["board", "ctx_reduce"]; an empty array disables the note, a custom list uses the host's tool spellings.Written for commit 026fe85. Summary will update on new commits.