Skip to content

fix(runtime+remote): turn-cancel state cleanup and streaming error surfacing (F2/F3/F4) - #672

Merged
delete-cloud merged 2 commits into
mainfrom
fix/turn-cancel-state-and-stream-errors
Jul 5, 2026
Merged

delete-cloud merged 2 commits into
mainfrom
fix/turn-cancel-state-and-stream-errors

Conversation

@delete-cloud

Copy link
Copy Markdown
Owner

Reopens #671 (auto-closed when the head branch was deleted after a blocked merge attempt; identical content, prior CI green: test + CodeRabbit pass). Fixes F3 (permanent 409 after stream disconnect: liveness cancel + finalize-routed admission clearing, running owned turns preserved), F4 (cancelled fork tape bricking sessions: rollback on BaseException, _bind_tape untouched), F2 (streaming error rendering crash: bounded read, HTTP code + detail, never crashes). Plain bug fixes under ADR-0055/0068, codex-delegated, 2-round subagent review to 0 P1/P2, red-first gating tests. Full suite 4059/8/20. Evidence: docs/dogfood/SEMANTIC_MEMORY_RUN_EVIDENCE.md

🤖 Generated with Claude Code

delete-cloud and others added 2 commits July 5, 2026 14:59
_response_error_detail crashed with httpx.ResponseNotRead when rendering an
error from an unread streaming response, masking the real failure (a live
409 was invisible). Read the body bounded (byte cap + 5s threaded reader
timeout), surface 'HTTP <code>: <detail>' with a bounded plain-text
fallback, and never crash while rendering an error.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ks (F3/F4)

Live-evidenced on o6n: a client disconnect during a streaming prompt left
run rows cancelled while process-local Session.turn_in_progress/task never
cleared (permanent 409 'Turn already in progress'); separately, pipeline
fork rollback only ran under 'except Exception', so cancellation left the
cached runtime on a dirty fork tape whose later persistence hit the durable
_bind_tape guard ('session tape target cannot be rebound'), bricking the
session.

- pipeline: fork rollback also on cancellation/BaseException, best-effort
  and original-exception-preserving; ctx.tape restored to the stable tape
- lifecycle: RuntimeTurnSessionState.finalize(turn_finished=...) clears
  admission when the owning task finished/cancelled, preserves it while
  the owned turn is still running (existing contract test unchanged)
- http_server: stream cleanup cancels by liveness (covers GeneratorExit/
  aclose), awaits the task, routes clearing through finalize, shields the
  recovery persist, skips no-op finalization

Red-first gating tests for all failure modes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@delete-cloud, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c0e4bd62-7ee2-4233-95a8-dc21ea82b966

📥 Commits

Reviewing files that changed from the base of the PR and between 072da13 and 3d50cf2.

📒 Files selected for processing (10)
  • coding-agent/src/agentkit/runtime/pipeline.py
  • coding-agent/src/coding_agent/remote/client.py
  • coding-agent/src/coding_agent/runs/lifecycle.py
  • coding-agent/src/coding_agent/runs/turn_execution.py
  • coding-agent/src/coding_agent/server/http_server.py
  • coding-agent/tests/agentkit/runtime/test_pipeline.py
  • coding-agent/tests/cli/test_remote_client.py
  • coding-agent/tests/coding_agent/test_run_lifecycle.py
  • coding-agent/tests/ui/test_http_server.py
  • coding-agent/tests/ui/test_session_manager_runtime.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/turn-cancel-state-and-stream-errors

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.

@delete-cloud
delete-cloud merged commit 041896f into main Jul 5, 2026
3 checks passed
@delete-cloud
delete-cloud deleted the fix/turn-cancel-state-and-stream-errors branch July 5, 2026 08:02
delete-cloud added a commit that referenced this pull request Jul 7, 2026
Session 8bef270e: interrupted approval run ebddb3df cancelled, same-session
prompt run 015122cb completed — no 409, no tape rebind brick. Closes the
F2/F3/F4 fix wave (PR #672, sre-infra #184).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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