GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||
GeezerVison is showing github.com — fix(responses): stop previous_response_id replay from compounding history by lidge-jun · Pull Request #1698 · lidge-jun/opencodex Conversation
Owner
SummaryLayer 2 of the usage/memory stack. Stops
The hard part is not equality, it is occurrence. A client may legitimately repeat itself: stored history of one message So
A client echoing provider output with the provider's id is replaying that exact occurrence — which is what we want to detect. A client echoing itself cannot manufacture one. Entries whose output carries no id never skip. Bounded comparison. Canonicalization counts bytes during the walk rather than serialize-then-measure, because a tool result can be megabytes and this is the request path. The cap applies to every item: an id is extra evidence, never a substitute for content equality, so an over-cap tool item is non-comparable exactly like an over-cap message. Any non-comparable item aborts the whole check — skipping just that item could align two different occurrences.
The anchor is threaded through resident entries, all four spill writes, the spill payload, materialization, and snapshot load, where a malformed value degrades to never-skip rather than to a bad index. Spill compatibility is forward-only: Two provenance contracts in Known gap (FU-2, recorded in the doc): sessions where the proxy injected guidance into stored history, or repaired ids after recording, do not match and expand as before. M0-1 does not bound that — admission runs after expansion and parsing and fails open on unknown ceilings — so it stays real remaining work rather than something already covered. Verification
Two existing byte-accounting tests mirror the measured envelope by hand and were updated for the new field; they still assert exact sizes. Notable cases: the one-message repeat does not skip; id-less provider output does not skip; a spilled entry keeps its anchor and still deduplicates (a real bug caught during implementation — StackDepends on #1696 → #1693. Review this PR's diff only.
Checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions…tory expandPreviousResponseInput concatenated stored items in front of whatever the client sent, unconditionally. When the client already carries that history -- stateless providers replaying full context alongside a previous_response_id -- the turn doubles, and the doubled turn is stored, so the next one triples. #1412 watched 127k of real context reach 1.3M tokens that way. The hard part is not detecting equality, it is proving occurrence. A client may legitimately repeat itself: stored history of one message "repeat" and a genuine delta that also begins with "repeat" produce an identical run, and skipping there would silently delete a real turn. Since stored state flattens request input and provider output into one array, position cannot settle it either -- an id-less assistant message sits in the output region without the provider having authored anything identifiable. So rememberResponseState now records where response.output begins, and a skip requires three things: the run covers the whole stored entry, it reaches that boundary, and some matched item past it carries a provider-issued id. A client echoing provider output WITH the provider's id is replaying that exact occurrence, which is what we want to detect; a client echoing itself cannot manufacture one. Entries whose output carries no id never skip. Comparison is bounded during the walk rather than serialize-then-measure, because a tool result can be megabytes and this is the request path. The cap applies to every item: an id is extra evidence, never a substitute for content equality, so an over-cap tool item is non-comparable exactly like an over-cap message. Any non-comparable item aborts the whole check -- skipping just that item could align two different occurrences. previous_response_id is deliberately preserved. Kiro and Cursor recover their conversation ids from it, so stripping it would start a new upstream conversation to fix a memory bug. The replay prefix length is still recorded, because the boundary is real whoever supplied the history: without it the parser re-acknowledges historical compaction markers and guidance gets injected twice. The anchor is threaded through resident entries, all four spill writes, the spill payload, materialization, and snapshot load, where a malformed value degrades to never-skip rather than to a bad index. Spill compatibility is forward-only: validPayload is a strict key allowlist, so rolling back across this commit invalidates spilled entries, degrading to the already-handled replay-miss path. Two provenance contracts in types.ts said "the proxy expanded"; they now say the history is present however it arrived, which is what every consumer actually reads them for. Known gap, recorded as FU-2: sessions where the proxy injected guidance into stored history, or repaired ids after recording, do not match and expand as before. M0-1 does not bound that -- admission runs after expansion and parsing and fails open on unknown ceilings -- so it stays real remaining work. Verified: bun test tests/continuation-dedup.test.ts (16 pass), plus responses-state and memory-watchdog suites green (130 total), typecheck clean. Two byte-accounting tests mirror the measured envelope by hand and were updated for the new field.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Owner
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
3 tasks done
agentHits
pushed a commit
to agentHits/opencodex
that referenced
this pull request
Per-PR disposition for the open bug and bug-like PRs, with the A-gate corrections folded in: LAND the lidge-jun#1693/lidge-jun#1696/lidge-jun#1698 stack bottom-up, port a focused subset of lidge-jun#1625 by hand, keep lidge-jun#1703 blocked on a routing/privacy design decision, and leave lidge-jun#1655/lidge-jun#1660 open as feature-shaped changes.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
bug
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. | |||||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |