Skip to content

fix(acp): keep session listings off the Gateway thread - #158782

Merged
steipete merged 3 commits into
mainfrom
codex/acp-list-worker-20260926
Sep 26, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/acp-list-worker-20260926

Conversation

@steipete

@steipete steipete commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

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: false is 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.

@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: L labels Sep 26, 2026
@steipete
steipete marked this pull request as ready for review September 26, 2026 09:19
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 26, 2026, 5:26 AM ET / 09:26 UTC.

ClawSweeper review

What this changes

The 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
Reviewed head: df061f393c41e5a490c70637586283115e34a60a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch uses established worker owners and adds focused real-SQLite regression coverage, with no confirmed blocking finding.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The member-authored PR is exempt from the external-contributor proof gate. Its body reports a before-and-after cold SQLite observation, and its real-SQLite tests exercise the changed listing path; this review did not execute them. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The member-authored PR is exempt from the external-contributor proof gate. Its body reports a before-and-after cold SQLite observation, and its real-SQLite tests exercise the changed listing path; this review did not execute them. No stored-data contract changes.
Evidence reviewed 6 items Current main behavior: Current main calls the synchronous ACP row selector inside the listing function before joining session entries.
Introduced worker path: The branch requests the ACP scan from the shared-state read worker and joins each result through the canonical session entry reader.
Worker implementation: The new read command selects ordered ACP rows inside the shared-state worker.
Findings None None.
Security None None.

How this fits together

ACP 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +48, Tests +134, Docs +8. Total +190 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 7 133 85 +48
Tests 3 221 87 +134
Docs 1 8 0 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 362 172 +190

Review metrics

Metric Value Why it matters
Production and test growth production +48 net lines; tests and test routing +134 net lines The new worker adapter accounts for the production growth, while the tests exercise the real SQLite thread boundary.

Technical review

Best 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.

Labels

Label changes:

  • add P2: Cold ACP listings can delay other Gateway work, but the reported impact is limited to this listing path.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The member-authored PR is exempt from the external-contributor proof gate. Its body reports a before-and-after cold SQLite observation, and its real-SQLite tests exercise the changed listing path; this review did not execute them. No stored-data contract changes.

Label justifications:

  • P2: Cold ACP listings can delay other Gateway work, but the reported impact is limited to this listing path.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The member-authored PR is exempt from the external-contributor proof gate. Its body reports a before-and-after cold SQLite observation, and its real-SQLite tests exercise the changed listing path; this review did not execute them. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Josh Lehman: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 8301f00 into main Sep 26, 2026
232 checks passed
@steipete
steipete deleted the codex/acp-list-worker-20260926 branch September 26, 2026 09:52
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant