Repository navigation
fix(acp): allow harness resets from read-only installations - #158551
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 26, 2026, 12:48 AM ET / 04:48 UTC (Revision 4). ClawSweeper reviewWhat this changesThe branch moves ACPX session storage into Gateway state, adds startup and Doctor migration for older sessions, and limits repeated harness-reset warnings. Merge readiness⛔ Blocked before merge - 5 items remain Keep this PR open: its migration still skips installations with existing ACPX adapter files, leaving older sessions invisible after the default storage location changes. Priority: P1 Review scores
Verification
How this fits togetherThe ACPX plugin connects OpenClaw agent sessions to ACP runtimes. Gateway configuration selects its storage location; startup, Doctor, and reset hooks then read or change session records there. flowchart LR
A[Gateway workspace] --> C[ACPX configuration]
B[Gateway state directory] --> C
C --> D[Startup and Doctor migration]
D --> E[ACPX session store]
F[Harness reset hooks] --> E
E --> G[Agent sessions]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +219, Tests +340, Docs +18. Total +577 across 14 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Place ACPX sessions in a writable Gateway-owned directory that cannot collide with adapter files, and use the shared startup and Doctor migration path to preserve existing records through upgrade. Do we have a high-confidence way to reproduce the issue? Yes, from source: start with v2026.9.6 sessions in workspace/state and generated files in Gateway state/acpx, then apply this branch's default. The destination check skips adoption; this read-only review did not execute that upgrade. Is this the best way to solve the issue? No. Moving storage out of a read-only installation is appropriate, but the chosen destination collides with published adapter files; a separate session directory or conflict-safe migration is needed. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ceac53a0feaf. LabelsLabel changes: No label changes. Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
Adopt the workspace state directory through the existing ACPX migration owner during startup and Doctor repair. Preserve explicit locations, warn and retain legacy state on failed adoption, and recover the one-time marker without revisiting completed migrations.
Fix the stale ControlUiRootState import exposed by merge CI after its owner moved on main. Type the fixture through the handler input without restoring an implementation re-export or changing browser behavior.
Back out the parallel fixture adjustment now that main contains da8149b. This removes the merge overlap while preserving the validated ACPX migration source tree and the requested branch history.
…#158551) * fix(acp): allow harness resets from read-only installations * test(acp): pin legacy state in Doctor migration fixture * fix(acpx): migrate legacy default session state on upgrade Adopt the workspace state directory through the existing ACPX migration owner during startup and Doctor repair. Preserve explicit locations, warn and retain legacy state on failed adoption, and recover the one-time marker without revisiting completed migrations. * test(ui): derive retained asset root from handler contract Fix the stale ControlUiRootState import exposed by merge CI after its owner moved on main. Type the fixture through the handler input without restoring an implementation re-export or changing browser behavior. * test(ui): use the root type import repair from main Back out the parallel fixture adjustment now that main contains 6fa14a2. This removes the merge overlap while preserving the validated ACPX migration source tree and the requested branch history.
What Problem This Solves
Fixes ACP harness resets failing with
EACCESfrom a read-only installation, while preserving sessions stored under the former<workspace>/statedefault during upgrades.User Impact
GitHub Copilot, Kilo Code, OpenCode, Pi, and Qwen Code reset hooks use
acpx/under the Gateway state directory, honoringOPENCLAW_STATE_DIR. Other reset-hook failures warn once per harness ID per process; subsequent resets still retry.Upgrade behavior: when no explicit
plugins.entries.acpx.config.stateDiris configured and the new default is empty, ACPX startup oropenclaw doctor --fixautomatically adopts the old state directory, including its sessions and other files. Set the existing override only to retain the old location. An occupied destination and explicit overrides are preserved. Failed adoption warns with the override to set and retains the applicable legacy path for that process. Inspection errors on an already-used destination preserve that destination.Why This Change Was Made
The existing ACPX session-owner migration module owns adoption for both Doctor and service startup, before runtime storage is opened. It uses the already-declared
fs-safemove primitive for same-filesystem rename and source-verified cross-filesystem copying and cleanup. Pending/completed markers live in existing plugin state, so completion can recover after a marker-write failure and completed adoption never revisits stale legacy files. Doctor declares both directories for update backup and reports adoption problems as recoverable warnings.No new configuration, dependency, filesystem sidecar, or runtime cache is added. The migration follow-up adds about 200 production lines for recovery, notices, backup inventory, and both entry points. The existing filesystem implementation owns the actual move.
Evidence
EACCESfailuresValidation uses
blacksmith-testbox, profileopenclaw-check. No live Gateway was changed or restarted, and no production CPU or loop-delay improvement is claimed.tbx_01m3dt8j2rjym4jybg7xemah03(run):node scripts/run-vitest.mjs extensions/acpx/src/service.test.ts --maxWorkers=1 -t 'preserves legacy sessions at startup'reproduced 5 failures and 2 passing controls on the existing PR head. The test runner took 9.85 s after dependency installation and fixture correction.tbx_01m3dtphd09tzt6gr00x6sd3nx(run): the five-file focused command passed 61 tests in 59.32 s wall. Coverage includes real filesystem moves and ACPX record reads, injectedEXDEV/I/O failures, process-local fallback, marker completion recovery, owner repair, and registered read-only reset hooks.tbx_01m3dveky88aa2cpnn7nadhbqf(run): 62 focused cases passed, including the final startup/Doctor marker-precedence and non-creating inspection assertions.node scripts/check-changed.mjs --base 7472eb3b614ef11aa6a2d939568c60ab9decd3dapassed all 25 core test typecheck groups, extension production/test typing, dead-code scans, and core lint before finding three missing-brace lint errors. After fixing those, the same native command scoped to the five changed extension files passed completely, including extension lint and the remaining architecture guards. The unchanged core-test and docs proof was retained.pnpm buildpassed in 477.78 s; the full final remote command exited 0 in 13m 40.90s. The build reported a Control UI startup-size warning (371,740 B gzip versus a 371,332 B limit); this patch changes no production UI source. All leases are stopped.The Doctor integration fixture covers both automatic adoption and an explicit old location, then loads the retained upstream session from the selected store. Restart coverage also makes stale legacy files unreadable after completed adoption; startup and Doctor must honor the marker. Empty-state Doctor detection must remain non-creating and avoid runtime/ownership inspection.
Measured single-worker file cost:
pnpm test extensions/acpx/src/service.test.ts --maxWorkers=1passed 32 cases in 36.30 s cold wall, including worker-bundle compilation; the final additional Doctor assertions also passed on rerun. The existing Doctor integration file passed all seven cases in 22.64 s wall.pnpm test extensions/acpx/doctor-contract-api.test.ts --maxWorkers=1passed all eight cases in 9.33 s wall. The existing process-backed owner-migration suite passed all 14 cases in 31.38 s runner wall.Validation recovery: fresh leases required
pnpm install --frozen-lockfile. Two sync timeouts occurred before test execution; those leases were stopped and replaced. An early cross-device staging error was fixed by reusingfs-safe; the assertion ratchet was fixed with an explicit result type.The first follow-up CI run failed in
check-test-types-core-1because main commit9ee2b0b3b6f1(#158464) movedControlUiRootStatewithout updating a retained-assets test import. Main fixed that inda8149b8ba7d; the PR uses that owning fix when merged. A concurrent test-only repair here was backed out with a normal commit to remove the overlap, leaving the final source tree identical to the Testbox-validated migration commit6bd176e248ef. The merge was checked without conflicts. GitHub CI is green onf63393b110e521a14ff8158fce57e12f1647712d, includingopenclaw/ci-gate, in 995 s workflow wall time. The PR has 144 passing checks, 48 skipped checks, and no outstanding checks; it remains open and unmerged.The type-import failure was also reproduced on isolated merge source
d3f3f2415ef8usingblacksmith-testboxleasetbx_01m3dzaaf8ezc41r5zxqbt53fr(run); the repaired UI E2E type graph passed in 10.31 s. The corresponding five-group typecheck stripe, typed lint, formatting, and whitespace checks passed. This temporary proof checkout and lease were removed.Focused command:
Cross-device and permission failures are injected at filesystem operations; the move, storage, and recovery code are real. Service tests capture the prepared runtime configuration and load records with the published ACPX store. The registered-hook regression exercises real runtime initialization. This is synthetic upgrade-state proof, not a published-updater or production Gateway campaign.