Skip to content

refactor(state): consolidate sandbox read dispatch - #157687

Merged
steipete merged 1 commit into
mainfrom
hostneutral/ingress-journal-0924
Sep 25, 2026
Merged

steipete merged 1 commit into
mainfrom
hostneutral/ingress-journal-0924

Conversation

@steipete

@steipete steipete commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The shared-state read worker handles sandbox registry commands separately from its existing registry dispatcher, making that entry point harder to extend and review.

User Impact

No user-visible behavior changes. Sandbox reads retain the same worker, admission, SQL, returned data, and cleanup. Existing installs need no migration or operator action; schemas, configuration, retention, and SDK contracts are unchanged.

Why This Change Was Made

Move the four sandbox read cases into readStateRegistryCommand, alongside its existing registry operations. The existing worker immediately uses that dispatcher; no dormant handler or parallel path is introduced. This is a behavior-neutral subset of the reviewed channel ingress worker migration, preparing the reader for the later ingress slice.

Evidence

All execution uses blacksmith-testbox, lease tbx_01m3chw0p5tnnyd6yxb8mxyaa6, run 36152376896, with an isolated checkout and pnpm install --frozen-lockfile.

  • pnpm test src/agents/sandbox/registry-read.test.ts src/agents/sandbox/registry.test.ts src/state/openclaw-state-read-worker.test.ts --maxWorkers=1: passed, 59 tests / 3 files / 60.95s wall. Existing coverage exercises all four sandbox reads through the worker; no new or changed tests, assertions, sleeps, or Gateway boots.

  • pnpm db:worker-inventory:gen and pnpm db:worker-inventory:check: passed, 535 files / 2,532 calls. Generated documentation includes inventory drift already present on the base.

  • node scripts/check-changed.mjs --base 53a0b854769dd6506940c9e41a3cc18b6b91fb04: 62.18s, stopped at the existing agents-root budget (721 roots / 720 limit), before type/lint lanes. Earlier selected guards and formatting passed. The exact failing command, node --import ./scripts/tsx.mjs scripts/check-tsgo-core-boundary.mts, reproduced on a separate clean checkout of that same main SHA (0.91s, exit 1), matching the candidate (1.03s, exit 1). This slice changes no test roots or shard configuration. The owner is unchanged; no guard, baseline, or environment severity was weakened. Existing GitHub Actions policy treats this size limit as advisory.

  • pnpm tsgo:core: passed, 69.47s.

  • node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/state/openclaw-state-read-registry.ts src/state/openclaw-state-read.worker.ts: passed, 26.38s, zero warnings/errors.

  • pnpm check:madge-import-cycles: passed, 48.70s, zero cycles.

  • pnpm lint:docs: passed, 14.94s, 1,310 files and zero issues.

  • Diff-scoped deslop: clean. Fresh Codex P0–P2 review: clean, no actionable findings. Generated inventory was produced and checked by its owner, not edited by hand.

Exact-head CI run 36153599916 completed success on 2e9f783042c3e4c3b69592e6ccdfcfb1ad9cc3bd; node scripts/watch-pr-ci.mjs 157687 2e9f783042c3e4c3b69592e6ccdfcfb1ad9cc3bd --repo openclaw/openclaw --completion ci-run returned GREEN. The Testbox and its workflow are stopped. The full signed-SMS crash/replay proof runs after the final stack slice lands.

Stack

The stack lands sequentially; links are added as successors open.

  1. #157687 — consolidate sandbox read dispatch; merged as 0dca2516a7f809579468afcb2b22b528ece324b8.
  2. #158203 — separate ingress record types; merged as f7604e5f4bc854bc707dbcba05c9f5fcaecc66fe.
  3. #158233 — extract ingress record codecs; merged as 4082227bed20fbfb12e05be113898d68bfca2f23.
  4. #158288 — failed-ingress health reads in the worker; merged c8d67d6751349528820cb4710002dc994abfffb8.
  5. Remaining worker reads, then broker writes and settlement integration — pending.
  6. Channel adapter/fixture cutover and superseded-path deletion — pending.
  7. Final documentation and signed-SMS crash/replay proof on merged main — pending.

Size: production +36/−39 (net −3); tests +0/−0 (net 0); generated inventory docs +80/−72 (net +8). This PR replaces the former combined ingress proposal; its complete reviewed candidate remains preserved locally for the remaining slices.

Stack closeout: all 18 slices are merged.

#157687 → #158203 → #158233 → #158288 → #158412 → #158477 → #158628 → #158637 → #158860 → #158887 → #158896 → #158928 → #158933 → #158980 → #158987 → #159006 → #159008 → #159073

Final merged-main signed-SMS SIGKILL/replay proof passed on f0b78f55d6d5acfb052a4512d97088b408a0c28d.

@clawsweeper

clawsweeper Bot commented Sep 24, 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 channel: line Channel integration: line channel: msteams Channel integration: msteams channel: telegram Channel integration: telegram channel: zalo Channel integration: zalo channel: zalouser Channel integration: zalouser gateway Gateway runtime scripts Repository scripts commands Command implementations channel: twitch Channel integration: twitch plugin: file-transfer size: XL labels Sep 24, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 25, 2026, 11:41 AM ET / 15:41 UTC (Revision 19).

ClawSweeper review

What this changes

Moves four sandbox container and browser registry reads into the shared-state worker’s existing registry dispatcher and refreshes the generated database-worker inventory.

Merge readiness

✅ Ready for maintainer review

Keep open. Current main still handles these reads inline, and the pinned merge retains this cleanup. No actionable defect was found in the introduced patch.

Priority: P3
Reviewed head: 2e9f783042c3e4c3b69592e6ccdfcfb1ad9cc3bd

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The narrow patch preserves the observed worker boundary and has relevant reported validation, with no actionable finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored internal refactor is exempt from the external-contributor proof gate. The reported Testbox run exercises sandbox APIs and a CLI fixture through the production worker against SQLite; those tests were not rerun here. 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 maintainer-authored internal refactor is exempt from the external-contributor proof gate. The reported Testbox run exercises sandbox APIs and a CLI fixture through the production worker against SQLite; those tests were not rerun here. No stored-data contract changes.
Evidence reviewed 6 items Introduced source change: The pinned PR moves the four existing sandbox query calls into the registry dispatcher without changing their arguments or result fields.
Read admission boundary: The worker opens the read-only state scope and marks the source admitted before reaching the registry dispatcher.
Caller and behavior coverage: The sandbox read APIs still submit the same commands. Existing tests exercise all four results through the worker, an actual CLI listing, absent records, snapshots, and source cleanup.
Findings None None.
Security None None.

How this fits together

Sandbox management stores container and browser records in OpenClaw’s shared state database. Sandbox APIs send read commands to a read-only worker, which returns registry results to CLI and runtime callers.

flowchart LR
  A[Sandbox and CLI callers] --> B[Sandbox read APIs]
  B --> C[Shared state read worker]
  C --> D[Admitted SQLite read]
  D --> E[Registry dispatcher]
  E --> F[Registry replies]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -3, Docs +8. Total +5 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 36 39 -3
Tests 0 0 0 0
Docs 1 80 72 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 116 111 +5

Review metrics

None.

Technical review

Best possible solution:

Keep these reads in the existing admitted worker dispatcher and review later ingress changes as separate slices.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this is code consolidation rather than a reported failure. The old and proposed dispatch paths are directly identifiable in source.

Is this the best way to solve the issue?

Yes: the change reuses the admitted database handle and existing sandbox queries without adding a new owner, API, or migration.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 3241d9473856.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is a bounded internal cleanup with no claimed user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool 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 maintainer-authored internal refactor is exempt from the external-contributor proof gate. The reported Testbox run exercises sandbox APIs and a CLI fixture through the production worker against SQLite; those tests were not rerun here. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 06cbb34 adds src/state/openclaw-state-read-registry.ts:10 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 06cbb349bae4; files: src/state/openclaw-state-read-registry.ts)
  • Jason (Json): 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.

History

Review history (18 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-25T10:55:35.940Z sha 0df6b397700e146a3fd9dc437492f9a1622c166a :: blocked before merge. :: none
  • reviewed 2026-09-25T11:39:15.631Z sha 96e6a1b :: blocked before merge. :: none
  • reviewed 2026-09-25T12:19:56.725Z sha 96e6a1b :: blocked before merge. :: none
  • reviewed 2026-09-25T12:56:15.460Z sha 63ac3e9 :: blocked before merge. :: none
  • reviewed 2026-09-25T13:15:23.100Z sha 63ac3e9 :: blocked before merge. :: none
  • reviewed 2026-09-25T13:43:54.923Z sha 1654696 :: blocked before merge. :: none
  • reviewed 2026-09-25T14:21:08.493Z sha 1654696 :: blocked before merge. :: none
  • reviewed 2026-09-25T15:29:28.639Z sha 2e9f783 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the hostneutral/ingress-journal-0924 branch from e90cb77 to c9244ce Compare September 25, 2026 01:26
@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord channel: imessage Channel integration: imessage channel: signal Channel integration: signal channel: whatsapp-web Channel integration: whatsapp-web channel: feishu Channel integration: feishu labels Sep 25, 2026
@steipete
steipete force-pushed the hostneutral/ingress-journal-0924 branch from c9244ce to 94bcd27 Compare September 25, 2026 02:31
@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 25, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed channel: feishu Channel integration: feishu channel: twitch Channel integration: twitch plugin: file-transfer size: XL labels Sep 25, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Sep 25, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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