Repository navigation
fix(acp): keep session listings off the Gateway thread - #158782
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 September 26, 2026, 5:26 AM ET / 09:26 UTC. ClawSweeper reviewWhat this changesThe branch moves ACP session metadata scans and file-backed session entry reads to existing SQLite workers, and adds regression tests and worker-access documentation. Merge readiness✅ Ready for maintainer review Keep open. Current main still performs the synchronous ACP listing read, and this member-authored PR remains a distinct, reviewable fix with no confirmed blocking defect. Priority: P2 Review scores
Verification
How this fits togetherACP session metadata lives in OpenClaw's shared SQLite state, while session entries live in agent stores. Listing joins them for task maintenance and parent-session cleanup. flowchart LR
A[ACP list request] --> B[Runtime config snapshot]
B --> C[Shared-state read worker]
C --> D[Ordered metadata rows]
D --> E[Agent session reader]
E --> F[Lifecycle match]
F --> G[Entries for cleanup]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +48, Tests +134, Docs +8. Total +190 across 11 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the shared-state scan and canonical session-reader join, preserving lifecycle and missing-store behavior; handle process-held incognito stores under their separate owner migration. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source calls a synchronous row scan from the listing path, and the branch includes a cold SQLite test that observes main-thread SQL; this read-only review did not run it. Is this the best way to solve the issue? Yes. The patch uses the existing shared-state and canonical session readers without adding another store owner or a migration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 75733458a9b7. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* fix(acp): move file-backed session listings off the Gateway thread * refactor(acp): keep the native join helper private * refactor(acp): keep session entry types with their store owner
What Problem This Solves
ACP session listing returned a Promise but still scanned SQLite and loaded each session entry on the Gateway thread, delaying other work during cold reads.
User Impact
File-backed ACP listings now run their database reads in workers while preserving ordering, lifecycle filtering, missing-store behavior, and complete session metadata. Returned entries are detached values, including when
clone: falseis supplied. Process-held incognito stores retain their existing native owner and remain separate migration work. No schema, retention, public API, or update migration changes are required.Why This Change Was Made
The shared-state reader now owns the ACP row scan. Each join uses the existing canonical session reader, which already owns physical store selection, snapshot continuations, and cleanup. Cold runtime configuration uses its asynchronous reader. Task maintenance already awaits listing, so it needs no separate routing or lifecycle implementation.
Evidence
The real cold SQLite regression failed before the change with 26 main-thread statement preparations and passes after it with no observed main-thread SQL. ACP metadata, aliases, missing stores, detached nested metadata, subsequent metadata updates, environment routing, and task-maintenance authority are covered by focused tests. The final host-broker test also loads persisted runtime config through the ordinary no-config-argument entry point and observes zero main-thread SQL. All 46 focused cases passed across the ACP and task-maintenance suites; the five real-SQLite listing cases took 6.1 seconds of test time. Independent review found no actionable P0–P2 findings. Production and core-test typechecks passed. All three export scans and focused changed-file lint passed. CI caught a type-only import cycle after the module split; the entry type now lives with its existing store-binding owner, and Madge reports zero cycles. The full local gate reached an unrelated sidebar line-cap failure inherited from the base revision, fixed separately in #158778 at
483158831b83b4ab0794627360258cbff46c6adf. Exact-head CI remains the merge gate.