fix(responses): strip only citation spans, keep Codex App directives - #6040
Conversation
…6039) The citation filter removed every U+E200…U+E201 span, so a correctly formed Codex App visualize directive never reached the app. It now strips only cite/filecite spans and passes every other directive through byte for byte, including private-use characters inside its payload. The whole-string strip runs the streaming state machine, so output_text.done always matches the streamed deltas.
|
✅ Deterministic PR hygiene checks passed. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Repository: lidge-jun/opencodex/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
When a routed model answered with a Codex App visualize reference (
U+E200 visualize U+E202 {"path":…} U+E201), the proxy deleted the whole line, so the app never rendered the visualization. The citation filter added for #3150 removed everyU+E200 … U+E201span without checking the keyword, and the Codex App uses the same delimiters for its own directives.The filter now removes only
citeandfilecitespans. Every other directive passes through byte for byte, including private-use characters inside its payload, up to the existing 4,096-character span bound. The streaming filter is now a per-character state machine that withholds text only while a keyword could still become a citation, andstripCitationMarkersruns the same machine over the whole string, sooutput_text.donealways matches the streamed deltas (#3843).Closes #6039
Verification
bun test tests/responses/citation-markers.test.ts: 23 pass. The 5 new Citation-marker filter strips Codex App visualize directives #6039 cases fail against the previous filter.tests/adapters/bridge.test.ts,tests/responses/protocol-direct-encoders-chat.test.ts, the Kiro metering and completion tests): 200 pass.bun run typecheck,bun run structure:check, andbun run privacy:scanpass.bun run test:changedcould not give a meaningful result locally because this checkout lives under~/.codex. The suite's real Codex home guard refused temporary directory cleanup in unrelated server and integration tests (367 failures, all with that guard error). Full coverage is left to CI.Checklist
Summary by CodeRabbit
citeorfileciteare removed. Other directives, includingvisualize, remain visible.