refactor(app): extract abort + pending registry from submit.ts - #1071
Conversation
Move the AbortSource/PendingPrompt types, the shared pending map, and the abort closure out of prompt-input/submit.ts into a new submit-abort.ts as a createAbort(deps) factory. Pure extraction, no behavior change; submit.ts imports the pending registry and wires createAbort with its existing deps.
|
Warning Review limit reached
More reviews will be available in 55 minutes and 24 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughExtracts prompt submission abort handling logic into a dedicated module with shared types and factory pattern. Creates ChangesAbort handling extraction and refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Suggested priority: P2 (includes user-path files (packages/app/src/components/prompt-input/submit-abort.ts, packages/app/src/components/prompt-input/submit.ts)).
P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.
There was a problem hiding this comment.
Code Review
This pull request refactors the prompt submission abort logic by extracting it from submit.ts into a new dedicated file submit-abort.ts. Feedback recommends updating the state tracking mechanism by deleting the session from the pending map before executing the abort and cleanup callbacks to prevent potential issues with synchronous re-entrant calls.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
sdk.client is a directory-dependent getter, not a stable reference; capturing it once at factory time would let a long-lived submit instance abort against a stale workspace client. Read it lazily via () => sdk.client so the abort call resolves the current client each invocation, matching the pre-extraction behavior exactly.
Summary
Slice S3 of the submit.ts slimming production line (#1066). Pure extraction, no behavior change.
packages/app/src/components/prompt-input/submit-abort.tsholds theAbortSource/PendingPrompttypes, the sharedpendingmap, the privateemitAbortDiagnostichelper, and acreateAbort(deps)factory containing the verbatim abort body.submit.tsdrops those definitions, imports{ createAbort, pending }from the new module, and wirescreateAbort({ abortReady, sessionID, onAbort, client: sdk.client }).pendingstays a shared module singleton (waitForWorktree'sset/deleteand the catch path keep using the imported map).sessionAbortDiagnosticEvent, the entire@/session/abort-sourceline (rendererAbortDiagnosticSource,RendererAbortSource).emitRendererDiagnosticstays (still used by the submit diagnostic).No DOM/aria/copy/storage-key changes. abort behavior is covered by the existing submit.test.ts abort cases.
Test plan
bun run typecheckcleanbun test src/components/prompt-input/— 382 pass / 2 pre-existing isPromptEqual fails (unchanged from baseline)Summary by CodeRabbit