feat(core): bound tool and admitted event payloads via session blobs#37559
Open
armancharan wants to merge 17 commits into
Open
feat(core): bound tool and admitted event payloads via session blobs#37559armancharan wants to merge 17 commits into
armancharan wants to merge 17 commits into
Conversation
Persist large tool settlement and prompt attachment bodies in session_tool_payload, publish thin durable events with payloadHash, and hydrate projectors plus TUI fetches so SSE and the event log stay within a 256 KiB event-data budget without changing ToolOutputStore media rules. Co-authored-by: Cursor <cursoragent@cursor.com>
Drop boolean/as escape hatches; assert then publish, recover OverBudgetError in-band. Co-authored-by: Cursor <cursoragent@cursor.com>
Encode via Schema instead of casts, blob admits only when attachments carry bytes, treat over-budget progress as a defect, and tighten projector/SQL typing. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Cover projector rebuild of thin tool.success from session blobs, and publisher fail-not-truncate when thin event data still exceeds budget. Co-authored-by: Cursor <cursoragent@cursor.com>
Use one local persistToolPayload for publisher settlement and progress. Co-authored-by: Cursor <cursoragent@cursor.com>
armancharan
commented
Jul 17, 2026
Use Schema.decodeUnknownSync for tool success and admitted event data. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
optionalKey schemas reject explicit undefined; keep publishes and Schema.decodeUnknownSync tests aligned. Co-authored-by: Cursor <cursoragent@cursor.com>
armancharan
marked this pull request as ready for review
July 17, 2026 21:50
Cover thin tool.success and input.admitted refetching full bodies, and assert events without payloadHash do not hit those endpoints. Co-authored-by: Cursor <cursoragent@cursor.com>
armancharan
commented
Jul 17, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
This reverts commit cb892f2.
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Jul 18, 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.
Issue for this PR
Closes #36444
#36444
Parent: #36441
✧ raised · ○ in review · ● approved · ✓ merged
#36441 epic: scope streams + bound payloads
Merge in order:
v2
└ ○ #37486 location interest
└ ○ #37487 session interest + fan-out bench
└ ○ #37585 stream ownership / diagnostics
└ ○ #37586 reconnect herd
Siblings under the epic (not git parents of the stack tip):
└ ○ #37559 session blobs + payloadHash ← this PR
└ ○ #37570 ensure-on-first-failure → feeds #37586
Adjacent: #36524 (image dedupe only — complementary, not a substitute).
Type of change
What does this PR do?
Durable
session.tool.success/progressandsession.input.admittedevents were carrying multi-megabyte bodies (tool output, inline base64 attachments). That multiplies encode/SSE/decode cost across every subscriber.This PR makes those events bounded projections:
session_tool_payload(same lifetime as the session).payloadHashplus small text previews only.databudget is 256 KiB UTF-8; over-budget settlement fails (no silent truncate).session_message/session_pendingfrom the blob so replay stays complete.payloadHashis present.ToolOutputStore.boundmedia rules are unchanged (provider channel only — not the durable event sidecar).How did you verify your code works?
packages/coretest/tool-payload.test.ts— multi-MB blob round-trip; thin event under budget; oversize thin failspackages/coretest/session-runner-tool-events.test.ts— thin success omits base64; over-budget → Failedpackages/coretest/session-pending-attachments.test.ts— large admit thin + hydrate; text-only omits hashpackages/coretest/session-tool-progress.test.ts— projector hydrates thintool.successintosession_messagepackages/tuitest/cli/tui/payload-hash.test.tsx— TUI refetch onpayloadHash(message + pending); no refetch without hashAcceptance → test
tool-payload+over-budget thin success fails settlement…hydrates thin tool success…+tool.success with payloadHash refetches…admits a large attachment…+input.admitted with payloadHash refetches pendingdata)payload-hash.test.tsxScreenshots / recordings
N/A — not a UI layout change.
Checklist