Skip to content

Release completed scanner cancellation IDs - #20980

Merged
OrcaWin merged 1 commit into
mainfrom
np-oom-scan-scanner-late-cancel
Sep 18, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
np-oom-scan-scanner-late-cancel

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​187 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​187
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​175 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​175

Problem and change

The AI Vault child could receive a cancellation after finishing the request but before the parent received its response. Adding that ID to the cancellation set happened after the only cleanup had run, retaining one ID per late cancel for the child's lifetime.

Admit cancellations only while the existing pending set owns the request. Queued and running requests retain their current cancellation behavior. No protocol or history policy changes.

Validation

  • 26 tests across three service suites passed, including successful/error responses, queued/running cancellation and shutdown.
  • Portable actual-entry proof: 1,000 completed requests retain 1,000 cancellation IDs before the fix and zero afterward; pending/controller counts settle to zero in both. Artifacts: docs/audits/scanner-late-cancel/.
  • Full desktop typecheck, lint/formatting and changed-code quality passed. All runs used ORCA_BACKGROUND_LAUNCH=1.

This is small scanner-child metadata retention, also present in v1.4.198. It does not explain #19768's main-PID growth or establish #19831's incident cause.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

  • Cancellation guard — session-scanner-service-entry.ts now ignores a cancel frame unless pending still owns the id, so a cancel that races an already-settled request no longer leaves a stale entry in cancelled. pending spans queued and running requests and is dropped after the result/error is sent, so queued/running cancellation behavior is preserved.
  • Regression coverage — new session-scanner-service-cancellation.test.ts covers late cancels after result and error responses, queued/running cancellation releasing both ids, and shutdown cleanup.
  • Audit artifacts — docs/audits/scanner-late-cancel/ records the leak and ships a reproduction script plus results.

I verified the fix independently: with the three-line guard removed the new suite fails (expected 65 to be 0), and reproduce.mjs runs here and yields the same source hashes as the committed results.json (846f9af9… before, e300d492… after). 26/26 tests pass across the three service suites; oxlint is clean.

ℹ️ Nitpicks

  • docs/audits/ is not in the .gitignore allow-list (docs/** ignores it), so the three files exist only via force-add — a clean git add docs/audits/... silently skips them. This matches the repo norm for engineering-note dirs, so consider it optional.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 734184b0-e9b4-426b-99e3-411bed1cd5d9

📥 Commits

Reviewing files that changed from the base of the PR and between 16ac901 and 87b2d00.

📒 Files selected for processing (5)
  • docs/audits/scanner-late-cancel/README.md
  • docs/audits/scanner-late-cancel/reproduce.mjs
  • docs/audits/scanner-late-cancel/results.json
  • src/main/ai-vault/session-scanner-service-cancellation.test.ts
  • src/main/ai-vault/session-scanner-service-entry.ts

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


📝 Walkthrough

Walkthrough

The scanner service now ignores cancellation messages for IDs that are no longer pending. New tests cover stale, running, queued, and shutdown cancellation behavior. New audit files provide a reproduction harness, measured before-and-after results, and incident documentation for the scanner-child retention issue.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 87b2d

The cancellation guard and its lifecycle coverage introduce no supported merge-blocking issue.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, change, scope, and validation, but it omits most required template sections. It has no ELI5 section, linked issue, visual-proof statement, testing checklist, AI d… Complete the required template sections. Add an ELI5 summary, a linked issue in the required Fixes #... format, N/A with a reason for visual proof if applicable, testing details and checkbox status, AI disclosure, review information, ag…
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly relates to releasing cancellation IDs after scanner requests complete, which is the main production change.
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.
Full details: Description check

Explanation

The description explains the problem, change, scope, and validation, but it omits most required template sections. It has no ELI5 section, linked issue, visual-proof statement, testing checklist, AI disclosure, review, agent-boundary confirmation, notes, or completion checklist.

Resolution

Complete the required template sections. Add an ELI5 summary, a linked issue in the required Fixes #... format, N/A with a reason for visual proof if applicable, testing details and checkbox status, AI disclosure, review information, agent-skill boundary confirmation, notes on compatibility and performance, and the checklist results.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

@OrcaWin
OrcaWin merged commit e9c04fb into main Sep 18, 2026
29 checks passed
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
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