Skip to content

Abort settled notebook AI turns - #1172

Merged
tannerlinsley merged 1 commit into
mainfrom
agent/abort-settled-notebook-ai-turn
Aug 20, 2026
Merged

Abort settled notebook AI turns#1172
tannerlinsley merged 1 commit into
mainfrom
agent/abort-settled-notebook-ai-turn

Conversation

@tannerlinsley

@tannerlinsley tannerlinsley commented Aug 20, 2026

Copy link
Copy Markdown
Member

Evidence

The local notebook validation flow can fail while staging or validating a candidate. The assistant catches that failure and rolls the notebook back, but the per-prompt AbortController stayed live. The fetch SSE adapter releases its reader without cancelling the response when iteration exits through an error, so the local Codex request, turn, and validation broker could remain active until the five-minute idle timeout.

No open issue or pull request addresses this cleanup. PR #1123 touches the same component only for the Base UI migration and does not modify the request lifecycle.

Change

Always abort the per-prompt controller in the existing finally block after the prompt settles.

Impact

Failed or completed notebook AI requests now release their fetch, local bridge turn, and validation wait immediately instead of relying on the idle timeout.

Validation

  • pnpm test
  • TypeScript and type-aware lint clean
  • 361 tests total: 360 passed, 1 environment-gated docs smoke test skipped
  • Commit hook repeated formatting and the full test gate successfully
  • git diff --check

Risk

Low. Abort is idempotent and runs only after success, failure, or user cancellation has already settled. Successful streams are already complete at that point.

Summary by CodeRabbit

  • Bug Fixes
    • Improved cleanup after notebook assistant requests finish, fail, or are cancelled.
    • Helps prevent lingering request activity and ensures cancellations are handled reliably.

@tannerlinsley tannerlinsley added the source-audit Tracked by the automated source audit label Aug 20, 2026
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 24b2b3c4-7846-4102-9f11-ccde3d1cbf1b

📥 Commits

Reviewing files that changed from the base of the PR and between 9ad7dd5 and 48a87b5.

📒 Files selected for processing (1)
  • src/components/notebook/NotebookAssistant.client.tsx

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

runPrompt now aborts its AbortController during final cleanup after completion, failure, or cancellation.

Changes

Prompt request cleanup

Layer / File(s) Summary
Abort controller finalization
src/components/notebook/NotebookAssistant.client.tsx
runPrompt aborts its request controller in the finally block.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 48a87

The change immediately releases settled notebook AI requests without altering successful request behavior, and no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the change to abort notebook AI turns after they settle.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/abort-settled-notebook-ai-turn

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.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tanstack-com 48a87b5 Commit Preview URL

Branch Preview URL
Aug 20 2026, 02:19 PM

@tannerlinsley
tannerlinsley merged commit 8638f3c into main Aug 20, 2026
7 checks passed
@tannerlinsley
tannerlinsley deleted the agent/abort-settled-notebook-ai-turn branch August 20, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

source-audit Tracked by the automated source audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant