Repository navigation
fix(memory): release MCP runtimes after memory flushes - #150899
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: blocked before merge. Reviewed September 17, 2026, 9:28 AM ET / 13:28 UTC (Revision 2). ClawSweeper reviewWhat this changesPrivate memory-flush runs now request MCP tool-runtime cleanup when they finish, with regression checks for completion and interruption. Merge readiness⛔ Blocked before merge - 1 item remains The fix remains necessary on current main, and no blocking defect was found. The merged related PR addresses fixture teardown only; this protected PR supplies the production repair. Priority: P2 Review scores
Verification
How this fits togetherMemory flushing runs a private agent turn over a detached conversation snapshot to preserve useful notes. Its MCP tool runtimes belong to that temporary run, while the foreground conversation continues independently. flowchart TD
A[Conversation snapshot] --> B[Private memory flush]
B --> C[Agent run and tool runtime]
C --> D[Completion or interruption]
D --> E[Run settlement]
E --> F{Active leases remain?}
F -->|Yes| G[Defer retirement]
F -->|No| H[Dispose private runtime]
G --> H
Before merge
Agent review detailsSecurityNone. PR surfaceSource +6, Tests +56. Total +62 across 2 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep private memory runs on the existing lease-aware retirement path while preserving continuing conversation runtimes. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the path: private memory runs omit the cleanup option that settlement requires to retire their runtimes. The PR reports a failing baseline replay; this review did not execute it. Is this the best way to solve the issue? Yes, enabling the existing cleanup contract at the detached-session factory is a narrow repair, and the caller already carries that setting into execution. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against aac3b2773c7f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
* fix(memory): retire MCP runtimes after private memory flushes * refactor(memory): prepare cleanup with detached run context
Related: #150874
What Problem This Solves
Optional memory flushes retained their private MCP runtimes after completion or interruption, accumulating runtimes across background runs.
User Impact
Background memory work releases its tool runtime when it finishes. Continuing conversation sessions retain their existing MCP lifetime.
Why This Change Was Made
The existing detached-session factory now prepares the run-end cleanup setting alongside the detached context. The runner consumes it through its existing options spread, and the existing settlement owner preserves active leases and retires the original and accepted successor IDs. The regression checks retirement before fixture cleanup.
Evidence
The controlled baseline replay reproduced three retained private runtimes. The repair passes all 13 factory cases and the three ordered completed/interrupted/requester cases. Full changed checks and independent P2 review pass. The oversized caller remains unchanged from main; no cap or baseline exception is needed. Exact-head CI is pending.