Repository navigation
fix(hub): point trimmed tool results at their saved output - #164
TheGreatAxios merged 3 commits into
Conversation
|
Triage: In progress Triage is waiting for code review before it decides. This comment shows the verdict once it has. |
81d2f9f to
10f11e0
Compare
857662c to
bad494b
Compare
1e79824 to
2f00dfe
Compare
2f00dfe to
1071c47
Compare
1071c47 to
65b5a57
Compare
65b5a57 to
edc3e8d
Compare
| if (!block.content.some(long)) return [block]; | ||
| const text = textOf(block.content); | ||
| const key = `trimmed-${timestamp}-${block.callId}`; | ||
| blobs.push({ | ||
| key, | ||
| bytes: new TextEncoder().encode(text), | ||
| contentType: "text/plain", | ||
| }); | ||
| const note = `[${text.length} characters of an earlier result, not kept after compaction; read_file tool-output:///${key} returns it]`; |
There was a problem hiding this comment.
P2 · A result the size cap already spilled is saved only as its cut-down inline copy, not the whole output
The size cap keeps only the first maxChars characters inline, followed by a marker pointing at tool-output:///. That inline copy is what gets put in the new blob, so the blob holds a cut-down result plus the old pointer. The PR says that pointer can be overwritten by a later spill with the same call id. So the full output is still lost, even though the note says read_file 'returns it', and the character count in the note is the inline length, not the original length.
Gemini (call id "0") returns a result over the size cap, then a later response's call "0" spills again, then history trimming cuts the first result. The new trimmed-… blob holds only the first maxChars characters plus a pointer that now returns the second result.
Resolve this comment. Triage will not finish while it is open.
Closes CL-12126
When history trimming cut a tool result, its note told the model to run the tool again, which for check-app spends a whole build. The trimmer now saves the whole result as a compaction blob and the note says
read_file tool-output:///<key>returns it, the URI the agent's read_file already resolves for output Interchange's size cap spilled. A result the size cap already spilled is saved the same way, because its spill is keyed by the bare call id and a later spill overwrites it. The key includes the turn's time because Gemini numbers calls from 0 in every response, so call ids repeat within a conversation.Verified with a test that trims three results sharing the call id "0", one of them spilled, then reads each note's URI back through Interchange's blob reader; it failed 3 of 3 runs before each change. Lint, format, typecheck, unit tests (255 pass), pins, vendor checks and
bun run test:e2e(9 pass) pass.