Repository navigation
Bound rejected extension payloads in fallback diagnostics - #7431
Merged
ymichael merged 1 commit intoNov 16, 2026
Merged
Conversation
When the server rejected an extension item or state event, it replaced it with a provider/unhandled diagnostic that copied the full original payload. A payload rejected for exceeding the 64 KiB limit, or rejected for ownership or a missing schema before the size check ran, was still stored in full, so repeated rejected snapshots filled the event history. The diagnostic now keeps the payload only when it fits the 64 KiB limit. A larger payload is replaced by payloadOmitted: true and its UTF-8 payloadBytes, on every rejection path. The rejection reason is capped at 4096 characters with a truncation marker, so a large validator message cannot defeat the bound. Kind, provider, method, scope, and parent tool call provenance are unchanged. Fixes get-bb#6025
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.
Human comments
What was wrong
validateSiteinapps/server/src/internal/extension-payloads.tsrejects provider extension payloads overEXTENSION_PAYLOAD_MAX_BYTES(64 KiB). Each rejection becomes aprovider/unhandleddiagnostic throughtoUnhandledEvent, which copiedsite.payloadintorawEvent.params.payloadunchanged. The size limit stopped the extension update but not the stored copy, so repeated rejected snapshots kept large hidden history (#6025). The ownership and undeclared-kind checks run before the size check, so oversized payloads they reject were stored in full too. Validator reasons had no length limit.What changed
extension-payloads.ts:toUnhandledEventmeasures the payload in UTF-8 bytes with the sameBuffer.byteLength(JSON.stringify(...))that the size check uses. A payload over the limit is replaced bypayloadOmitted: trueandpayloadBytes. A payload at or under the limit is kept, as before. The reason is cut to 4,096 characters with the existingsliceUtf16Headfrom@bb/text-utilsand a... [truncated]marker. Kind, method, scope,providerThreadIdandparentToolCallIdare unchanged.internal-extension-payloads.test.ts: regressions for the issue's item and state cases, a table of payloads at the limit and one byte over it on the ownership, undeclared-kind and corebb/provider-commandspaths, and a test for a long validator reason.The two new fields are inside
rawEvent.paramsof a diagnostic event. No code readsparams.payloadfrom these events. No wire, schema or protocol version change. Rows stored before this change are not rewritten.How you verified
extension-payloads.ts): 4 of 13 fail, for exampleexpected { kind: 'provider-nobody/goal', …(2) } to not have property "payload"andexpected false to be truefor the reason length.internal-extension-payloads.test.tspasses 13 of 13.pnpm exec turbo run lint lint:type-aware typecheck --filter=@bb/serverpasses, 7 of 7 tasks, 0 warnings.oxfmt --checkpasses on the changed files.pnpm exec turbo run test --filter=@bb/server: 4,044 passed. The 2 failures are timeouts intest/app/install-machine-script.test.ts, which also fails on unchanged main under a full run and passes alone.Fixes #6025