Repository navigation
fix(sse): keep Responses tool-call ids/args intact and stop replaying output_item.done in PII transform (#15507) - #15824
Merged
Conversation
… output_item.done in PII transform (#15507)
Contributor
CI Coverage Report
Coverage artifact was not available for this run. |
3 tasks
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.
Refs #15507 — partial: fixes call_id/item_id/argument corruption and the replayed
output_item.done; still open: redact-mode sanitization ofresponse.completedoutput[] text snapshots, and fully byte-preserving warn mode for text deltas (still buffered and re-chunked).Root cause
With
PII_RESPONSE_SANITIZATION=true,classifyField(src/lib/sseTextTransform.ts) defaulted unknown strings (call_id,item_id,obfuscation,function_call_arguments.delta) to "content", so they went through the sliding-window buffer and were emitted empty. Atresponse.completed, the Responses branch ofonFlush(src/lib/streamingPiiTransform.ts) then cloned the previousresponse.output_item.doneevent, replaying it with the samesequence_number.Fix
call_id,item_id,obfuscation,encrypted_content,response_id,previous_response_id,status) toMETADATA_KEYS.deltaofresponse.*_arguments.*/custom_tool_call_input.*events as tool args (never buffered).onFlushResponses branch: never clone a non-delta (terminal) event; emit remaining buffered text as a freshresponse.output_text.delta, or nothing.Tests
New
tests/unit/issue-15507-pii-responses-tool-lifecycle.test.ts: RED on base (added.item.call_id must be preserved: '' !== 'call_probe', duplicate output_item.done), GREEN after. Existing pii-, adversarialPii, issue-13488, piiReproduction, piiSanitizer, sseTextTransform, streamingPii* all pass.Gates: file-size, complexity, cognitive-complexity, eslint, prettier, typecheck:core, pre-commit hooks.
Not addressed (follow-up): redact-mode snapshot sanitization of
response.completed.response.output[]text.