fix(wizard): Whack a mole part 2: passive telemetry for leaked transport tokens in pi file writes - #1017
Open
gewenyu99 wants to merge 9 commits into
Open
fix(wizard): Whack a mole part 2: passive telemetry for leaked transport tokens in pi file writes#1017gewenyu99 wants to merge 9 commits into
gewenyu99 wants to merge 9 commits into
Conversation
gpt-5.x can bleed its own function-call tokens into a string argument mid-stream: run 9704a73e wrote `.functions.complete_task (commentary ...` plus a DEL byte into a customer's global-error.tsx, and exact-match edits could not remove it before the task deadline — the run shipped a syntax-broken file. Reject write content and edit newText carrying transport signatures before they reach disk; oldText stays unguarded so repairs of already-corrupted files keep working. Generated-By: PostHog Code Task-Id: affdea28-7761-4d50-8335-6b32376b1a82
Generated-By: PostHog Code Task-Id: affdea28-7761-4d50-8335-6b32376b1a82
Generated-By: PostHog Code Task-Id: affdea28-7761-4d50-8335-6b32376b1a82
gewenyu99
marked this pull request as ready for review
July 29, 2026 14:40
…the content The trip event now carries the leaked token itself (escaped, capped), its offset, the content length, and an at_end flag — enough to profile the upstream failure without ever capturing customer code. Generated-By: PostHog Code Task-Id: affdea28-7761-4d50-8335-6b32376b1a82
gewenyu99
marked this pull request as draft
July 29, 2026 14:47
Leaking writes now proceed: the finding is logged, captured as 'file content leak observed', and appended to the task's handoff so the review stage checks the touched files. No error is returned to the model — pure observability while the upstream leak is profiled. Generated-By: PostHog Code Task-Id: affdea28-7761-4d50-8335-6b32376b1a82
Generated-By: PostHog Code Task-Id: affdea28-7761-4d50-8335-6b32376b1a82
Analytics-only now: the leak patterns run where the security extension already extracts write/edit content, one event per leaking call, no blocking, no handoff amendment. Deletes the content-guard module, its tool wrapping, and the leakNote threading through the queue tools. Generated-By: PostHog Code Task-Id: affdea28-7761-4d50-8335-6b32376b1a82
gewenyu99
marked this pull request as ready for review
July 29, 2026 15:20
gewenyu99
commented
Jul 29, 2026
| const match = pattern.exec(content); | ||
| if (!match) continue; | ||
| // JSON.stringify escapes C0 but not DEL. | ||
| const token = JSON.stringify(match[0].slice(0, 40)).replace( |
Collaborator
Author
There was a problem hiding this comment.
Hmmm maybe just report the pattern no the match 1 sec
Generated-By: PostHog Code Task-Id: affdea28-7761-4d50-8335-6b32376b1a82
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.
Passive telemetry for gpt-5.x transport-token leaks in pi write/edit content — one analytics event per leaking call, nothing else.
Lives inside the pi security extension where write
content/ editnewTextare already extracted for the warlock scan — no second interception layer, no tool wrapping. Event carries only which pattern fired and where it sat (at_end: end-of-string is the upstream decoder signature) — no matched text, no path, nothing from the user's code, ever (a test pins this).Why: gpt-5.x streaming with tools leaks its function-call grammar into string values and it lands on disk — run
9704a73eshipped a syntax-brokenglobal-error.tsx. Unfixed upstream: litellm#14260 (exact signature, closed stale), OpenAI community #1386422 (gpt-5.6-luna, ~7% of runs, Chat Completions clean). This event is the field data for deciding the real fix. Companion: context-mill #293 moves the luna-low tasks to terra-low.Created with PostHog Code