Skip to content

fix(sse): keep Responses tool-call ids/args intact and stop replaying output_item.done in PII transform (#15507) - #15824

Merged
diegosouzapw merged 1 commit into
release/v3.8.52from
fix/15507-responses-pii-warn-bytes
Oct 8, 2026
Merged

diegosouzapw merged 1 commit into
release/v3.8.52from
fix/15507-responses-pii-warn-bytes

Conversation

@diegosouzapw

@diegosouzapw diegosouzapw commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #15507 — partial: fixes call_id/item_id/argument corruption and the replayed output_item.done; still open: redact-mode sanitization of response.completed output[] 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. At response.completed, the Responses branch of onFlush (src/lib/streamingPiiTransform.ts) then cloned the previous response.output_item.done event, replaying it with the same sequence_number.

Fix

  • Add Responses protocol identifiers (call_id, item_id, obfuscation, encrypted_content, response_id, previous_response_id, status) to METADATA_KEYS.
  • Treat delta of response.*_arguments.* / custom_tool_call_input.* events as tool args (never buffered).
  • onFlush Responses branch: never clone a non-delta (terminal) event; emit remaining buffered text as a fresh response.output_text.delta, or nothing.
  • PII opt-in defaults untouched (Hard Rule feat: v0.2.0 — advanced routing services, cost analytics, pricing overhaul #20).

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.

⚠️ base-red inherited: #15306 — unit/integration/package-artifact gates timing out, vitest open-sse/mcp-server/tests/audit.test.ts, check:ai-attribution range error

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

CI Coverage Report

  • Coverage job: skipped
  • PR test policy: success

Coverage artifact was not available for this run.

@diegosouzapw
diegosouzapw deleted the fix/15507-responses-pii-warn-bytes branch October 18, 2026 23:49
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