Repository navigation
fix: bound workers retained after deleting sessions across agents - #197409
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesCaps retained ordinary session-reclamation workers at four and closes the least recently used worker before admitting another database. Example: Delete sessions across six agent databases in one Gateway process.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: current main still retains an unbounded number of ordinary reclamation workers, and this maintainer-engaged PR provides a focused fix with no actionable findings. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherSession deletion and archive reclamation enter a shared FIFO, reuse workers by database path, and return deletion results after worker-owned SQLite operations. flowchart TD
A[Session deletion] --> B[Archive FIFO]
B --> C[Request and database checks]
C --> D[Retained worker registry]
D --> E[Least recently used worker close]
E --> D
D --> F[SQLite reclamation worker]
F --> G[Deletion result]
Technical reviewBest possible solution: Retain the four-worker LRU bound in the existing registry while preserving native-close custody, FIFO ordering and per-request currentness checks. Do we have a high-confidence way to reproduce the issue? Current-main source retains one worker per visited database without a capacity bound, matching the official-release report at #197331; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch fixes retention at its existing owner with a small capacity check and Map-order refresh, preserving the established cleanup and admission contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d4cdcfc70cf5. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +17, Tests +83, Docs +4. Total +104 across 3 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 26, 2026, 5:20 AM ET / 10:20 UTC (Revision 2). |
|
@clawsweeper re-review Please check |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…oid-chat-preview-grapheme-boundary * commit '0bea7ecb3029583dd49d83f760d4f40c9e1f543c': (129 commits) fix(android): settle startup before checking archive refresh (#205891) fix: Gateway retains completed reply runtimes after catalog reloads (#195479) fix: clear unused-export failures in dependency checks (#205905) refactor: share browser routing for meeting captions and cleanup (#205916) fix(ui): update Workshop file preview mode (#205872) refactor(android): decouple shared JSON values from node handlers (#202840) fix(ci): remove bot credit from release notes (#205914) fix: pause interrupted shell turns when their result is unknown (#205859) fix(ui): skip publication options for removed workspaces (#205909) fix: preserve indentation in document previews (#205834) improve(ci): avoid full fixture builds for volume checks (#205903) refactor(android): derive connection readiness from its owner (#202898) fix: preserve side chat text when dictating at the limit (#205710) improve(telegram): polling workers start faster and use half the memory (#190890) fix: keep speaker identities distinct in meeting notes (#205860) fix: wait for cancellation before releasing ACP test preparation (#205893) fix: bound workers retained after deleting sessions across agents (#197409) fix(memory): keep a child's memory audience after its parent resets (#205887) refactor(android): give installed skills one data owner (#202892) fix(cli): share process failure listeners across invocations (#205732) ...
…enclaw#197409) * fix(sessions): bound workers retained after cross-agent deletion * fix(sessions): validate queued deletes before evicting a worker --------- Co-authored-by: Vincent Koc <[email protected]>
…97409) * fix(sessions): bound workers retained after cross-agent deletion * fix(sessions): validate queued deletes before evicting a worker --------- Co-authored-by: Vincent Koc <[email protected]> (cherry picked from commit 3bd892f)
…97409) * fix(sessions): bound workers retained after cross-agent deletion * fix(sessions): validate queued deletes before evicting a worker --------- Co-authored-by: Vincent Koc <[email protected]> (cherry picked from commit 3bd892f) Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Fixes retained deletion-worker growth when a long-running Gateway deletes sessions across many agent databases.
Closes #197331.
User Impact
Deleting sessions across more agents now keeps at most four ordinary reclamation workers. Recently used databases keep their warm connection; revisiting an evicted database opens a new one. A failed retirement remains visible and blocks admission of another database until cleanup can succeed.
Why This Change Was Made
The archive queue already serializes ordinary reclamation, but its retained registry had no capacity limit. Bound that existing registry with LRU eviction and await the existing native close owner before admitting a replacement. Scoped canonical-validation workers keep their separate lifecycle. This adds no configuration, schema, or session-data retention change.
Evidence
1,2,3,4,4,4,4,4,4; warm reuse did not spawn, revisiting an evicted database did. Peak was four; both health checks succeeded and shutdown exited 0 with zero remaining reclamation workers.pnpm build:runtime,pnpm tsgo:core, the agents/sessions test typecheck leaf, targeted oxlint/format, the changed document's MDX check, test-line ratchet andgit diff --checkpassed on macOS arm64 / Node 26.12.1. Runtime build emitted asset-budget warnings. No package/release build, live model/channel call, or independent measurement of the reporter's per-worker memory estimate is claimed.768edfa29ef5checks the queued request and its database identity before evicting another worker. The fork CI passed all 18 tests in the reclamation reuse suite, including the case where a stale fifth request leaves four live thread IDs and the oldest database lease intact, followed by a failed close and successful retry. The final change is +19/−2 production lines and +83 test lines. Hosted worker regression.