Repository navigation
refactor(agents): persist progress cards through the agent writer - #164458
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. Reviewed October 3, 2026, 5:35 PM ET / 21:35 UTC (Revision 5). ClawSweeper reviewWhat this changesThe PR moves durable session progress-card updates and clears into the existing agent database writer while preserving revisions, authorization, and saved-card behavior. Merge readiness✅ Ready for maintainer review This remains useful work: current main still performs durable progress-card writes on the Gateway thread. No actionable patch defect remains, and the latest evidence addresses the previous review’s comparison request. Priority: P2 Review scores
Verification
How this fits togetherProgress cards store an agent’s plan and status for a conversation. Gateway requests persist replacements or clears, then notify clients to refresh the saved card. flowchart TD
A[Agent tool or client request] --> B[Gateway authorization]
B --> C[Capture session and physical store]
C --> D[Existing agent writer queue]
D --> E[Worker transaction and live authority checks]
E --> F[Saved progress card]
F --> G[Acknowledged result and client notification]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +231, Tests +340, Docs +10, Other +1. Total +582 across 10 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one progress-card row kernel and route durable mutations through the canonical agent writer, preserving live authorization and acknowledged publication. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main’s Promise facade still executes the durable row transaction on the caller thread. The captured evidence reports a failing original boundary regression; this read-only review did not execute it. Is this the best way to solve the issue? Yes. The patch reuses the existing writer, authority, discovery, and shutdown owners while preserving the shared row kernel and existing caller contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 11515ce5b3da. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
Keep the progress-card worker test in the canonical sorted Gateway inventory so CLI ownership and CI planning retain identical test ordering. Focused proof: 547 tests passed; P2 autoreview found no actionable findings.
|
@clawsweeper re-review The Gateway test inventory ordering failure is corrected in 9cb6855. Both affected suites passed (547 tests, 371.78 seconds wall), and P2 autoreview is clean. The full changed-file gate and released SDK API comparison are being completed before landing. |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…enclaw#164458) * refactor(agents): persist progress cards through the agent writer * refactor(gateway): keep the board database resolver private * test(gateway): simplify progress card fixtures * fix(test): preserve sorted progress card worker inventory Keep the progress-card worker test in the canonical sorted Gateway inventory so CLI ownership and CI planning retain identical test ordering. Focused proof: 547 tests passed; P2 autoreview found no actionable findings.
What Problem This Solves
Durable progress-card updates and clears returned Promises but still executed their SQLite transaction on the Gateway thread. This moves the five surveyed put/clear SQL sites off that thread for durable sessions.
Why This Change Was Made
Bind a typed progress-card adapter to the existing canonical agent writer. Capture the physical store and input before waiting, reserve exact-store FIFO before discovery, and reread the authoritative revision inside one synchronous worker transaction. Keep live host authorization at transaction and commit, preserve the original authorization error on refusal, and broadcast only acknowledged results. Unknown outcomes never replay or fall back to host SQLite.
All durable put/clear callers use the existing Promise facade. The obsolete cross-store resolver export is removed; its remaining implementation stays private to the board store. Incognito and atomic reset retain the shared synchronous row kernel under their existing ownership; durable reads already use the history worker. The existing Gateway request-entry fence and connection-work drain settle accepted persistence before worker teardown; no additional worker service or persistence queue is introduced.
User Impact
Internal execution change only. Replace-on-write, monotonic revisions, tombstones, conditional clearing, authorization, schema, retention, durability, and update behavior remain unchanged. No new
OPENCLAW_*names or Plugin SDK surface changes.Mandatory merge gates completed: the full changed-file checker and released Plugin SDK API comparison both passed on
9cb6855b72e75ab34f02e98be2b431750d5ae4fethrough Testbox. The requested PR/base comparisons are also complete; native landing uses the explicitly authorized inherited-CI admission below.Production LOC: +266 / −35 / net +231 (301 changed lines; tests, docs, and tooling excluded). Inventory T1 1,233 → 1,233: the counted expressions remain reachable through incognito/reset, while the durable boundary now observes zero caller-thread SQL.
Existing other-owner authorization reads remain outside this storage migration: the native session-sharing fallback at
src/gateway/session-sharing.ts:531callssrc/gateway/session-sharing-policy.ts:101. No new SQL was added to grant callbacks, and the boundary assertion covers the moved operations.Evidence
pnpm test src/gateway/progress-card-store.worker.test.ts --maxWorkers=1: 6 passed, 142.72 s wall, 18.06 s test time; most wall time was compiled fixture preparation on the shared host.pnpm test src/gateway/progress-card-store.worker.test.ts src/gateway/server-close.progress-card.test.ts --maxWorkers=1: 7 passed, 153.07 s wall on the shared host; per-file test time 11.40 s / 27.13 s. These tests require the real worker transport and real shutdown ordering.4ab382220e2cca1deedb2c2549982f91c0fb5c64.git diff --checkpassed.node scripts/check-changed.mjs --base 4ab382220e2cca1deedb2c2549982f91c0fb5c64attempt: all completed ratchets, core/test/script typechecks, and all three dead-export scans passed (zero unused exports). Core typed lint produced no diagnostic or result for more than ten minutes on the shared host. Its exact task-owned process was interrupted and joined; the checker ended with exit 130 after 2451.39 s wall, with 666.60 s spent at core lint. Later lint/guards did not run. The earlier readonly-assignment and unused-export findings were fixed and revalidated before this attempt. No full-gate retry loop was started after this tooling stall. The supported targeted core lint command for all seven changed source/test files passed in 47.16 s wall after correcting two fixture-only lint findings (redundant spread and an unbound method). Targeted tooling lint also could not start:plugin-sdk boundary dts timed out after 300000msin artifact preparation (327.94 s wall). This local tooling limitation is superseded by the final-head Testbox pass below.v2026.9.8has no synchronous progress-card put/clear SDK export to retain. The frozen-commit API comparison against that release installed both revisions, then failed during API rendering withManaged command exited while its process group remained active(277.38 s wall); no report was produced. The released API comparison subsequently completed successfully on the final head; see below. No blind retry was made.The supported Gateway
qaRuntimebuild passed (205.02 s wall), including runtime postbuild and CLI import checks. A broader full declaration build was stopped after 659.89 s in package declaration generation; the Gateway profile is the same build used by the requested worktree setup. The final source also removes a redundant assignment to the storage helper’s already-pinned read-only environment, as required by typechecking.CI seconds are not available before the initial push.
Related implementation precedents: #164240, #164112, #164291, #164288. Current overlap discovery found no competing store migration. #164296 is adjacent tool-authority work; tool scope is unchanged. #162433 is the previously identified umbrella design draft, not an active owner of this cutover. Discovery was bounded; its stale archive was followed by current GitHub reads.
Landing validation
The initial CI run exposed an out-of-order entry in the canonical Gateway worker-test inventory. Commit 9cb6855 restores sorted order;
node scripts/run-vitest.mjs test/vitest-cli-ownership.test.ts test/scripts/ci-node-test-plan.test.ts --maxWorkers=1passed all 547 tests in 371.78 seconds wall. P2 autoreview of the correction is scoped-clean. Production behavior is unchanged by the correction.Released SDK reachability was checked against v2026.9.8: the Gateway put facade already returns a Promise, the synchronous row-kernel signature is retained, and the removed
resolveGatewaySessionDatabaseexport is internal with no releasedsrc/plugin-sdk,api.runtime, or documented SDK route. The unchangedprojectProgressCardChannelUpdateSDK export is independent of persistence. No compatibility shim is required. The complete released API report and full changed-file check both passed on the final head in Testbox; see the results below.The initial
doctor-health.nocow.test.tsfailure is independently present on main at f79dac8 (main job). The same test and stack fail when Doctor closes agent handles outside its maintenance scope and lease release is refused. The test, Doctor maintenance owner, and agent lease/lifecycle sources are unchanged by this PR. The only touched registry dependency adds the unused progress-card entry; this failing path does not execute progress-card persistence. Final-head CI contains this inherited Doctor failure plus the independently reproduced main lease-worker count failure described below.Final-head required gates and CI attribution
On
9cb6855b72e75ab34f02e98be2b431750d5ae4fe, Testbox run 37149741739 completed both required commands with exit 0 and a settled native wrapper receipt:v2026.9.8(fc23bc864e4553c2d215e479eeec47b67a0bf943): 233 seconds. The report includes accumulated release-to-main differences, but no changed or removed released signature attributable to this PR. Native report digest:d16bf32e4f1a5b42c98fa77d3f3efd56cc00d981b1009030043ce817303ebce4.node scripts/check-changed.mjs --base 4ab382220e2cca1deedb2c2549982f91c0fb5c64: 1,678 seconds, including all 27 core test-type partitions, production/script types, dead-export scans, all core/script lint, and policy guards. Existing max-lines warnings in untouched files were non-fatal; no errors.Final-head CI run 37146455814 has 57 successful jobs, 21 skipped jobs, two failed test jobs, and their downstream aggregate. Both inventory checks pass. All six durable-worker cases pass (4.164 seconds of reported case time), and the real CLOSE-PRELUDE shutdown regression passes in 11.230 seconds in job 111271486647.
The second failure is the unchanged
openclaw-state-lease-acquisition.test.tsretained-generation case: its global worker census starts at one and ends at zero. Scheduled main job 111283445990, maincd9913f1b1105f9c4e7b96fde8c1431a77e5878d, independently reproduces the exact assertion at line 122. The test and primary lease/tracking/heartbeat inputs are unchanged. The intervening cleanup only replaces the equivalent 10-second timeout helper; both failures occur during normal completion in less than a second. This establishes inherited failure attribution without claiming the identity of the exiting worker was directly instrumented.Both remaining CI failures are independently present on main and eligible for the operator-authorized native admin exception. CI remains failed; these results are not described as green. Five local full-file lease runs passed on the PR head (18/18 tests each), which does not establish a fix. The requested Linux PR/base comparison is complete on isolated Hetzner Linux, with exact clean checkouts and separate frozen dependency installs. Every invocation used
node scripts/run-vitest.mjs <file> --maxWorkers=1.9cb6855b72e754ab382220e2csrc/state/openclaw-state-lease-acquisition.test.tssrc/flows/doctor-health.nocow.test.tsAll ten Doctor logs match the expected case and offline-maintenance error. The isolated lease passes are not a fix claim: the independent scheduled-main CI reproduction establishes that the remaining lease census failure is inherited. No CI job was rerun.