Repository navigation
fix(sdk): keep exception text behind capture flags - #88
Merged
Merged
Conversation
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.
Merged
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.
With
captureInput: falseorcaptureOutput: false, the core SDKs still exported each recorded error'sexception.messageandexception.stacktracewithout 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
maskwithexception.messageorexception.stacktraceas the key, then the usual serialization and truncation. Error status,error.type, and theexceptionevent withexception.typeare 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 droppederror toonError/on_errorand 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.mdupdates C14 and C16.