Skip to content

fix(responses): replay a turn that declares local shell or computer use - #9356

Open
lcxhh521 wants to merge 1 commit into
lidge-jun:devfrom
lcxhh521:codex/reset-replay-client-declarations
Open

lcxhh521 wants to merge 1 commit into
lidge-jun:devfrom
lcxhh521:codex/reset-replay-client-declarations

Conversation

@lcxhh521

@lcxhh521 lcxhh521 commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Same-origin reset replay already treats local_shell_call and computer_call history as client-owned: a second send only repeats the inference. The catalog check did not. A request that still declared local_shell, computer_use, or computer_use_preview failed the whole body, so the ordinary Codex turn that owns those calls was not replayable.

Those three nameless declarations are now client-executed tools, including when they arrive through additional_tools. Hosted {type:"shell"} stays refused. Cross-provider compaction recovery still refuses the nameless declarations, because a translated route drops them and must not forward that catalog to another provider.

Verification

On head c7e2c89923, based on upstream/dev 49a023147e.

env -u HTTP_PROXY -u HTTPS_PROXY /tmp/bun-1.4.4/bin/bun test ./tests/responses/responses-reset-replay.test.ts ./tests/responses/responses-compaction-recovery.test.ts

116 pass, 0 fail.

/tmp/bun-1.4.4/bin/bun run structure:check passed.

bun run typecheck did not run: this Bun 1.4.4 rejects the script flag --no-script. bun check --noEmit reports five existing errors in files this diff does not change (src/advisor/consult.ts, src/lib/local-chat-completion.ts, src/providers/cc-switch-import-source.ts, src/server/responses/fetch-helpers.ts). The full test suite was not run.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed. structure/transports/responses-failover.md names the nameless client declarations and the compaction exception.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. Hosted shell is still refused, so a second send cannot re-run an origin-executed shell.

Rebased onto upstream/dev 110235d470 and the focused tests for this branch were re-run on that base.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • Required local validation passed; commands, results, and any full-suite exception are documented.

  • I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • New Features
    • Same-origin reset replay can now handle requests declaring local_shell, computer_use, or computer_use_preview tools, when other replay conditions are met.
  • Bug Fixes
    • Compaction recovery continues to avoid replaying requests with these nameless tool declarations, since translated routes may not preserve them.
    • Hosted shell tool requests remain ineligible for reset replay.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added bug Something isn't working review-ready labels Dec 4, 2026
@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed; the review readiness checklist is complete.

Review readiness checklist

  • ✅ Required local validation passed; commands, results, and any full-suite exception are documented.
  • ✅ I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ✅ My PR is ready for review.

✅ 4/4 boxes ticked.

This pull request has been marked Ready for Review.
The review-ready label marks this PR as ready; review automation runs independently.
Maintainers notified: @lidge-jun @Ingwannu

Hygiene

✅ Deterministic PR hygiene checks passed.

@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Reset replay now accepts local_shell, computer_use, and computer_use_preview declarations by default. Compaction recovery disables that acceptance. Tests and transport documentation describe the different handling.

Changes: Client tool replay handling

Layer / File(s) Summary
Replay validation
src/server/responses/reset-replay.ts (lines 95–152), tests/responses/responses-reset-replay.test.ts (lines 598–618)
selfContainedResponsesBody accepts the three nameless client tool declarations by default in root and nested tool catalogs. The namelessClientTools option can disable this acceptance. Tests also check that hosted shell is rejected.
Compaction recovery boundary
src/server/responses/compaction-recovery.ts (line 82), tests/responses/responses-compaction-recovery.test.ts (lines 565–574), structure/transports/responses-failover.md (line 80)
Compaction recovery disables acceptance of nameless client tool declarations. Tests assert that these requests call only the source model. The documentation describes the declarations as eligible for same-origin reset replay when other conditions are met, but not for compaction recovery.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • lidge-jun/opencodex#9221: Updates the reset replay allowlist for client-owned tool history, including local shell and computer turns.

Suggested labels: bug

Merge Risk: Minimal · up to c7e2c

Same-origin retry replay now accepts turns that declare local_shell, computer_use or computer_use_preview, so those turns can repeat inference after a reset. Cross-provider compaction recovery still refuses them, and hosted shell is still rejected. No concrete merge-blocking defect was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(responses): replay a turn that declares local shell or computer use" matches the main change. The PR makes same-origin reset replay accept the client-executed local_shell, computer_use,…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "fix(responses): replay a turn that declares local shell or computer use" matches the main change. The PR makes same-origin reset replay accept the client-executed local_shell, computer_use, and computer_use_preview declarations, including those in additional_tools, and the raw summary and objectives confirm this. The title does not mention the retained refusals (hosted shell, cross-provider compaction recovery), which is acceptable because the title need not cover every detail.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 49a0231 and c7e2c89.

Files selected for processing: 5

  • src/server/responses/compaction-recovery.ts
  • src/server/responses/reset-replay.ts
  • structure/transports/responses-failover.md
  • tests/responses/responses-compaction-recovery.test.ts
  • tests/responses/responses-reset-replay.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

A reset replay already accepted local_shell_call and computer_call history, but the catalog check still rejected local_shell, computer_use, and computer_use_preview. Those declarations are executed by the client, so a same-origin retry only repeats the inference. Hosted shell stays refused. Cross-provider compaction still refuses the nameless declarations because a translated route drops them.
@lcxhh521
lcxhh521 force-pushed the codex/reset-replay-client-declarations branch from c7e2c89 to e9fbb7b Compare December 6, 2026 15:17
@github-actions
github-actions Bot marked this pull request as draft December 6, 2026 15:18
@github-actions
github-actions Bot marked this pull request as ready for review December 6, 2026 15:19

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working review-ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant