Repository navigation
Release completed scanner cancellation IDs - #20980
Conversation
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Cancellation guard —
session-scanner-service-entry.tsnow ignores acancelframe unlesspendingstill owns the id, so a cancel that races an already-settled request no longer leaves a stale entry incancelled.pendingspans 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.tscovers late cancels afterresultanderrorresponses, 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.gitignoreallow-list (docs/**ignores it), so the three files exist only via force-add — a cleangit add docs/audits/...silently skips them. This matches the repo norm for engineering-note dirs, so consider it optional.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe 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 The cancellation guard and its lifecycle coverage introduce no supported merge-blocking issue. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation 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 Full details: Docstring CoverageExplanation 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.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
…i#20980) Co-authored-by: m4air <m4air@Mac.localdomain>

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
docs/audits/scanner-late-cancel/.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.