Skip to content

fix(sdk): keep exception text behind capture flags - #88

Merged
aikins01 merged 1 commit into
mainfrom
fix/sdk-exception-privacy
Oct 27, 2026
Merged

aikins01 merged 1 commit into
mainfrom
fix/sdk-exception-privacy

Conversation

@aikins01

Copy link
Copy Markdown
Contributor

With captureInput: false or captureOutput: false, the core SDKs still exported each recorded error's exception.message and exception.stacktrace without masking. Error text often repeats a prompt or a tool result, so turning capture off did not keep that content out of telemetry.

The TypeScript and Python cores now record the message and stack only when both effective input and output capture are on for the span, including per-span overrides. Either flag is enough to block them, because an exception can echo the input or the output. When they are recorded, they go through mask with exception.message or exception.stacktrace as the key, then the usual serialization and truncation. Error status, error.type, and the exception event with exception.type are always kept. The rule is per span: an error that propagates to an enclosing span with capture on is recorded there in full, and the docs say so.

A mask hook that throws now drops the field and reports a fixed mask hook raised; content dropped error to onError / on_error and the SDK log. Before, it reported the hook's own error, which can carry the unmasked value or chain the application exception. Python serialization failures report the same way. The application's own error is still rethrown unchanged.

This changes what existing users receive: with either capture flag off, exception messages and stacks are gone, and existing masks now also see the two exception keys. The pi, omp, and opencode integrations already withheld host error text unless the span captures output unmasked, and they keep doing that for users on older core versions. The OpenAI, Anthropic, and Cursor READMEs now describe the new rule and note that older core versions still export exception text. docs/sdk-conformance.md updates C14 and C16.

With captureInput or captureOutput off, the TypeScript and Python cores
still exported each recorded error's exception.message and
exception.stacktrace, unmasked. Error text often repeats a prompt or a
tool result.

Both cores now record the message and stack only when both effective
capture flags are on for the span, and pass them through mask,
serialization, and truncation. Error status, error.type, and the
exception event with exception.type are always kept. A mask that
throws drops the field and reports a fixed "mask hook raised; content
dropped" error instead of the hook's own error; Python serialization
failures report the same way.

Users with either capture flag off no longer receive exception messages
or stacks, and existing masks now also see the exception.message and
exception.stacktrace keys.
@aikins01 aikins01 self-assigned this Oct 27, 2026
@aikins01
aikins01 merged commit e9e49c3 into main Oct 27, 2026
10 checks passed
@aikins01
aikins01 deleted the fix/sdk-exception-privacy branch October 27, 2026 11:22
@aikins01 aikins01 mentioned this pull request Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant