fix(context): ledger receipts preserve the tool's conclusion (head+tail) - #32
Merged
Conversation
A ContextSift receipt summarized a tool result with its first N chars, so a failure captured the START of a traceback and dropped the ACTUAL error at the end. Once the exchange was compacted into the ledger, the agent could no longer tell whether the tool ran or why it failed — it would forget the outcome of its own tool call and re-run from scratch. The summary now keeps a head AND a tail (default length 200 -> 320), so the conclusion — a shell exit line, a written path, or the exception at the bottom of a traceback — survives compaction. Regression: a failure's exception text (at the tail) appears in the ledger receipt; existing externalization/recency tests tightened to check the raw output isn't kept INLINE (a conclusion snippet in the ledger is expected). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
This was referenced Jul 28, 2026
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.
Problem (reported from real use)
An agent wrote a script, ran it and got a traceback, then later said "I don't see evidence it was actually executed" and re-ran from scratch — it forgot the outcome of its own tool call.
Root cause: a ContextSift ledger receipt summarized a tool result with
result.prefix(summaryLength)— the first 200 chars. For a failure that's"Traceback (most recent call last): File …"; the actual error is at the END (UnicodeEncodeError: …) and was discarded. Once the raw output was compacted into the ledger, the receipt conveyed no usable conclusion.Fix
The receipt summary now keeps a head AND a tail (default length 200 → 320). So the conclusion — a shell exit line, a written path, or the exception at the bottom of a traceback — survives compaction, and the agent still knows what happened after its tool output is evicted.
Tests
testReceiptSummaryCapturesConclusionAtTail: a failure's exception text (at the tail) appears in the ledger receipt (marked ERROR), along with the head.Credit: diagnosed from a live Naseem session.