Repository navigation
fix(server): conversation summaries keep up so handoffs can use them - #132
Merged
Merged
Conversation
Each completed run inserts its own conversation-summary pass, so pending passes pile up and a context restart stays refused. The outbox still accepts a second run while the first is pending. Co-authored-by: Cursor <cursoragent@cursor.com>
A second run no longer starts its own chain while a pass is already pending. A retry or process restart leaves the queued successor and does not resume the pass it already replaced. Co-authored-by: Cursor <cursoragent@cursor.com>
A pass with eight current leaves and an uncovered tail still summarizes the tail first, so busy threads never build the roll-ups a handoff can fit. A gap in the middle must still be replaced before roots on either side are rolled together. Co-authored-by: Cursor <cursoragent@cursor.com>
A pass spent its whole cap on new leaves, so a busy thread never built roll-ups a handoff can fit. Runs of four current roots that end before the first uncovered gap now roll up first. Roots across that gap still wait for the replacement leaf. Co-authored-by: Cursor <cursoragent@cursor.com>
Empty or invalid output from the oldest chunk fails the whole pass, so the next pass retries that chunk and later stretches stay uncovered. A timeout should still fail the pass. Co-authored-by: Cursor <cursoragent@cursor.com>
A deterministic failure of the oldest chunk failed the whole pass, so later stretches never ran. The pass records that failure and continues. After the second one it leaves the chunk uncovered instead of retrying it. Timeouts still fail the pass. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
…ng pass does not absorb a later run's Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… pass absorbs a later run's A pass that stepped aside for a pending successor landed as failed, which pruning never deletes, while the restart path marked the same case succeeded. Both now cancel with one reason. A later run's pass collapsed into any pending pass, including one already retrying, so exhausting that retry dropped the later run's summaries. It now collapses only into a pass that has not started. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aries act on Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…not its wording Summaries decided whether a failed chunk could be skipped by matching error messages, which missed the custom text generators' "returned no text." and "couldn't read" replies. TextGenerationError now carries kind: empty or invalid-output, set where each adapter produces such a reply, and passed through the Claude and Codex driver wrappers that used to drop it. Outages, timeouts, sign-in, cancellation and unsupported providers stay unclassified. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eed, expires with the model, and does not block roll-ups Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…del, and roll-ups pass a skipped stretch A chunk counted a failure even when every call failed, so an outage or a model without structured output skipped a thread's whole history for good. A failure now counts only when another summary in the same pass succeeded; a pass with no success records the failure and stops its chain. Skip keys digest the summary model with the chunk, so changing the model gives the stretch a new chance. A skipped stretch never gets a leaf, yet it was the first gap, so nothing after it could roll up. It no longer splits the forest; its items stay uncovered, so delivery still replays them. The failure ledger left the client contract. It is stored beside the pass on the server, hashed and capped, and is read before the deleted, archived and summaries-off paths so they no longer wipe it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…'s progress Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d keeps progressing A pass whose three attempts all failed recorded nothing, as protection against a model outage. When three correlated pieces of work failed, such as every roll-up window holding one bad child or three bad leaf stretches at the front, each later pass retried them first and the thread never progressed. Such a pass now marks its failures as suspects without counting them. Later passes try suspects after other work, and the first pass that succeeds elsewhere counts them toward the skip. An outage still counts nothing and costs at most three calls per pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ledger keeps its last 64 entries in insertion order. A skipped stretch is never tried again, so it is never re-inserted and drifts to the front, where the cap dropped it first. A long outage that marks many stretches as suspects could then evict a skip and retry known-bad work. Trimming now drops other failures before skips. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An exit-0 run whose final result had no readable structured output was always labelled invalid-output. That included error_during_execution and API error results, so summaries blamed the stretch for a failed run. The label now follows the result: a success result with an unreadable payload, or running out of structured output retries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ies is labelled unreadable Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es is labelled unreadable The CLI exits 1 when the model never produced valid structured output, so the label set on the exit-0 path never reached it. Summaries then failed the whole pass on that chunk instead of counting it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…its own failures beside a success Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…side a success The first pass to succeed after an outage charged every suspect at once, even those it never retried, and a retried suspect that failed got charged twice. A slightly flaky model then skipped healthy history. Now only a retried stretch that fails in a pass where another summary succeeded is charged, once. Once a pass has a success, suspects are tried in order like other work; until then they still go last. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…del call while nothing succeeds Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…as succeeded A thread with only suspect stretches spent three model calls a pass on a model that may be down. Until a summary succeeds, a pass now tries one suspect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… skipped stretches fill the ledger Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er for new failures Trimming kept every skip first, so with 64 or more skips a new failure was dropped before it was saved. It never reached a skip and blocked roll-ups for good. Trimming now keeps at most the 48 newest skips. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… with later failures Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on re-enable, or reported - A chunk that always times out must not hold every pass, and a bad oldest suspect must not hold every pass after an outage. - Skipped sources no longer wait, and re-enabling summaries retries them. - A stretch that failed once keeps its count when an outage overflows the ledger. - An output-limit reply carries a kind, and process-loss reconcile reports the summary passes it cancels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ible label - An unlabelled failure such as a timeout or an HTTP 400 still fails the pass, but its chunk becomes an uncounted suspect, so the next pass works around it. Earlier failures in that pass are recorded instead of dropped. - Output-limit replies are labelled, so they count toward a skip. - While nothing has succeeded, the suspect that waited longest is the one tried, so a stretch that keeps failing cannot stall a thread after an outage. - Skipped sources leave the waiting count. A pass that wrote summaries shows its skip reason. Turning summaries back on for a project clears its failure ledger. - Ledger trimming drops zero-count suspects before counted failures. - Process-loss reconcile reports the summary passes it cancels. Roll-up keys use CONDENSE_FAN_IN. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…at a skip means, and how to undo it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-enable A stretch that always fails without a label (a 400 or a timeout) is never skipped and fails every pass after a success. A pass running while summaries are turned off and on writes the cleared failure ledger back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ble reset survives a running pass A failure that is not an unusable reply fails the pass only when nothing was generated in it; beside a success it counts toward a skip like any other failure, and the pass finishes normally. The pass writes its failure ledger in a transaction that keeps a reset made while it ran, so only its own failures survive the reset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ut skips nothing Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… summary succeeds Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
Why
Conversation summaries exist so handoffs can replace old history with something compact, but they rarely did. Of 1,005 history items left out of handoffs, only 82 (8%) were replaced by summaries. One handoff used 0 summaries while 213 of its omitted items already had leaf summaries. An audit of live data traced this to three causes:
What changed
cancelled, so it gets pruned. A later run's pass collapses only into a fresh pending row, never into one that is retrying. Process-loss reconcile counts the passes it cancels this way incancelled.TextGenerationErrorgains an optionalkind("empty" | "invalid-output" | "output-limit") for an unusable reply. The provider adapters that summaries use setemptyandinvalid-output.output-limitcomes only from custom text generators, and summaries never use those.conversationSummaryPassLabel.error_max_structured_output_retries, exit 1) is labelled unreadable, so it can't stall a thread.Scope
Tradeoffs
Blast Radius
conversation-summary.generate.TextGenerationErrorcontract. It gains an optionalkind. The Claude, Codex and managed-Codex driver wrappers now pass that error through unchanged; message and tag are the same.packages/client-runtime, shared by web and mobile.Verification
vp run check:changedpasses format, lint, knip, graphql, and 304 tests in 17 files. Its typecheck flagged a readonly tuple in a test, which I fixed and rechecked.🤖 Generated with Claude Code