Skip to content

fix(outbound): prepare cold channel metadata asynchronously - #149304

Merged
steipete merged 22 commits into
mainfrom
codex/outbound-bootstrap-metadata-preparation-20260915
Sep 18, 2026
Merged

steipete merged 22 commits into
mainfrom
codex/outbound-bootstrap-metadata-preparation-20260915

Conversation

@steipete

@steipete steipete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Related: #144592

What Problem This Solves

Cold sends and delivery recovery can read installed plugin metadata on the Gateway thread when a channel has only setup metadata.

User Impact

Channel bootstrap now awaits discovery-mode and installed-index preparation through the existing state worker. Existing plugin selection and loader fallback remain supported. This adds no configuration options, stored formats, or migrations.

Why This Change Was Made

The existing plugin cache and shared selection algorithm remain the owners. Async preparation captures state/workspace locations before awaiting and rechecks caller authority and registry selection before loading the channel. Deferred admission returns a synchronous policy closure so recovery checks its continuation fence first. Cancellation and preparation failures retain one queue-owned terminal audit and message hook before admission.

Current-main handoff and pin authority checks remain intact. Synchronous bootstrap remains available to callers outside this cut. Existing pure retry policy and the Matrix test adapter move into narrow sibling modules to satisfy line limits while preserving behavior and assertions.

Evidence

Candidate d465c7222a35eb79208de502c822fdc448eeafd1 carries canonical main 543e8ce3 through shared ancestor af93878c, including the early registry-custody owner in #151651. All three catalog production files match main, and both complementary worker regressions are preserved. All 16 metadata files remain byte-identical to predecessor d30e6634, whose full CI passed.

The latest composition passed fresh P2 review, core/agents/messaging types, the line-cap guard, one ordinary catalog replacement case, and four metadata-worker controls. Those controls observed zero parent calls across six measured SQLite methods during the measured reads. The unchanged 48 metadata cases passed on d30e6634. Shared ancestor af93878c separately passed 48 cleanup/adoption/worker tests and its own P2/types/lint/format checks; these results retain their source bindings.

Earlier 75b22e0 passed the normal build, types, the exact canonical #151632 offline Telegram fixture, and the unchanged Matrix Doctor case in 38.535 seconds on macOS arm64/Node 24.21 with its original 120-second deadline. New-head CI and native preparation remain pending.

The former Doctor prerequisite #149381 is closed as superseded by #150978. Current policy admits copied config plugins within recognized rehearsals, preserves ordinary-path deferral, and retains state/inspection obligations. Seventeen existing real preflight boundary cases passed. Published 2026.9.4 source supplies the required rehearsal markers and copied paths; this reconciliation adds no production change or updater replay.

Historical combined updater proof remains exclusively attributed to source 7ddc8566 and package f66f97d0: all 13 phases and 12 updater steps passed in Linux arm64 Docker, manual/no-provider mode. Its original failures and limitations remain retained, including emitted hashes being observations and the historical Control UI release-preflight failure.

CI on 75b22e0 exposed a prepared-registry lifetime failure in the catalog-worker shard. The inspected provider-only fixture does not invoke the changed outbound path. The shared carry now uses canonical main's single construction-custody owner; no competing implementation or fault replay was added.

The earlier Linux Matrix timeout remains unexplained. No fresh installed-package/update-cell, managed-service restart, live-provider, full release-validation, or speedup claim is made.

@clawsweeper

clawsweeper Bot commented Sep 15, 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 gateway Gateway runtime commands Command implementations size: M maintainer Maintainer-authored PR labels Sep 15, 2026
@steipete
steipete marked this pull request as ready for review September 15, 2026 17:42
@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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 18, 2026, 8:17 AM ET / 12:17 UTC (Revision 17).

ClawSweeper review

What this changes

The PR prepares cold channel metadata asynchronously before outbound delivery and recovery, preserves cancellation reporting, and adds registry-lifetime regression coverage.

Merge readiness

⛔ Blocked before merge - 1 item remains

The improvement remains absent from main and v2026.9.4. No actionable introduced defect was found, and the previous generic migration blocker is not supported by the current diff.

Priority: P2
Reviewed head: d465c7222a35eb79208de502c822fdc448eeafd1

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with preserved ownership, useful regression coverage, and no actionable correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this maintainer-authored internal change. Captured evidence includes worker SQLite controls and historical published-driver upgrade proof with explicit source bindings; no fresh current-head live run is claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this maintainer-authored internal change. Captured evidence includes worker SQLite controls and historical published-driver upgrade proof with explicit source bindings; no fresh current-head live run is claimed.
Evidence reviewed 8 items Current main still uses synchronous bootstrap: The fetched main revision calls discovery and registry loading synchronously without the new metadata-preparation boundary.
Latest supplied release also lacks the change: The v2026.9.4 source has the synchronous bootstrap implementation; this PR's central improvement is not already shipped there.
Shared preparation and complete caller migration: Bootstrap captures environment and workspace, retains the existing cache, prepares both metadata facts, checks freshness, and repeats selection before loading. Searches found all production message-adapter consumers awaiting the changed contract; recovery checks its continuation fence before invoking deferred policy.
Findings None None.
Security None None.

How this fits together

Outbound delivery selects channel plugins for new messages and queued retries. Metadata preparation feeds that selection before existing admission, queue custody, and transport checks run.

flowchart TD
  A[New message or queued retry] --> B{Channel already ready?}
  B -->|No| C[Prepare metadata through state worker]
  B -->|Yes| D[Select channel plugin]
  C --> D
  D --> E[Check delivery admission and custody]
  E --> F[Channel transport and outcome]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +173, Tests +95. Total +268 across 17 files.

View PR surface stats
Area Files Added Removed Net
Source 8 297 124 +173
Tests 9 249 154 +95
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 546 278 +268

Review metrics

Metric Value Why it matters
Compatibility surface 0 new settings, schemas, or public plugin APIs The change reuses existing metadata readers and changes internal preparation order.

Stored data model

Persistent data-model change detected: serialized state: src/infra/outbound/delivery-queue-recovery-policy.ts, serialized state: src/infra/outbound/delivery-queue-recovery.ts, unknown-data-model-change: src/infra/outbound/delivery-queue-recovery.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep cold metadata reads with the existing state worker and cache owner while preserving channel selection, queue custody, and final transport fences.

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

Yes, at source level: a cold setup-only channel on main reaches synchronous metadata discovery before loading its sender. This review did not execute a runtime reproduction.

Is this the best way to solve the issue?

Yes. The patch reuses existing worker preparation and one shared selection algorithm, with awaited consumers and preserved delivery fences.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 488ff7c486c6.

Labels

Label justifications:

  • P2: Removing synchronous metadata reads from cold outbound paths is a bounded runtime reliability improvement.
  • 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 external-contributor proof gate does not apply to this maintainer-authored internal change. Captured evidence includes worker SQLite controls and historical published-driver upgrade proof with explicit source bindings; no fresh current-head live run is claimed.

Evidence

What I checked:

  • Current main still uses synchronous bootstrap: The fetched main revision calls discovery and registry loading synchronously without the new metadata-preparation boundary. (src/infra/outbound/channel-bootstrap.runtime.ts:87, 488ff7c486c6)
  • Latest supplied release also lacks the change: The v2026.9.4 source has the synchronous bootstrap implementation; this PR's central improvement is not already shipped there. (src/infra/outbound/channel-bootstrap.runtime.ts:87, 3a9d69db306c)
  • Shared preparation and complete caller migration: Bootstrap captures environment and workspace, retains the existing cache, prepares both metadata facts, checks freshness, and repeats selection before loading. Searches found all production message-adapter consumers awaiting the changed contract; recovery checks its continuation fence before invoking deferred policy. (src/infra/outbound/channel-bootstrap.runtime.ts:204, d465c7222a35)
  • No introduced persistent-format migration: The existing metadata worker executes plugins.metadata.read with existingOnly enabled. The patch introduces no schema, serialized-format, public plugin API, or configuration change. The storage checkpoint at docs/reference/database-schemas/storage-changes.md:763 exempts read-only queries preserving existing semantics, so the previous generic migration requirement is not carried forward. (src/plugins/plugin-metadata-state-worker.ts:15, d465c7222a35)
  • Re-review continuity: The scoped comparison against the preceding reviewed head produced no outbound, command-fixture, or send-fixture changes. Separately inspected tree entries show prepared-model-runtime.ts, prepared-model-runtime.facts.ts, and prepared-model-runtime.resources.ts are byte-identical to fetched main. The introduced catalog addition is regression coverage, not another production custody implementation. (src/agents/prepared-model-catalog-worker.pool.integration.test.ts:723, d465c7222a35)
  • Captured validation and historical upgrade evidence: The supplied body reports fresh worker controls with zero parent calls across six SQLite methods and preserved metadata-suite results. Historical published-2026.9.4 updater proof remains bound to composition 7ddc85668baf3444b57270b04164be14bce70ba7 and package f66f97d0711845c58bd4db6eb56e86005da3be4ebef210539624ea2ebce7c2da: 13 phases and 12 updater steps passed in Linux ARM64 Docker, manual/no-provider mode. fix(doctor): keep ready plugin contracts in update validation #149381 is closed unmerged; its Doctor prerequisite was superseded by merged fix(update): run copied config plugin Doctor contracts #150978. These are historical observations, not a fresh execution of this head. (7ddc85668baf)

Likely related people:

  • steipete: 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 (16 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-16T09:21:30.286Z sha 52a2005 :: blocked before merge. :: none
  • reviewed 2026-09-16T10:27:16.010Z sha 52a2005 :: blocked before merge. :: none
  • reviewed 2026-09-16T10:46:20.352Z sha 52a2005 :: blocked before merge. :: none
  • reviewed 2026-09-16T21:29:13.938Z sha ebc1da8 :: blocked before merge. :: none
  • reviewed 2026-09-16T23:02:10.585Z sha ebf9b28 :: blocked before merge. :: none
  • reviewed 2026-09-18T10:06:15.787Z sha 75b22e0 :: blocked before merge. :: none
  • reviewed 2026-09-18T10:28:53.497Z sha 569fcfe :: blocked before merge. :: none
  • reviewed 2026-09-18T11:46:37.528Z sha d30e663 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 16, 2026
Carry the test-only correction from 2dd0ed9 (#149558). Preserve both idempotent alias setup calls and the yielded-session completion and zero-root cleanup contracts.

Adapt only the wrapper fixture hunks to the frozen metadata branch; runtime and dependency inputs remain unchanged.

Co-authored-by: Vincent Koc <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Sep 16, 2026
Revert the six-file fixture carry in dc3de02. Current main contains newer canonical owners; its clean merge preview retains all six fixture blobs unchanged.

Restore the exact qualified metadata tree without changing runtime or dependency inputs.
Compose pinned current main0bb2b6d6b85e072a1c5cacca5852c7caac1d0489, preserving newer send-authority owners. Adapt the existing Discord request-authority fixture to await metadata preparation and invoke its admission closure with the same assertion.

59 selected controls, full changed-file gate, fresh P2 review and normal build passed on the frozen composition tree.
@steipete
steipete requested a review from a team as a code owner September 16, 2026 07:30
Reuse existing delivery fixture helpers and simplify last-call lookup so metadata preparation does not grow oversized test files. Preserve all assertions and production behavior.
Keep cold metadata preparation and delivery authority checks intact while extracting the existing pure recovery policy and Matrix delivery fixture. Preserve all recovery statements and test assertions; qualify the standalone change against the current main parent.
Preserve current-main delivery authority and fixture changes while carrying the reviewed async cold metadata preparation. Retain the original Matrix Doctor deadline and assertions; the unchanged current-source synthetic case passed without establishing the historical timeout cause.
Compose the approved metadata change with current main, including the canonical Telegram helper/recorder repair and Doctor-owned historical state repair. Preserve the metadata patch, ordinary plugin deferral policy, and original synthetic test deadlines.
Retain selected plugin registries through awaited preparation and hand construction claims to the completed generation. Preserve stale-publication cleanup and borrowed Gateway-root ownership. Related: #151588, #148290.
@openclaw-barnacle openclaw-barnacle Bot removed the agents Agent runtime and tooling label Sep 18, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 18, 2026
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Sep 18, 2026
@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 18, 2026
Compose c76d6b3 with canonical main 2db54d7. Keep canonical facts, selector, and lifetime ownership while retaining the real-worker regression. The only delta from canonical main is that regression; no universal unleased-generation safety claim is made.
Normally compose the accepted shared catalog ancestor with exact main 543e8ce. Preserve the canonical required early-retention callback and both complementary existing regressions unchanged. The only main-relative delta is the retained after-credentials real-worker regression.
@steipete
steipete merged commit 7e3d506 into main Sep 18, 2026
210 of 211 checks passed
@steipete
steipete deleted the codex/outbound-bootstrap-metadata-preparation-20260915 branch September 18, 2026 13:36
@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 19, 2026
…#149304)

Prepare cold outbound channel metadata asynchronously through the existing state worker. Preserve the shared plugin cache and selection owner, captured workspace/state context, and currentness checks before loading or queue admission. Cancellation and preparation failures retain one queue-owned terminal audit and message hook.

Keep synchronous bootstrap for callers outside this cut. Extract unchanged retry policy and the Matrix test adapter into internal siblings; preserve canonical catalog custody and complementary regression coverage. No new configuration, stored format, or migration.

Validation: exact-head CI run 35343214882 passed; focused metadata/worker controls, relevant types, line-cap checks, and fresh P2 review passed. Historical updater proof remains bound to source 7dd / package f66; no new installed-update or live-provider proof is claimed.

Related: openclaw#144592. Doctor openclaw#149381 was superseded by canonical openclaw#150978.
Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant