Skip to content

refactor(channels): extract native ingress listing and recovery kernels - #158928

Merged
steipete merged 3 commits into
mainfrom
hostneutral/ingress-native-kernels-0926
Sep 26, 2026
Merged

steipete merged 3 commits into
mainfrom
hostneutral/ingress-native-kernels-0926

Conversation

@steipete

@steipete steipete commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The queue facade still mixes database ownership with the row operations that the worker adapter needs to reuse.

User Impact

No user-visible change. Queue ordering, malformed-payload handling, resubmission, stale recovery, purge scope and read-only missing-database behavior stay the same. Existing SQLite rows and configuration need no migration or operator action; schema, retention and public SDK contracts are unchanged.

Why This Change Was Made

Move pending/claimed/failed listings, stale-claim selection, resubmission and purge into the existing ingress kernel. The native facade immediately uses every extracted operation with its original database and transaction boundaries. This is a preparation slice of the reviewed worker design; the final broker cutover will reuse these kernels.

The old inline operations are deleted. Production +250/−165, net +85; tests 0; docs +17/−16, net +1. The extraction grows the internal operation boundary before the remaining native facade is removed in the atomic cutover. The generated inventory retains the current T1 classification and accounts for the relocated calls.

Evidence

Provider blacksmith-testbox, lease tbx_01m3et58xr5pchqj2rjcts7az9, run 36241255544. After frozen installation in an isolated, hash-verified candidate:

  • pnpm tsgo:core: pass, 42.39s.
  • pnpm test src/channels/message/ingress-queue.test.ts src/channels/message/ingress-queue.pruning.test.ts src/channels/message/ingress-queue.read-only-access.test.ts src/commands/channels/dead-letters.test.ts src/plugins/registry.runtime-config.test.ts --maxWorkers=1: 72 tests / 5 files, pass, 36.08s. No test files change in this slice.
  • pnpm db:worker-inventory:gen and pnpm db:worker-inventory:check: pass, 544 files / 2554 calls.

Deslop found no necessary edits. Codex P0–P2 review is clean for the source extraction and generated inventory. GitHub's enforced CI gate replaces a separate Testbox check-changed run. The tested source patch is unchanged by incorporating the preceding slice's generated inventory and shrinking assertion allowance. Both commits rebase patch-identically onto merged main ece27a12d64c; published head is 39622a6d502ffdbe72af8d35f3409682e2ddf461. The published runtime source passed all 72 focused tests again in 33.26s on blacksmith-testbox lease tbx_01m3ezq966mgn19mz1ds1ym28x, run 36246522577. Rebasing exposed additional main changes in the generated inventory; its owner regenerated and verified the exact target (545 files / 2558 calls), with a clean Codex review. Current head 5ac3fa38eff6cec16e0b1c987482271aac50b544 adds only that generated refresh. No runtime source changed after the focused pass.

Stack

  1. #157687 — sandbox read dispatch; merged.
  2. #158203 — ingress record types; merged.
  3. #158233 — record codecs; merged.
  4. #158288 — failed-health worker reads; merged.
  5. #158412 — pressure worker reads; merged.
  6. #158477 — account discovery; merged.
  7. #158628 — mutation kernels; merged.
  8. #158637 — settlement custody; merged as 75e416f1ac2f.
  9. #158860 — Telegram queue scope cleanup; merged as bde1d5fae597.
  10. #158887 — shared core fixtures; merged as ce1e59dc738f.
  11. #158896 — queue contract and failure codec; merged as ece27a12d64c.
  12. This PR — native listing, recovery and resubmission kernels.
  13. #158933 — channel settlement fixtures; open.
  14. Remaining fixture preparations and atomic broker cutover — prepared, unpublished.

Signed-SMS SIGKILL/replay proof remains required on merged main after the final cutover. Legacy Telegram file import and startup profiling remain maintainer-approved follow-ups.

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 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: M labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 26, 2026, 10:37 AM ET / 14:37 UTC (Revision 3).

ClawSweeper review

What this changes

The branch moves native SQLite ingress listing, stale-claim recovery, resubmission, and purge into reusable kernels and refreshes the database worker-access inventory.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 3 items remain

This remains a distinct, useful migration slice that current main has not implemented. The previously reported P2 pending-list performance finding remains unchanged at this head.

Priority: P2
Reviewed head: 5ac3fa38eff6cec16e0b1c987482271aac50b544

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The extraction has focused reported validation, but the unchanged hot-path finding limits patch readiness.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: Repository State identifies a member-authored internal extraction, so the external-contributor proof gate does not apply. Reported Testbox tests exercise the native SQLite queue path; no stored-data contract changes are introduced.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository State identifies a member-authored internal extraction, so the external-contributor proof gate does not apply. Reported Testbox tests exercise the native SQLite queue path; no stored-data contract changes are introduced.
Evidence reviewed 8 items Introduced pending-list behavior: The kernel decodes each valid pending row to filter it, discards the decoded record, and returns the raw row.
Second decode in facade: The facade decodes the returned pending rows again; the codec parses payload JSON and present metadata JSON.
Hot-path caller: Each drain pass requests all pending records, making the added decode and raw-row retention scale with queue size.
Findings 1 actionable finding [P2] Return decoded pending records from the kernel
Security None None.

How this fits together

OpenClaw stores incoming channel events in a SQLite ingress queue. The queue lists events for the drain to claim and process, and supports recovery and operator actions.

flowchart LR
A[Incoming channel events] --> B[SQLite ingress queue]
B --> C[Listing kernel]
C --> D[Queue facade]
D --> E[Drain and recovery]
E --> F[Processed events]
Loading

Before merge

  • Return decoded pending records from the kernel (P2) - For each valid pending row, baseRecord parses payload and metadata here, but the kernel discards that result and returns the raw row for the facade to parse again. The drain requests all pending rows each pass, so large queues incur duplicate JSON work and retain both raw and decoded arrays. Preserve the decoded record across this boundary.
  • Resolve merge risk (P1) - Large pending queues may increase Gateway main-thread latency and peak memory use because listing parses valid payloads twice and retains raw rows alongside decoded records.
  • Complete next step (P2) - Carry decoded pending records through the kernel boundary and rerun the focused ingress listing tests before merge.

Findings

  • [P2] Return decoded pending records from the kernel — src/channels/message/ingress-queue.kernel.ts:362-364
Agent review details

Security

None.

PR surface

Source +85, Docs +1. Total +86 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 250 165 +85
Tests 0 0 0 0
Docs 1 17 16 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 267 181 +86

Review metrics

Metric Value Why it matters
Production and test balance production net +85 lines; tests +0 The temporary kernel boundary adds production code ahead of the planned cutover, while existing queue tests provide behavioral coverage.

Merge-risk options

Maintainer options:

  1. Carry decoded pending records (recommended)
    Remove the second pending-row decode and raw-row retention, then validate the existing listing contracts before merge.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Return decoded pending records across the kernel-to-facade boundary, preserving corrupt-row filtering, post-filter limits, ordering, and the public queue API.

Technical review

Best possible solution:

Return decoded pending records from the kernel while preserving corrupt-row filtering, post-filter limits, ordering, and the existing queue API.

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

Yes. The introduced kernel and facade deterministically decode each valid pending row twice; no runtime timing measurement was performed in this read-only review.

Is this the best way to solve the issue?

No. The extraction is coherent, but the pending-list boundary should pass decoded records rather than raw rows.

Full review comments:

  • [P2] Return decoded pending records from the kernel — src/channels/message/ingress-queue.kernel.ts:362-364
    For each valid pending row, baseRecord parses payload and metadata here, but the kernel discards that result and returns the raw row for the facade to parse again. The drain requests all pending rows each pass, so large queues incur duplicate JSON work and retain both raw and decoded arrays. Preserve the decoded record across this boundary.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.93

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The PR has a bounded but concrete performance regression in an internal queue hot path.
  • merge-risk: 🚨 availability: The drain lists every pending row on each pass, so duplicate decoding can increase main-thread latency on large queues.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Repository State identifies a member-authored internal extraction, so the external-contributor proof gate does not apply. Reported Testbox tests exercise the native SQLite queue path; no stored-data contract changes are introduced.

Evidence

Acceptance criteria:

  • [P1] pnpm test src/channels/message/ingress-queue.test.ts src/channels/message/ingress-queue.pruning.test.ts src/channels/message/ingress-queue.read-only-access.test.ts --maxWorkers=1.
  • [P1] pnpm tsgo:core.
  • [P1] pnpm db:worker-inventory:check.

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Eden: 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.

  • Remove the second pending-row JSON decode and raw-row retention, then validate the existing ingress listing contracts.

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-26T14:14:07.969Z sha 39622a6 :: blocked before merge. :: [P2] Decode pending rows once and avoid retaining raw payloads
  • reviewed 2026-09-26T14:25:02.997Z sha 39622a6 :: blocked before merge. :: [P2] Decode pending rows once without retaining raw payloads

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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 26, 2026
@steipete
steipete merged commit 9be86e9 into main Sep 26, 2026
198 checks passed
@steipete
steipete deleted the hostneutral/ingress-native-kernels-0926 branch September 26, 2026 15:15
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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
…ls (openclaw#158928)

* refactor(channels): extract native ingress listing and recovery kernels

* docs(database): refresh native ingress kernel inventory

* docs(database): regenerate ingress inventory on current 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

docs Improvements or additions to documentation merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant