Skip to content

fix(responses): restore DeepSeek streaming and routed code-mode tools - #1361

Open
baileyh8 wants to merge 22 commits into
lidge-jun:devfrom
baileyh8:agent/fix-routed-computer-browser
Open

fix(responses): restore DeepSeek streaming and routed code-mode tools#1361
baileyh8 wants to merge 22 commits into
lidge-jun:devfrom
baileyh8:agent/fix-routed-computer-browser

Conversation

@baileyh8

@baileyh8 baileyh8 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Restore progressive Responses streaming for deepseek-v4-flash while safely repairing terminal-less upstream SSE streams.
  • Mark routed models as code_mode_only in the Codex catalog so routed sessions can reach supported local Computer Use and browser capabilities through node_repl.
  • Bridge routed Responses exec custom-tool calls across the passthrough boundary without changing native OpenAI model behavior.
  • Document the routed-tool boundary and DeepSeek streaming behavior.

Why

OpenCodex previously forced deepseek-v4-flash through non-streaming JSON because its upstream SSE can omit a terminal event. Codex users therefore saw no progressive output and could receive a late 502 when the response stalled.

Separately, routed models were catalogued without the code-mode policy and their exec custom-tool lifecycle was not translated across the Responses passthrough boundary. As a result, selecting a routed model disabled browser and Computer Use workflows even though Codex could safely expose them through its local node_repl runtime.

Impact

DeepSeek Responses output now streams progressively, terminal events are synthesized only for structurally complete lifecycles, and unsafe or ambiguous streams fail closed as incomplete. Routed models can use supported local browser and Computer Use operations through code mode. Native OpenAI routes remain unchanged.

The existing Responses vision sidecar path and image-generation behavior were regression-tested as part of the end-to-end validation.

Verification

  • bun run typecheck — pass.
  • bun run privacy:scan — pass.
  • bun run build in docs-site — pass, 221 pages built.
  • DeepSeek streaming, terminal repair, routed custom tools, catalog, vision, and image-generation focused suite — 450 pass, 0 fail.
  • git range-diff after rebasing onto 4f322803f — the original 20 commits remained patch-equivalent; review fixes 9481b37b4 and 41099a15f are added on top, and GitHub Compare reports 0 commits behind dev.
  • Full bun run test on the preceding dev base — 10,643 pass / 7 skip / 8 fail; the same eight codex-auth-api failures reproduced on a clean upstream dev worktree, and the subsequent upstream commits do not touch that subsystem.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Review readiness checklist

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

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • New Features

    • Routed models now support Codex-managed Computer Use, Browser, MCP, and command tools.
    • Routed tool calls are translated and restored for broader provider compatibility.
    • DeepSeek V4 Flash supports native Responses streaming.
  • Bug Fixes

    • Missing DeepSeek completion events are repaired after a five-second grace period.
    • Invalid or incomplete streams are reported as incomplete instead of successful.
  • Documentation

    • Added guidance for routed tools, DeepSeek streaming, provider support, and catalog updates.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR adds routed Codex local-tool support through code_mode_only metadata and custom-tool translation. It also adds native DeepSeek V4 Flash Responses streaming with model-scoped terminal repair, strict incomplete-stream handling, transport integration, tests, and documentation.

Changes

Routed Codex tools

Layer / File(s) Summary
Routed catalog policy
src/codex/catalog/*, tests/codex-catalog*.test.ts
Routed entries use code_mode_only. Native OpenAI entries retain code.
Routed custom-tool translation
src/responses/custom-tool-compat.ts, src/server/responses-custom-tool-repair.ts, src/adapters/openai-responses.ts, src/server/responses/core.ts, tests/responses-custom-tool-repair.test.ts
Routed custom tools are converted to upstream function tools and restored in JSON and SSE Responses output.
Routed documentation and validation
docs-site/src/content/docs/*/guides/codex-integration.md, docs/superpowers/plans/2026-08-09-routed-computer-use-browser.md, docs/superpowers/specs/2026-08-09-routed-computer-use-browser-design.md
The documentation and design artifacts define local tool execution, provider limits, restart requirements, regression checks, and acceptance checks.

DeepSeek Responses streaming

Layer / File(s) Summary
Provider policy and integration
src/providers/registry.ts, src/server/responses/core.ts, docs-site/src/content/docs/guides/providers.md, structure/04-transports-and-sidecars.md
DeepSeek V4 Flash uses a validated five-second terminal-repair policy. The repaired body feeds HTTP and WebSocket relay paths.
Terminal-repair SSE relay
src/server/responses-terminal-repair.ts, docs/superpowers/plans/2026-08-06-deepseek-responses-streaming-terminal-repair.md, docs/superpowers/specs/2026-08-06-deepseek-responses-streaming-terminal-repair-design.md
The relay tracks lifecycle state, validates output graphs, synthesizes terminal events, emits incomplete results for invalid streams, and cleans up timers, readers, and budget reservations.
Transport and lifecycle validation
tests/responses-terminal-repair.test.ts, tests/deepseek-inbound-wire.test.ts, tests/passthrough-abort.test.ts
Tests cover progressive delivery, synthetic completion, EOF and [DONE], invalid lifecycles, terminal races, cancellation, fragmented input, buffer limits, backpressure, and HTTP/WebSocket parity.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Codex
  participant OpenAIResponses
  participant ResponsesCore
  participant UpstreamResponses
  Codex->>OpenAIResponses: Send routed custom-tool request
  OpenAIResponses->>ResponsesCore: Rewrite custom tools as function tools
  ResponsesCore->>UpstreamResponses: Send sanitized Responses request
  UpstreamResponses-->>ResponsesCore: Stream function-call events
  ResponsesCore-->>Codex: Restore custom-tool events and terminal response
Loading
sequenceDiagram
  participant DeepSeek
  participant ResponsesCore
  participant TerminalRepair
  participant Codex
  DeepSeek->>ResponsesCore: Return native Responses SSE
  ResponsesCore->>TerminalRepair: Apply model-scoped repair policy
  TerminalRepair-->>Codex: Forward progressive events
  TerminalRepair-->>Codex: Emit response.completed or response.incomplete
Loading

Possibly related issues

Possibly related PRs

Suggested labels: review-ready

Suggested reviewers: wibias, ingwannu, lidge-jun

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.52% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly summarizes the two primary changes: restoring DeepSeek Responses streaming and enabling routed code-mode tools.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the bug Something isn't working label Aug 9, 2026
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

✅ READY

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

Review readiness checklist

  • ✅ All CI tests are green on my local testing.
  • ✅ I pushed my PR to the latest dev commit.
  • ✅ 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. If no CodeRabbit review appears, comment @coderabbitai review to request one.
Maintainers notified: @lidge-jun @Ingwannu @Wibias

@baileyh8
baileyh8 force-pushed the agent/fix-routed-computer-browser branch from c4389b6 to f63a3e7 Compare August 9, 2026 15:51

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs-site/src/content/docs/guides/codex-integration.md`:
- Around line 198-201: Update the documentation paragraph to apply tool_mode:
"code_mode_only" only to routed catalog entries, matching the scope classified
by src/codex/catalog/sync.ts when model is defined. Avoid describing all
non-OpenAI rows as routed, and preserve the existing explanation of Codex
exec/MCP exposure and local tool execution. Ensure native account-qualified
entries such as team/gpt-5.5 remain excluded from this policy.
- Around line 196-214: Add the missing “Routed local tools” section to the
localized Codex integration pages for Japanese, Korean, Russian, and Simplified
Chinese, matching the English section’s current content and documenting the same
tool-routing behavior and restart guidance.

In `@src/providers/registry.ts`:
- Around line 2320-2322: Update the policy lookup logic around
modelResponsesTerminalRepair to floor policy.graceMs before validation, then
reject the normalized value when it is non-positive or non-finite. Return the
normalized positive integer so fractional values that floor to zero yield
undefined rather than { graceMs: 0 }.

In `@src/server/responses-custom-tool-repair.ts`:
- Around line 33-41: Update the escape-decoding branch in partialCustomToolInput
within src/server/responses-custom-tool-repair.ts (lines 33-41) to decode valid
JSON \b and \f escapes into backspace and form-feed characters, matching
JSON.parse behavior. Extend the fragmented escaped-control-character cases in
tests/responses-custom-tool-repair.test.ts (lines 90-168) to verify streamed
deltas equal the final done input; both sites require changes.

In `@tests/deepseek-inbound-wire.test.ts`:
- Around line 271-277: Update the test around ManualTerminalScheduler and the
terminal-repair flow to expose a pending() method that reports scheduled jobs,
then wait until pending() confirms one job is armed before calling
scheduler.advance(5_000). Replace the single Bun.sleep(0) assumption with this
readiness wait while preserving the existing terminal-close assertion.

In `@tests/responses-terminal-repair.test.ts`:
- Around line 395-414: Update the race test around
relayResponsesSseWithTerminalRepair to capture an armed timer callback before
delivering the real terminal, then execute that callback afterward and assert
only one terminal plus no pending timers. In the cancellation and abort tests,
consume each repaired stream through response.output_item.done so the lifecycle
is processed and a timer is armed, assert one pending timer, then perform
cancellation or abort and verify the timer is cleared and the stream behavior
remains correct.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 61eebdc9-078b-4cfa-8ddc-7e3daee6b311

📥 Commits

Reviewing files that changed from the base of the PR and between 4f746d1 and f63a3e7.

📒 Files selected for processing (23)
  • docs-site/src/content/docs/guides/codex-integration.md
  • docs-site/src/content/docs/guides/providers.md
  • docs-site/src/content/docs/zh-cn/guides/providers.md
  • docs/superpowers/plans/2026-08-06-deepseek-responses-streaming-terminal-repair.md
  • docs/superpowers/plans/2026-08-09-routed-computer-use-browser.md
  • docs/superpowers/specs/2026-08-06-deepseek-responses-streaming-terminal-repair-design.md
  • docs/superpowers/specs/2026-08-09-routed-computer-use-browser-design.md
  • src/adapters/openai-responses.ts
  • src/codex/catalog/parsing.ts
  • src/codex/catalog/sync.ts
  • src/providers/registry.ts
  • src/responses/custom-tool-compat.ts
  • src/server/responses-custom-tool-repair.ts
  • src/server/responses-terminal-repair.ts
  • src/server/responses/core.ts
  • structure/04_transports-and-sidecars.md
  • tests/codex-catalog-sync-hardening.test.ts
  • tests/codex-catalog.test.ts
  • tests/deepseek-inbound-wire.test.ts
  • tests/openai-responses-passthrough.test.ts
  • tests/passthrough-abort.test.ts
  • tests/responses-custom-tool-repair.test.ts
  • tests/responses-terminal-repair.test.ts

Comment thread docs-site/src/content/docs/guides/codex-integration.md
Comment thread docs-site/src/content/docs/guides/codex-integration.md Outdated
Comment thread src/providers/registry.ts Outdated
Comment thread src/server/responses-custom-tool-repair.ts
Comment thread tests/deepseek-inbound-wire.test.ts
Comment thread tests/responses-terminal-repair.test.ts
@baileyh8
baileyh8 marked this pull request as ready for review August 10, 2026 05:27
@github-actions
github-actions Bot marked this pull request as draft August 10, 2026 05:28
@baileyh8
baileyh8 marked this pull request as ready for review August 10, 2026 05:35
@github-actions
github-actions Bot marked this pull request as draft August 10, 2026 05:35
@baileyh8
baileyh8 force-pushed the agent/fix-routed-computer-browser branch 2 times, most recently from c0d472e to 623d610 Compare August 10, 2026 07:14
@baileyh8
baileyh8 force-pushed the agent/fix-routed-computer-browser branch from 623d610 to 659c9e4 Compare August 10, 2026 07:30
@github-actions
github-actions Bot marked this pull request as ready for review August 10, 2026 07:46
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

@github-actions[bot] I am responding to the latest readiness update. I do not have the complete earlier comment chain. The PR is marked ready for review. I will review the current changes.

⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@github-actions[bot] Acknowledged. Pull request #1361 is marked ready for review. The readiness checklist reports 4/4 completed checks.

You are interacting with an AI system.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/adapters/openai-responses.ts`:
- Around line 1249-1251: Use the same resolved authMode source for custom-tool
rewriting, custom-tool name collection, and registry transport checks. In
src/adapters/openai-responses.ts lines 1249-1251, replace the
adapterProvider-based decision with the shared route/provider authMode used by
core; update src/server/responses/core.ts lines 1904-1906 and 2267-2271 to use
adapterProvider, which is available from the flow beginning around line 1766, so
all passthrough and transport decisions remain consistent for custom key
providers.

In `@src/server/responses-custom-tool-repair.ts`:
- Around line 104-130: Update the response processing around itemNames and the
response.function_call_arguments.delta branch to buffer unmatched deltas by
output_index and/or function name until the routed item ID is known, then
associate and replay them under that ID. Do not relay buffered deltas as
function-call SSE. Keep releaseCall exclusively in the response.output_item.done
path after the call has been identified.

In `@src/server/responses-terminal-repair.ts`:
- Around line 292-303: Update the done-handling path around nextSseBlock(),
inspectPayload(), and emitSynthetic() to mark any residual unframed buffer
suffix as tainted, relay its bytes if required, but never inspect it as an SSE
payload or allow it to establish completion. Add a regression test covering a
final response.output_item.done frame without its terminating blank line,
asserting that the relay emits response.incomplete.

In `@src/server/responses/core.ts`:
- Around line 2311-2313: Reorder the block rewrites in the construction of
blockRewrites so createRoutedCustomToolRestoreBlockRewrite runs after the GitHub
Copilot and snapshot rewrites, ensuring those rewrites process upstream
function_call events before routed custom tools are converted. Preserve the
existing conditional behavior for routedCustomToolNames and translatorBudget.

In `@tests/responses-custom-tool-repair.test.ts`:
- Around line 199-257: Extend the handleResponses SSE test to assert clientSse
contains no function_call item type, not only no arguments event. Add a focused
non-streaming sibling test with the fetch stub returning application/json and an
output function_call, then assert the response exposes custom_tool_call with the
unwrapped input. Also cover the core authMode "forward" gate by verifying routed
custom tools are not restored or forwarded in that configuration.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ff96d133-218a-4256-b60c-ceafcf9de694

📥 Commits

Reviewing files that changed from the base of the PR and between 4f32280 and 659c9e4.

📒 Files selected for processing (27)
  • docs-site/src/content/docs/guides/codex-integration.md
  • docs-site/src/content/docs/guides/providers.md
  • docs-site/src/content/docs/ja/guides/codex-integration.md
  • docs-site/src/content/docs/ko/guides/codex-integration.md
  • docs-site/src/content/docs/ru/guides/codex-integration.md
  • docs-site/src/content/docs/zh-cn/guides/codex-integration.md
  • docs-site/src/content/docs/zh-cn/guides/providers.md
  • docs/superpowers/plans/2026-08-06-deepseek-responses-streaming-terminal-repair.md
  • docs/superpowers/plans/2026-08-09-routed-computer-use-browser.md
  • docs/superpowers/specs/2026-08-06-deepseek-responses-streaming-terminal-repair-design.md
  • docs/superpowers/specs/2026-08-09-routed-computer-use-browser-design.md
  • src/adapters/openai-responses.ts
  • src/codex/catalog/parsing.ts
  • src/codex/catalog/sync.ts
  • src/providers/registry.ts
  • src/responses/custom-tool-compat.ts
  • src/server/responses-custom-tool-repair.ts
  • src/server/responses-terminal-repair.ts
  • src/server/responses/core.ts
  • structure/04_transports-and-sidecars.md
  • tests/codex-catalog-sync-hardening.test.ts
  • tests/codex-catalog.test.ts
  • tests/deepseek-inbound-wire.test.ts
  • tests/openai-responses-passthrough.test.ts
  • tests/passthrough-abort.test.ts
  • tests/responses-custom-tool-repair.test.ts
  • tests/responses-terminal-repair.test.ts

Comment thread src/adapters/openai-responses.ts
Comment thread src/server/responses-custom-tool-repair.ts
Comment thread src/server/responses-terminal-repair.ts
Comment thread src/server/responses/core.ts
Comment thread tests/responses-custom-tool-repair.test.ts
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

@github-actions[bot] Acknowledged. PR #1361 is ready for review. The readiness checklist and hygiene checks passed.

⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions
github-actions Bot marked this pull request as draft August 10, 2026 09:05

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/server/responses-custom-tool-repair.ts (1)

94-105: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Retained bytes charged after a terminal event are never released, and no test covers that order. releaseAll latches disposed on the first terminal event, so every later release becomes a no-op while retainPendingArgument and the routed-delta branch keep charging the TranslatorBudget. The single root cause is the disposed flag doing double duty as both a "already released" guard and a "disposed" marker.

  • src/server/responses-custom-tool-repair.ts#L94-L105: remove the if (disposed) return; guard and the disposed = true; assignment from releaseAll, which is already idempotent. Set disposed only in the rewrite.dispose wrapper at Line 251, and gate retainPendingArgument on it so no new bytes are charged after disposal.
  • tests/responses-custom-tool-repair.test.ts#L171-L215: add a sibling test that sends response.completed, then a late response.function_call_arguments.delta, then calls rewrite.dispose?.(), and asserts budget.snapshot().currentBytes is 0.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/server/responses-custom-tool-repair.ts` around lines 94 - 105, Separate
disposal state from cleanup in releaseAll: in
src/server/responses-custom-tool-repair.ts#L94-L105, remove its disposed guard
and assignment, set disposed only in the rewrite.dispose wrapper at Line 251,
and gate retainPendingArgument so it cannot charge bytes after disposal. Add the
sibling regression test in tests/responses-custom-tool-repair.test.ts#L171-L215
covering response.completed, a late response.function_call_arguments.delta, and
rewrite.dispose?.(), asserting budget.snapshot().currentBytes is 0.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/server/responses-custom-tool-repair.ts`:
- Around line 117-134: Update takePendingArguments so a pending entry with an
itemId matches only the requested itemId; use outputIndex as a fallback only
when the pending entry has no itemId. Add a focused regression test beside the
existing buffering tests in responses-custom-tool-repair.test.ts that buffers
fc_a at output_index 0, adds fc_b at the same index, and verifies fc_a’s delta
is not replayed as fc_b input.

In `@tests/responses-custom-tool-repair.test.ts`:
- Around line 398-447: Update the forward-auth test around handleResponses to
capture the outbound request headers in the mocked globalThis.fetch, then assert
that the forwarded authorization header equals "Bearer caller-token". Keep the
existing outbound body and custom-tool assertions unchanged, and ensure the
header capture handles the fetch init headers.
- Around line 171-215: Add a sibling regression test near “buffers argument
events until a missing added event is identified by item done” that sends a
terminal event first, then an argument frame, and asserts the translator
budget’s currentBytes returns to zero. Exercise the same rewrite path and verify
post-terminal argument handling does not retain budget bytes, while preserving
existing terminal behavior.

---

Outside diff comments:
In `@src/server/responses-custom-tool-repair.ts`:
- Around line 94-105: Separate disposal state from cleanup in releaseAll: in
src/server/responses-custom-tool-repair.ts#L94-L105, remove its disposed guard
and assignment, set disposed only in the rewrite.dispose wrapper at Line 251,
and gate retainPendingArgument so it cannot charge bytes after disposal. Add the
sibling regression test in tests/responses-custom-tool-repair.test.ts#L171-L215
covering response.completed, a late response.function_call_arguments.delta, and
rewrite.dispose?.(), asserting budget.snapshot().currentBytes is 0.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ee36f5de-d3eb-45b3-b53c-b4f427d3142a

📥 Commits

Reviewing files that changed from the base of the PR and between 659c9e4 and 9481b37.

📒 Files selected for processing (4)
  • src/server/responses-custom-tool-repair.ts
  • src/server/responses-terminal-repair.ts
  • tests/responses-custom-tool-repair.test.ts
  • tests/responses-terminal-repair.test.ts

Comment thread src/server/responses-custom-tool-repair.ts
Comment thread tests/responses-custom-tool-repair.test.ts
Comment thread tests/responses-custom-tool-repair.test.ts
@github-actions
github-actions Bot marked this pull request as ready for review August 10, 2026 09:20
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@github-actions[bot] Acknowledged. Pull request #1361 is marked ready for review. The readiness checklist reports 4/4 completed checks.

You are interacting with an AI system.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@github-actions[bot] Acknowledged. Pull request #1361 is marked ready for review. The readiness checklist and hygiene checks passed.

You are interacting with an AI system.

@github-actions
github-actions Bot marked this pull request as draft August 10, 2026 09:34
@github-actions
github-actions Bot marked this pull request as ready for review August 10, 2026 09:40
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@github-actions[bot] Acknowledged. Pull request #1361 is marked ready for review. The readiness checklist is complete with 4/4 checks passed.

You are interacting with an AI system.

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