Repository navigation
refactor(acpx): complete lease ownership and remove legacy reaper heuristics - #121016
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
8e8f630 to
a0d7719
Compare
a0d7719 to
1722626
Compare
|
Codex review: found issues before merge. Reviewed August 9, 2026, 5:50 AM ET / 09:50 UTC. ClawSweeper reviewWhat this changesThe PR records ACPX generated-wrapper probe leases before launch and recovers pending processes only when wrapper, lease, and Gateway identities exactly match. Merge readinessKeep open: this PR’s retained probe leases can exhaust the capped lease store and evict an older live session lease, losing process-cleanup ownership. The exact-match recovery design is otherwise well placed, but the bounded-state regression needs repair before merge. Priority: P2 Review scores
Verification
How this fits togetherACPX launches ACP sessions and generated wrapper processes from OpenClaw. Its lease store carries ownership into startup recovery so cleanup can terminate only processes belonging to the current Gateway. flowchart LR
A[Probe or ACP session] --> B[Persist process lease]
B --> C[Launch generated wrapper]
C --> D[Record process identity]
D --> E[Startup recovery]
E --> F[Validate exact ownership]
F --> G[Terminate owned process]
B --> H[Bounded lease store]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +156, Tests +417, Docs -122. Total +451 across 8 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Represent unresolved probe ownership as bounded uncertainty per wrapper and Gateway, preserving real session leases, and add a capacity regression test before merge. Do we have a high-confidence way to reproduce the issue? Yes from source: complete or fail more than 4,096 probe launches while retaining their pending leases, then observe oldest-entry eviction remove an earlier live lease. Is this the best way to solve the issue? No: producer-side lease persistence and exact recovery are appropriate, but durable per-probe UUID leases violate the bounded-store invariant; bounded aggregation is safer. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 135278c8968f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…ristics (openclaw#121016) * refactor(acpx): harden pending process leases * fix(acpx): bound retained probe leases
Related: #120937
What Problem This Solves
ACPX startup cleanup could not safely resolve generated-wrapper launches whose lease was persisted before spawn but whose PID was never recorded. Generated availability and doctor probes also entered upstream launch code without first persisting an OpenClaw ownership lease. That left cleanup dependent on aggregate command-marker scanning and made a specific pending lease vulnerable to being retired from evidence that did not identify that lease.
Why This Change Was Made
Generated-wrapper probes now use the same lease-first launch scope as sessions: OpenClaw persists an open
rootPid: 0lease before entering upstream code, then promotes it when the session-store callback records a PID. Startup recovery matches a pending lease only when the live process command contains the exact wrapper path, lease id, and Gateway instance id; ambiguous, unavailable, foreign-instance, and Windows evidence fails closed. Aggregate marker cleanup is kept separate from individual lease state transitions, and lease-aware wrapper roots are excluded from that fallback.This is an intentional partial completion of the work order. The PR title reflects the requested end state, but deleting the legacy marker heuristics is blocked by the order's escape hatch:
rootPid: 0crash windows: confirmed gap, fixed for generated wrappers. An uncertain launch leaves an open lease; recovery signals only one exact same-instance wrapper match.acpxowns command resolution and process creation without pre-spawn identity injection or a post-spawn PID callback.The
@zed-industries/codex-acp-*and/acpx/dist/marker matching therefore remains narrowly enabled for unleased direct-agent processes and reparented descendants after an uncertain spawn. It cannot retire any specific lease. Removing it now would reduce orphan coverage and violate the safety invariant.The version 1 lease shape is unchanged from the latest shipped tag checked for this work,
v2026.7.2-beta.7; no plugin doctor migration is required. Legacy session records without a lease id retain their existing fail-closed cleanup path.User Impact
Operators get safer ACPX restart cleanup for generated wrapper probes and pending launches: OpenClaw can recover an exact same-Gateway orphan without risking another Gateway instance's process. There is no new configuration or user-visible command change. Direct-agent, reparented-descendant, and Windows cleanup remain conservative until upstream ownership hooks and stable tree identity exist.
Evidence
node scripts/run-vitest.mjs extensions/acpx— 19 files, 256 tests passed on final head.node scripts/check-changed.mjs— passed before the final base refresh on Blacksmith Testboxtbx_01kzjwahypjvw1g4gsh1jf7v7g; run31305084480.node scripts/check-docs-mdx.mjs docs/refactor/acp.md— passed.node scripts/check-docs-i18n-glossary.mjs— passed.node scripts/docs-link-audit.mjs— 6,411 internal links checked, 0 broken.git diff --check origin/main...HEAD— passed on final head.31305893627failedcheck-plugin-sdk-api-baseline. The samegenerate-plugin-sdk-api-baseline.ts --checkcommand fails with the identical manifest mismatch on a clean archive of currentorigin/main(7d4066639ef008c122c8243ce08d834227a494f3), so the work order's one unrelated-failure rerun was exhausted and no out-of-scope Plugin SDK/generated-baseline change was added here.+190/-34(net+156); tests+431/-14(net+417); docs+118/-240(net-122). The production growth establishes the missing ownership boundary and exact live-evidence recovery while retaining the upstream-blocked safety fallback.