Skip to content

fix(hub): point trimmed tool results at their saved output - #164

Merged
TheGreatAxios merged 3 commits into
mainfrom
cl-12126-point-trimmed-tool-results-at-their-saved-output-instead-of
Nov 4, 2026
Merged

TheGreatAxios merged 3 commits into
mainfrom
cl-12126-point-trimmed-tool-results-at-their-saved-output-instead-of

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

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.

@TheGreatAxios
TheGreatAxios added this pull request to stack #165 November 4, 2026 20:25
@linear-code

linear-code Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

CL-12126

CL-12155

CL-12156

@TheGreatAxios
TheGreatAxios marked this pull request as ready for review November 4, 2026 20:25
@corbits-triage

corbits-triage Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Triage: In progress

Triage is waiting for code review before it decides. This comment shows the verdict once it has.

@TheGreatAxios
TheGreatAxios force-pushed the cl-12126-point-trimmed-tool-results-at-their-saved-output-instead-of branch from 81d2f9f to 10f11e0 Compare November 4, 2026 20:30
Comment thread apps/hub/src/workflows/compaction.ts Resolved
Comment thread apps/hub/src/workflows/compaction.ts Resolved
@TheGreatAxios
TheGreatAxios force-pushed the cl-12126-point-trimmed-tool-results-at-their-saved-output-instead-of branch from 857662c to bad494b Compare November 4, 2026 20:52
Comment thread apps/hub/src/workflows/compaction.ts Resolved
corbits-triage[bot]
corbits-triage Bot previously approved these changes Nov 4, 2026
@TheGreatAxios
TheGreatAxios force-pushed the cl-12126-point-trimmed-tool-results-at-their-saved-output-instead-of branch from 1e79824 to 2f00dfe Compare November 4, 2026 22:14
@TheGreatAxios
TheGreatAxios force-pushed the cl-12126-point-trimmed-tool-results-at-their-saved-output-instead-of branch from 2f00dfe to 1071c47 Compare November 4, 2026 22:15
Base automatically changed from cl-11908-decide-the-coder-is-done-from-the-check-tools-result-not-its to main November 4, 2026 22:26
@TheGreatAxios
TheGreatAxios force-pushed the cl-12126-point-trimmed-tool-results-at-their-saved-output-instead-of branch from 1071c47 to 65b5a57 Compare November 4, 2026 22:26
@TheGreatAxios
TheGreatAxios force-pushed the cl-12126-point-trimmed-tool-results-at-their-saved-output-instead-of branch from 65b5a57 to edc3e8d Compare November 4, 2026 22:26
@TheGreatAxios
TheGreatAxios merged commit 28b2799 into main Nov 4, 2026
2 checks passed
Comment on lines +55 to +63
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]`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant