Skip to content

refactor(channels): read failed ingress health in worker - #158288

Merged
steipete merged 2 commits into
mainfrom
hostneutral/ingress-slice04-health-0925
Sep 25, 2026
Merged

steipete merged 2 commits into
mainfrom
hostneutral/ingress-slice04-health-0925

Conversation

@steipete

@steipete steipete commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Gateway and Doctor failed-ingress health checks query SQLite on their calling thread, and a health read creates an otherwise absent state store.

User Impact

Failed-event counts and recovery guidance stay the same. Health reads use the existing read-only worker and leave absent state uncreated. Existing installations require no configuration change, migration, schema bump, or operator action; event bytes, ordering, dedupe, retention, and recovery remain unchanged.

Why This Change Was Made

Move only the failed-event health query into the existing shared-state reader and await it at the Doctor caller. The worker command captures only its no-input discriminant before admission, excluding caller context from the request. The old calling-thread query is removed. The production copied-wrapper manifest includes the new runtime dependency. The pressure query remains a separate, explicitly inventoried migration step.

This is a live subset of the reviewed ingress-worker design. The maintainer approved the storage execution cutover; it changes no persistent contract or public plugin SDK surface. The generated inventory also incorporates drift already present in the captured main source.

Evidence

Latest proof uses blacksmith-testbox, lease tbx_01m3d1kvx3pd60h9ahasffqpry, run 36181618515. It uses an isolated checkout on f13c49ca20354e5c4e7f5fb1a7ae4210debd2238, verified source hashes, and pnpm install --frozen-lockfile. The rebase preserves the prior slice patch exactly by range-diff.

  • pnpm test over the six affected ingress/health/read-transport files with --maxWorkers=1: 52 tests passed, 27.76s wall.
  • The original hosted job's unchanged two-group payload, replayed through node --import tsx scripts/ci-run-node-test-shard.mts: 3,882 tests passed, 438.22s. pnpm test test/scripts/eager-import-closure.test.ts --maxWorkers=1: 15 tests passed, 15.89s.
  • node scripts/check-changed.mjs --base f13c49ca20354e5c4e7f5fb1a7ae4210debd2238: passed in 1,725.45s, including all 25 test typecheck partitions, dead-export scans, lint, and zero import cycles.
  • pnpm db:worker-inventory:gen and pnpm db:worker-inventory:check passed: 538 files / 2,535 calls. Cross-shard references confirm all failed-health callers handle the async result.
  • Deslop is clean. Codex P0–P2 review caught caller-context capture in the first pass; the correction is clean in round 2. The manifest correction also has a clean final Codex review after supplying the complete copied-source and tsconfig context.
  • pnpm lint:docs passed (1,311 files, 14.15s). The repository commit hook passed, and all 20 source hashes matched before/after commit 3e3cd2c2e683f2b82ea7b4b040512fb630a273ee; Peter Steinberger is author and committer. Exact-head CI run 36186040138 completed success on that SHA; node scripts/watch-pr-ci.mjs 158288 3e3cd2c2e683f2b82ea7b4b040512fb630a273ee --repo openclaw/openclaw --completion ci-run returned GREEN. Both Testbox leases and workflows are stopped.

The previous hosted run, 36179658447 on a6849ee8f6263e7c690b59cfeae1691b28f94bec, failed eight native PR bootstrap cases because the copied-wrapper manifest omitted the new ingress contract. The CI gate cancelled the remaining matrix. A Testbox control reproduced the exact missing-module error in 5.06s; adding one manifest entry repairs it without changing tests, assertions, guards, or dependencies.

Earlier negative controls and individual test costs use blacksmith-testbox lease tbx_01m3cwttj8hva5t0s2fk7e8y22, run 36172945166. The original health path fails the absent-store and caller-thread SQL regressions. Pre-correction transport fails with DataCloneError and passes after exact command capture. The corrected pre-rebase candidate also passed full changed checks in 1,506.09s.

Measured file costs with pnpm test <file> --maxWorkers=1:

File Wall seconds
src/channels/message/ingress-queue-health.test.ts 7.33
src/channels/message/ingress-queue.dead-letters.test.ts 8.64
src/commands/doctor-channel-ingress.test.ts 8.70
src/gateway/health/collector.queue-health.test.ts 12.24
src/gateway/health/delivery-queue.test.ts 8.45
src/state/openclaw-state-read-worker.test.ts 19.72, including compiler preparation

Full signed-SMS crash/replay proof is reserved for merged main after the final stack slice; this read-only slice makes no crash-recovery claim.

Stack

Slices land sequentially; links are added as successors open.

  1. #157687 — consolidate sandbox read dispatch; merged 0dca2516a7f809579468afcb2b22b528ece324b8.
  2. #158203 — separate ingress record types; merged f7604e5f4bc854bc707dbcba05c9f5fcaecc66fe.
  3. #158233 — extract ingress record codecs; merged 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 cleanup and superseded-path deletion — pending.
  7. Final documentation and signed-SMS crash/replay proof on merged main — pending.

Production +128/−25 (net +103); tests +106/−63 (net +43); docs +22/−19 (net +3); tooling +2/−0 (net +2). The production growth pays for the live worker contract and dispatch boundary, shared by later read migrations. The maintainer accepted honest production growth for this task.

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 25, 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 gateway Gateway runtime scripts Repository scripts commands Command implementations size: M labels Sep 25, 2026
@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 25, 2026, 4:56 PM ET / 20:56 UTC (Revision 3).

ClawSweeper review

What this changes

Routes failed channel-ingress health counts through the shared SQLite read worker and updates Doctor, tests, the worker inventory, and the copied-wrapper manifest.

Merge readiness

⛔ Blocked before merge - 2 items remain

Current main and the latest release still use the synchronous failed-ingress health query, so this PR remains useful. The earlier copied-wrapper blocker is fixed and exact-head CI passed. A published-updater-to-candidate check of Doctor with existing state remains required by repository policy.

Priority: P3
Reviewed head: 3e3cd2c2e683f2b82ea7b4b040512fb630a273ee

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has focused production-path coverage and a passing exact-head run; the Doctor update proof remains the merge gate.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The supplied Testbox report describes before/after checks through the real ingress queue, SQLite read worker, and Doctor health entrypoint, observing absent state left uncreated and failed-event guidance retained; source tests cover those paths. The separate published-updater upgrade cell is absent. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The supplied Testbox report describes before/after checks through the real ingress queue, SQLite read worker, and Doctor health entrypoint, observing absent state left uncreated and failed-event guidance retained; source tests cover those paths. The separate published-updater upgrade cell is absent. No stored-data contract changes.
Evidence reviewed 8 items Current main retains the old path: The fetched main revision still opens the ingress database and runs the failed-event SQL on the calling thread.
Latest release retains the old path: The latest identified release, v2026.9.6, also contains the synchronous failed-event query.
Introduced worker route: The PR entrypoint calls the existing-state read owner; the worker dispatches the command to a read-only SQLite query using the same failed-event grouping and ordering.
Findings None None.
Security None None.

How this fits together

Channel ingress stores incoming channel events in shared SQLite state. Gateway health and Doctor read failed-event counts from that state to show health information and recovery guidance.

flowchart LR
A[Incoming channel events] --> B[Shared SQLite state]
B --> C{State exists?}
C -- No --> D[Empty health counts]
C -- Yes --> E[Read-only worker]
E --> F[Failed-event counts]
F --> G[Gateway health and Doctor]
Loading

Before merge

  • Resolve merge risk (P1) - Doctor's failed-ingress check now awaits a worker read during update inspection, but the supplied proof does not exercise an installed published updater against existing state with the candidate code.
  • Complete next step (P2) - Show a published-updater-to-candidate Doctor run with existing state before merge.
Agent review details

Security

None.

PR surface

Source +103, Tests +43, Docs +3, Other +2. Total +151 across 20 files.

View PR surface stats
Area Files Added Removed Net
Source 11 128 25 +103
Tests 6 106 63 +43
Docs 1 22 19 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 2 2 0 +2
Total 20 258 107 +151

Review metrics

Metric Value Why it matters
Production and test growth production net +103 lines; tests net +43 lines The PR attributes production growth to the shared worker contract and dispatch boundary for the staged migration.

Merge-risk options

Maintainer options:

  1. Verify the installed update path (recommended)
    Run a published updater against existing state with the candidate code and show that Doctor completes and retains failed-ingress guidance.

Technical review

Best possible solution:

Keep the shared read worker as the failed-health read owner and verify that Doctor preserves its guidance when an existing installation updates.

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

Yes from source: current main opens the state database and queries failed ingress on the calling thread. The PR reports baseline negative controls; this read-only review did not execute them.

Is this the best way to solve the issue?

Yes for the read cutover: it reuses the existing worker and preserves the aggregate query, while callers await the result. Published-update behavior still needs the repository-required proof.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 979a8beefb34.

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: The Doctor read path changes during update inspection, and compatibility with existing state under a published updater has not been shown.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied Testbox report describes before/after checks through the real ingress queue, SQLite read worker, and Doctor health entrypoint, observing absent state left uncreated and failed-event guidance retained; source tests cover those paths. The separate published-updater upgrade cell is absent. No stored-data contract changes.
  • 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. Sufficient (terminal): The supplied Testbox report describes before/after checks through the real ingress queue, SQLite read worker, and Doctor health entrypoint, observing absent state left uncreated and failed-event guidance retained; source tests cover those paths. The separate published-updater upgrade cell is absent. No stored-data contract changes.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 automation: Current PR review merge-risk labels are merge-risk: 🚨 compatibility.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P3: This is an internal health-read refactor with no intended user-visible behavior change.
  • merge-risk: 🚨 compatibility: The Doctor read path changes during update inspection, and compatibility with existing state under a published updater has not been shown.
  • 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. Sufficient (terminal): The supplied Testbox report describes before/after checks through the real ingress queue, SQLite read worker, and Doctor health entrypoint, observing absent state left uncreated and failed-event guidance retained; source tests cover those paths. The separate published-updater upgrade cell is absent. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied Testbox report describes before/after checks through the real ingress queue, SQLite read worker, and Doctor health entrypoint, observing absent state left uncreated and failed-event guidance retained; source tests cover those paths. The separate published-updater upgrade cell is absent. 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)
  • Josh Avant: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add the required published-updater-to-candidate Doctor result using preexisting state.

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 (2 earlier review cycles)
  • reviewed 2026-09-25T19:31:59.210Z sha a6849ee :: needs maintainer review before merge. :: none
  • reviewed 2026-09-25T20:09:07.186Z sha a6849ee :: blocked before merge. :: [P2] Add the ingress contract to the copied-wrapper source manifest

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 25, 2026
@steipete
steipete force-pushed the hostneutral/ingress-slice04-health-0925 branch from a6849ee to 3e3cd2c Compare September 25, 2026 20:29
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 25, 2026
@steipete
steipete merged commit c8d67d6 into main Sep 25, 2026
255 checks passed
@steipete
steipete deleted the hostneutral/ingress-slice04-health-0925 branch September 25, 2026 21:10
@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 26, 2026
…8288)

* refactor(channels): read failed ingress health in worker

* fix(tooling): include ingress reader in wrapper sources
steipete added a commit that referenced this pull request Sep 26, 2026
## What Problem This Solves

Telegram webhook tests observe handler entry before durable queue settlement and remove database fixtures before asynchronous cleanup finishes.

## User Impact

No user-visible behavior changes. This test preparation needs no migration, configuration change, or operator action. Existing Gateway webhook paths, signatures, acknowledgements, and replay behavior are preserved.

## Why This Change Was Made

Await the actual ingress monitor's idle/settlement boundaries, reuse shared temporary-state cleanup, and join the SQLite worker cleanup. Keep the Gateway-owned webhook fixture and HTTP lifecycle introduced by the HTTP ingress stack.

Production +0/-0/net 0; tests +76/-49/net +27; docs +0/-0/net 0. No test cases were removed. Across all six fixture preparations, consolidation reduces test growth from +546 to +415 (+517 to +386 when including the earlier Telegram cleanup).

## Evidence

Provider: blacksmith-testbox; lease `tbx_01m3f53n667mcj031n55vm5tj8` ([run](https://github.com/openclaw/openclaw/actions/runs/36251856365)). After frozen install, `pnpm test extensions/telegram/src/webhook.test.ts --maxWorkers=1` passed 110 tests in 14.60s; `pnpm test extensions/telegram/src/telegram-ingress-drain.test.ts --maxWorkers=1` passed 32 tests in 10.01s. The command retained remote logs and exit receipts and exited 0.

An earlier streaming command ended 255 after worker compilation without a test completion receipt; no active test process or kernel OOM message was observed. The cause remains unproven, and that attempt is not counted as a pass. Deslop and independent Codex P0–P2 review are clean; the review included the unchanged Gateway fixture. The rebase onto `be46e6966c2b52c6cde06abf965c44f9a175a47f` is patch-identical. Maintainer-authorized exact-head auto-merge remains subject to required hosted CI.

Signed-SMS SIGKILL/replay proof follows the final atomic broker cutover on merged main. Legacy Telegram spool import and startup profiling remain documented follow-ups.

## Stack

Landed: #157687 → #158203 → #158233 → #158288 → #158412 → #158477 → #158628 → #158637 → #158860 → #158887 → #158896 → #158928 → #158933 → #158980 → #158987. Slice 16 is polling fixtures; this is slice 17 (webhook fixtures); slice 18 completes the broker cutover and worker-access inventory.
steipete added a commit that referenced this pull request Sep 26, 2026
## What Problem This Solves

Telegram polling tests replace process clocks and timers that the SQLite workers also need, so they cannot reliably exercise worker-backed ingress.

## User Impact

No user-visible change. This is preparation for routing the existing ingress queue through the shared-state broker. Updates require no migration, configuration change, or operator action; transport, acknowledgement, dedupe, and recovery semantics stay unchanged.

## Why This Change Was Made

Scope the watchdog clock to Telegram liveness, reuse the runtime worker launcher arguments in direct worker fixtures, await committed completions, and join database cleanup. The test-only `test-env` export is excluded from the published package; no production SDK contract changes.

Production +1/-0/net +1 (test-only SDK export); tests/support +168/-133/net +35; docs +4/-0/net +4. Across the six fixture preparations, consolidation reduces the original +546 test lines to +415; including the earlier Telegram cleanup, +517 becomes +386. Behavioral cases remain covered.

## Evidence

Provider: blacksmith-testbox. On lease `tbx_01m3ezq966mgn19mz1ds1ym28x` ([run](https://github.com/openclaw/openclaw/actions/runs/36246522577)), `pnpm test extensions/telegram/src/polling-session.test.ts --maxWorkers=1` passed 40 tests in 67.31s; worker/runtime/deadline siblings passed 16 tests in 7.43s. On lease `tbx_01m3f53n667mcj031n55vm5tj8` ([run](https://github.com/openclaw/openclaw/actions/runs/36251856365)), frozen install, `pnpm tsgo:extensions:test` (85.25s), `pnpm plugin-sdk:api:diff --base 84d71bf --head HEAD` (255.30s), `pnpm plugin-sdk:check-exports` (0.16s), and `pnpm check:docs` (49.62s) passed. SDK diff has no entrypoint or exported-signature change; reachable inferred declarations differ in optional-undefined readonly/property ordering.

An earlier SSH command ended 255 without a completion receipt; its type phase is not counted as passing. The fresh run retained per-command logs and exit receipts. Deslop and Codex P0–P2 review are clean. Rebase onto `be46e6966c2b52c6cde06abf965c44f9a175a47f` is patch-identical. Required hosted CI gates exact-head auto-merge, authorized by the maintainer.

The final signed-SMS SIGKILL/replay proof runs after the atomic broker cutover lands. Legacy Telegram spool import and startup profiling remain documented follow-ups.

## Stack

Landed: #157687 → #158203 → #158233 → #158288 → #158412 → #158477 → #158628 → #158637 → #158860 → #158887 → #158896 → #158928 → #158933 → #158980 → #158987. This is slice 16 (polling fixtures); slice 17 (webhook fixtures) and slice 18 (atomic broker cutover and inventory) follow.
steipete added a commit that referenced this pull request Sep 26, 2026
…9073)

## What Problem This Solves

The shared channel ingress queue still performs operational reads and writes synchronously on the Gateway thread, despite exposing an asynchronous API.

## User Impact

Inbound persistence and replay use the existing shared-state SQLite broker. Admission returns only after commit; claim fencing, per-account ordering, dedupe, retention, and accepted-write settlement remain intact. Operational listings observe earlier committed writes and still create a missing database for ordinary read-write queues. Explicit read-only inspection remains noncreating.

Update behavior: no schema, stored-byte, config, port, webhook path, signature, dedupe-window, or retention change; no migration or operator action. The maintainer approved the worker-access change and the broker-ordered listing adjustment. Legacy pre-May-31 Telegram spool import and Telegram startup profiling remain documented follow-ups, as directed.

## Why This Change Was Made

All twelve mutations and the operational listings cut over together to preserve one FIFO owner. Diagnostic failed-health, pressure, and account discovery already use read-only workers. Channel parsing and lane policy stay on the host; the worker verifies the prepared ordered snapshot before applying a claim or recovery decision. Custom claim clocks are sampled at transaction admission. Accepted commits settle even if caller authority later revokes.

The drain consumes one coherent pending/claimed snapshot. `listUnsettled` is optional for existing external queue implementations through the next SDK major. `purge` accepts an optional cancellation signal, and Telegram passes its existing signal. Runtime construction binds live plugin authority to every operation, replacing the purge-only wrapper. The existing table and database version are unchanged.

Deletes the main-thread queue SQL path and superseded runtime wrapper. The final write cutover is intentionally larger than the fixture slices because mixing native and broker mutations would break admission ordering. Earlier slices removed Telegram directory helpers and consolidated shared fixture scaffolding.

Production +964/-942/net +22; tests and test support +837/-315/net +522; docs +41/-18/net +23; tooling +3/-0/net +3. The runtime growth preserves authority and settlement across a worker boundary. All earlier slices plus this candidate total production net +446; test fixture consolidation reduced the original +517 growth to +386 before the final routing/regression coverage.

## Evidence

Provider: blacksmith-testbox. Lease `tbx_01m3f53n667mcj031n55vm5tj8` ([run](https://github.com/openclaw/openclaw/actions/runs/36251856365)), frozen install, `pnpm tsgo:core` (41.13s), `pnpm tsgo:extensions:test` (78.55s), and inventory generation/check passed. Nine focused owner files passed 144 tests. Single-worker wall cost per file: queue 33.02s; claim ownership 9.28s; readonly access 8.07s; pruning 7.20s; drain lanes 8.50s; monitor 9.44s; plugin-state runtime 14.12s; registry runtime-config 11.08s; Telegram monitor 15.15s. The two changed tooling files passed 381 tests in a combined 192.99s single-worker wall.

The additional 72-file per-config run used `pnpm test <explicit routed ingress paths> --maxWorkers=1`: 128 core tests and 855 extension tests passed, with two fixture failures over 518.11s. LINE and MS Teams waited for a `listPending` spy that the coherent snapshot intentionally replaces. Both fixtures now capture the real monitor and await its pump, preserving the eight-delivery cap and queued-row assertions.

Lease `tbx_01m3faw6necd61h11wcf6se4hs` ([run](https://github.com/openclaw/openclaw/actions/runs/36257798905)) proved the corrections: `pnpm test extensions/line/src/webhook-spool.test.ts --maxWorkers=1` passed 14 tests in 31.09s; `pnpm test extensions/msteams/src/msteams-ingress.test.ts --maxWorkers=1` passed 15 in 18.32s. Extension types (79.74s), runtime import cycles (9.38s; zero), Madge cycles (26.36s; zero), SDK exports (0.22s), and docs sanity (54.79s) passed. The existing pruning case with padded protected IDs passed (five tests, 8.46s). Negative controls failed for the intended reasons: removing normalization deleted a protected row; raising either channel's cap to nine caused nine deliveries where eight were required. The production controls were restored and checked.

Worker routing is covered by actual queue operations with calling-thread SQLite primitives refusing execution. Regression probes also cover missing database creation, committed-then-list inside an older ambient snapshot, live authority after awaited policy, custom-clock transaction grants, post-grant settlement, and coherent lane inspection. No weaker guards or assertions were substituted.

Deslop is clean. Codex P0–P2 review is clean after supplying the full unchanged worker kernel: two earlier allegations were disproven by existing normalization and corrupt-row filtering, with direct tests. The final review used a byte-verified capture of the full 35-file diff and the broker/kernel context. Rebase onto `4ab72dd0d2c2cc335569da0603f7778f276a1717` was patch-identical. The maintainer authorized GitHub exact-head auto-merge; required CI remains the gate.

Fresh proof on published source head `b828403ef8f309ffda1e4859f6eca3268fdc66cb` (same lease): queue/claim/readonly regression suites passed 47 tests in 38.51s; regenerated inventory and its check passed (545 source files, 2543 primitive calls). `pnpm plugin-sdk:api:diff --base 4ab72dd --head b828403` passed in 242.79s; exports passed in 0.17s. The SDK acknowledgement digest is `e2cba13f`. No entrypoints were added or removed; the additive queue contract is intentional and documented. Final head `0b24c42b9242b07e1a7c60147b4cba5f46d5bd91` only refreshes two generated source-line references.

Merged-main signed-SMS SIGKILL/replay proof is the remaining post-merge task and will be recorded in this PR.

## Stack

Landed: #157687 → #158203 → #158233 → #158288 → #158412 → #158477 → #158628 → #158637 → #158860 → #158887 → #158896 → #158928 → #158933 → #158980 → #158987 → #159006 → #159008. This is the final atomic broker cutover and inventory slice. Signed-SMS crash/replay proof follows on merged main.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
…9008)

## What Problem This Solves

Telegram webhook tests observe handler entry before durable queue settlement and remove database fixtures before asynchronous cleanup finishes.

## User Impact

No user-visible behavior changes. This test preparation needs no migration, configuration change, or operator action. Existing Gateway webhook paths, signatures, acknowledgements, and replay behavior are preserved.

## Why This Change Was Made

Await the actual ingress monitor's idle/settlement boundaries, reuse shared temporary-state cleanup, and join the SQLite worker cleanup. Keep the Gateway-owned webhook fixture and HTTP lifecycle introduced by the HTTP ingress stack.

Production +0/-0/net 0; tests +76/-49/net +27; docs +0/-0/net 0. No test cases were removed. Across all six fixture preparations, consolidation reduces test growth from +546 to +415 (+517 to +386 when including the earlier Telegram cleanup).

## Evidence

Provider: blacksmith-testbox; lease `tbx_01m3f53n667mcj031n55vm5tj8` ([run](https://github.com/openclaw/openclaw/actions/runs/36251856365)). After frozen install, `pnpm test extensions/telegram/src/webhook.test.ts --maxWorkers=1` passed 110 tests in 14.60s; `pnpm test extensions/telegram/src/telegram-ingress-drain.test.ts --maxWorkers=1` passed 32 tests in 10.01s. The command retained remote logs and exit receipts and exited 0.

An earlier streaming command ended 255 after worker compilation without a test completion receipt; no active test process or kernel OOM message was observed. The cause remains unproven, and that attempt is not counted as a pass. Deslop and independent Codex P0–P2 review are clean; the review included the unchanged Gateway fixture. The rebase onto `2c67755c29899c9deba29d3baaa902ec5d0d6efd` is patch-identical. Maintainer-authorized exact-head auto-merge remains subject to required hosted CI.

Signed-SMS SIGKILL/replay proof follows the final atomic broker cutover on merged main. Legacy Telegram spool import and startup profiling remain documented follow-ups.

## Stack

Landed: openclaw#157687 → openclaw#158203 → openclaw#158233 → openclaw#158288 → openclaw#158412 → openclaw#158477 → openclaw#158628 → openclaw#158637 → openclaw#158860 → openclaw#158887 → openclaw#158896 → openclaw#158928 → openclaw#158933 → openclaw#158980 → openclaw#158987. Slice 16 is polling fixtures; this is slice 17 (webhook fixtures); slice 18 completes the broker cutover and worker-access inventory.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
## What Problem This Solves

Telegram polling tests replace process clocks and timers that the SQLite workers also need, so they cannot reliably exercise worker-backed ingress.

## User Impact

No user-visible change. This is preparation for routing the existing ingress queue through the shared-state broker. Updates require no migration, configuration change, or operator action; transport, acknowledgement, dedupe, and recovery semantics stay unchanged.

## Why This Change Was Made

Scope the watchdog clock to Telegram liveness, reuse the runtime worker launcher arguments in direct worker fixtures, await committed completions, and join database cleanup. The test-only `test-env` export is excluded from the published package; no production SDK contract changes.

Production +1/-0/net +1 (test-only SDK export); tests/support +168/-133/net +35; docs +4/-0/net +4. Across the six fixture preparations, consolidation reduces the original +546 test lines to +415; including the earlier Telegram cleanup, +517 becomes +386. Behavioral cases remain covered.

## Evidence

Provider: blacksmith-testbox. On lease `tbx_01m3ezq966mgn19mz1ds1ym28x` ([run](https://github.com/openclaw/openclaw/actions/runs/36246522577)), `pnpm test extensions/telegram/src/polling-session.test.ts --maxWorkers=1` passed 40 tests in 67.31s; worker/runtime/deadline siblings passed 16 tests in 7.43s. On lease `tbx_01m3f53n667mcj031n55vm5tj8` ([run](https://github.com/openclaw/openclaw/actions/runs/36251856365)), frozen install, `pnpm tsgo:extensions:test` (85.25s), `pnpm plugin-sdk:api:diff --base 8816746 --head HEAD` (255.30s), `pnpm plugin-sdk:check-exports` (0.16s), and `pnpm check:docs` (49.62s) passed. SDK diff has no entrypoint or exported-signature change; reachable inferred declarations differ in optional-undefined readonly/property ordering.

An earlier SSH command ended 255 without a completion receipt; its type phase is not counted as passing. The fresh run retained per-command logs and exit receipts. Deslop and Codex P0–P2 review are clean. Rebase onto `2c67755c29899c9deba29d3baaa902ec5d0d6efd` is patch-identical. Required hosted CI gates exact-head auto-merge, authorized by the maintainer.

The final signed-SMS SIGKILL/replay proof runs after the atomic broker cutover lands. Legacy Telegram spool import and startup profiling remain documented follow-ups.

## Stack

Landed: openclaw#157687 → openclaw#158203 → openclaw#158233 → openclaw#158288 → openclaw#158412 → openclaw#158477 → openclaw#158628 → openclaw#158637 → openclaw#158860 → openclaw#158887 → openclaw#158896 → openclaw#158928 → openclaw#158933 → openclaw#158980 → openclaw#158987. This is slice 16 (polling fixtures); slice 17 (webhook fixtures) and slice 18 (atomic broker cutover and inventory) follow.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
…nclaw#159073)

## What Problem This Solves

The shared channel ingress queue still performs operational reads and writes synchronously on the Gateway thread, despite exposing an asynchronous API.

## User Impact

Inbound persistence and replay use the existing shared-state SQLite broker. Admission returns only after commit; claim fencing, per-account ordering, dedupe, retention, and accepted-write settlement remain intact. Operational listings observe earlier committed writes and still create a missing database for ordinary read-write queues. Explicit read-only inspection remains noncreating.

Update behavior: no schema, stored-byte, config, port, webhook path, signature, dedupe-window, or retention change; no migration or operator action. The maintainer approved the worker-access change and the broker-ordered listing adjustment. Legacy pre-May-31 Telegram spool import and Telegram startup profiling remain documented follow-ups, as directed.

## Why This Change Was Made

All twelve mutations and the operational listings cut over together to preserve one FIFO owner. Diagnostic failed-health, pressure, and account discovery already use read-only workers. Channel parsing and lane policy stay on the host; the worker verifies the prepared ordered snapshot before applying a claim or recovery decision. Custom claim clocks are sampled at transaction admission. Accepted commits settle even if caller authority later revokes.

The drain consumes one coherent pending/claimed snapshot. `listUnsettled` is optional for existing external queue implementations through the next SDK major. `purge` accepts an optional cancellation signal, and Telegram passes its existing signal. Runtime construction binds live plugin authority to every operation, replacing the purge-only wrapper. The existing table and database version are unchanged.

Deletes the main-thread queue SQL path and superseded runtime wrapper. The final write cutover is intentionally larger than the fixture slices because mixing native and broker mutations would break admission ordering. Earlier slices removed Telegram directory helpers and consolidated shared fixture scaffolding.

Production +964/-942/net +22; tests and test support +837/-315/net +522; docs +41/-18/net +23; tooling +3/-0/net +3. The runtime growth preserves authority and settlement across a worker boundary. All earlier slices plus this candidate total production net +446; test fixture consolidation reduced the original +517 growth to +386 before the final routing/regression coverage.

## Evidence

Provider: blacksmith-testbox. Lease `tbx_01m3f53n667mcj031n55vm5tj8` ([run](https://github.com/openclaw/openclaw/actions/runs/36251856365)), frozen install, `pnpm tsgo:core` (41.13s), `pnpm tsgo:extensions:test` (78.55s), and inventory generation/check passed. Nine focused owner files passed 144 tests. Single-worker wall cost per file: queue 33.02s; claim ownership 9.28s; readonly access 8.07s; pruning 7.20s; drain lanes 8.50s; monitor 9.44s; plugin-state runtime 14.12s; registry runtime-config 11.08s; Telegram monitor 15.15s. The two changed tooling files passed 381 tests in a combined 192.99s single-worker wall.

The additional 72-file per-config run used `pnpm test <explicit routed ingress paths> --maxWorkers=1`: 128 core tests and 855 extension tests passed, with two fixture failures over 518.11s. LINE and MS Teams waited for a `listPending` spy that the coherent snapshot intentionally replaces. Both fixtures now capture the real monitor and await its pump, preserving the eight-delivery cap and queued-row assertions.

Lease `tbx_01m3faw6necd61h11wcf6se4hs` ([run](https://github.com/openclaw/openclaw/actions/runs/36257798905)) proved the corrections: `pnpm test extensions/line/src/webhook-spool.test.ts --maxWorkers=1` passed 14 tests in 31.09s; `pnpm test extensions/msteams/src/msteams-ingress.test.ts --maxWorkers=1` passed 15 in 18.32s. Extension types (79.74s), runtime import cycles (9.38s; zero), Madge cycles (26.36s; zero), SDK exports (0.22s), and docs sanity (54.79s) passed. The existing pruning case with padded protected IDs passed (five tests, 8.46s). Negative controls failed for the intended reasons: removing normalization deleted a protected row; raising either channel's cap to nine caused nine deliveries where eight were required. The production controls were restored and checked.

Worker routing is covered by actual queue operations with calling-thread SQLite primitives refusing execution. Regression probes also cover missing database creation, committed-then-list inside an older ambient snapshot, live authority after awaited policy, custom-clock transaction grants, post-grant settlement, and coherent lane inspection. No weaker guards or assertions were substituted.

Deslop is clean. Codex P0–P2 review is clean after supplying the full unchanged worker kernel: two earlier allegations were disproven by existing normalization and corrupt-row filtering, with direct tests. The final review used a byte-verified capture of the full 35-file diff and the broker/kernel context. Rebase onto `94580ed1416cbe69b173b6ca85a1b1ab2001d55a` was patch-identical. The maintainer authorized GitHub exact-head auto-merge; required CI remains the gate.

Fresh proof on published source head `b828403ef8f309ffda1e4859f6eca3268fdc66cb` (same lease): queue/claim/readonly regression suites passed 47 tests in 38.51s; regenerated inventory and its check passed (545 source files, 2543 primitive calls). `pnpm plugin-sdk:api:diff --base 94580ed --head b828403` passed in 242.79s; exports passed in 0.17s. The SDK acknowledgement digest is `e2cba13f`. No entrypoints were added or removed; the additive queue contract is intentional and documented. Final head `0b24c42b9242b07e1a7c60147b4cba5f46d5bd91` only refreshes two generated source-line references.

Merged-main signed-SMS SIGKILL/replay proof is the remaining post-merge task and will be recorded in this PR.

## Stack

Landed: openclaw#157687 → openclaw#158203 → openclaw#158233 → openclaw#158288 → openclaw#158412 → openclaw#158477 → openclaw#158628 → openclaw#158637 → openclaw#158860 → openclaw#158887 → openclaw#158896 → openclaw#158928 → openclaw#158933 → openclaw#158980 → openclaw#158987 → openclaw#159006 → openclaw#159008. This is the final atomic broker cutover and inventory slice. Signed-SMS crash/replay proof follows on merged main.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: M 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