Skip to content

fix(channels): keep replies working after hot config reloads - #147001

Merged
steipete merged 5 commits into
mainfrom
steipete/upd-hot-reload-dispatch-admission
Sep 13, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/upd-hot-reload-dispatch-admission

Conversation

@steipete

@steipete steipete commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #146854
Related: #145563

What Problem This Solves

Fixes inbound channel replies failing with PreparedModelCatalogConfigReplacedError after a hot config reload when a long-lived plugin monitor retains its startup config. For a transport whose cursor already advanced without durable ingress, that failure loses the message before a model turn runs.

User Impact

Channel replies continue under the committed config after model-neutral hot reloads, including tools.* and internal-hook changes, without restarting the Gateway or channel monitor.

Reported by @sunhsiao (#146854); reproduction discussion and regression shape from @Lidashi1025 and @BronyaZaychik0328 (#145563).

Why This Change Was Made

The high-level inbound wrapper opted into the existing prepared reply publication owner, but the registered low-level plugin dispatcher did not. Shared dispatch now always selects that owner, which waits for an in-progress publication and carries its config, catalog, directories, and plugin generation together. Exact catalog isolation remains enforced.

The opt-in branch and internal flag arguments are removed. The shipped optional usePublishedModelRuntime SDK argument remains accepted, deprecated and ignored, until the next SDK major. Standalone dispatch and explicit per-turn config overrides retain their existing contracts. Production LOC delta: -1; no new runtime owner, retry loop, configuration option, dependency, or storage change.

Heartbeat already reaches the shared published-runtime path. /models already projects the published owner's config; Telegram callback failures already reach its retryable ingress drain. Focused sibling coverage includes publication waits, thinking-catalog isolation, model browsing recovery, and dispatch lifecycle/delivery.

Evidence

Exact-head CI passed: run 34758958274 completed successfully for 2cc2a214844321a81e6810693edb4fbeaeeec6ee; the native CI watcher returned GREEN. The refreshed merge ref was verified against current main and includes the required baseline repair. The earlier run failed only the known baseline reclamation-memory test. One tree-identical refresh commit resolved the prior PR API/branch synchronization lag.

  • Baseline ce6718fd82a: four adapted [Bug]: WeChat channel reply dispatch fails with PreparedModelCatalogConfigReplacedError #145563 mechanism tests pass while preserving the expected exact-config rejections. The new low-level dispatch regression delivers before reload, then fails after reload with PreparedModelCatalogConfigReplacedError (1 failed, 4 passed).
  • Candidate: the same regression file passes all five tests. Focused dispatch and sibling suites total 589 passing tests across nine files.
  • The first CI run exposed a standalone runner mock missing the now-unconditional publication lookup. The fixture now returns the real outside-Gateway result (undefined); all 32 source-delivery and compaction tests pass with their original assertions.
  • Full build passed; SDK declarations regenerated after preserving the legacy argument.
  • Complete changed-file gate passed, including core/test typechecking, lint, dead-export scans, storage guards, and import-cycle checks. Final independent autoreview is scoped-clean through P2. Two test helper shadowing errors found by the first lint run were fixed and the gate rerun successfully.
  • Real ephemeral Gateway, registered synthetic low-level channel, and HTTP mock provider: PASS. Two visible replies and two provider requests across tools.exec.mode: deny → auto; same Gateway PID, same monitor identity, one monitor start, retained config A, committed config B, no restart requested.
PASS L243_BEFORE_RELOAD: registered low-level dispatch delivered a mock-provider reply; monitor starts=1
PASS L243_AFTER_RELOAD: registered low-level dispatch delivered a mock-provider reply; monitor starts=1
PASS hot tools.exec.mode reload: config A retained, config B committed, two replies delivered, same Gateway PID, 2 mock-provider requests

This is synthetic Gateway/channel/provider proof, not a real WeChat service or Windows-platform run. Transport durability still belongs to the existing ingress owner; this change prevents the reproduced stale-config dispatch rejection without inventing a queue for SDK callers that do not use durable ingress.

ClawSweeper review

The completed review at 2cc2a214844321a81e6810693edb4fbeaeeec6ee found no actionable patch defects, confirmed the head mismatch was resolved, and accepted the ephemeral Gateway/channel/mock-provider proof. No findings required changes or skips. Real WeChat and Windows coverage remains a gap.

@clawsweeper

clawsweeper Bot commented Sep 13, 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 agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Sep 13, 2026
@steipete
steipete marked this pull request as ready for review September 13, 2026 11:58
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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. labels Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 9:29 AM ET / 13:29 UTC (Revision 6).

ClawSweeper review

What this changes

Makes channel reply dispatch use the Gateway’s committed model configuration after hot reloads, preserves the legacy SDK argument, and adds regression coverage and documentation.

Merge readiness

✅ Ready for maintainer review

Keep open as a useful, supported fix: current main still contains the low-level dispatch gap. No actionable patch defects remain, and the recorded Gateway proof covers the changed boundary.

Priority: P1
Reviewed head: 2cc2a214844321a81e6810693edb4fbeaeeec6ee

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful regression coverage, sufficient Gateway-boundary proof, and no actionable correctness findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): Recorded terminal output exercises shared dispatch through a real ephemeral Gateway and registered synthetic channel, with an HTTP mock provider: replies succeed before and after hot reload while the monitor retains its original config and the process stays running.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): Recorded terminal output exercises shared dispatch through a real ephemeral Gateway and registered synthetic channel, with an HTTP mock provider: replies succeed before and after hot reload while the monitor retains its original config and the process stays running.
Evidence reviewed 10 items Current main still needs the fix: Fetched main still conditions prepared-runtime selection on usePublishedModelRuntime, leaving callers that omit the argument outside the published dispatch path.
Latest release retains the conditional path: The v2026.9.4 source also gates publication lookup on the optional argument. The local release blob was unavailable; the read-only GitHub contents endpoint supplied the matching source.
Existing publication owner supplies the repair: The changed gather step unconditionally calls the existing loader. That owner returns undefined outside the Gateway lifecycle, waits abortably for replacement and per-agent publication, and selects the configured agent’s committed runtime. This repair does not depend on a Codex harness contract.
Findings None None.
Security None None.

How this fits together

Channel plugins pass incoming messages and captured configuration into shared reply dispatch. Dispatch selects the prepared model runtime before running the agent and delivering its reply.

flowchart TD
  A[Incoming channel message] --> B[Monitor with captured config]
  B --> C[Shared reply dispatch]
  D[Gateway config publication] --> E[Committed model runtime]
  C --> E
  E --> F[Agent turn]
  F --> G[Channel reply]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +1, Tests +161, Docs +9. Total +171 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 4 15 14 +1
Tests 5 169 8 +161
Docs 1 9 0 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 193 22 +171

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #146854
Summary: This PR is the candidate fix for the canonical hot-reload dispatch issue; the earlier closed report contributes supporting evidence.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Use one committed publication for model admission while preserving exact catalog isolation, explicit per-turn overrides, and channel-owned ingress durability.

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

Yes: source identifies the retained-config low-level dispatch path, and the recorded baseline regression fails after publication with the reported error. This read-only review did not execute a current-main reproduction.

Is this the best way to solve the issue?

Yes: extending the existing publication owner to low-level dispatch repairs the missing wiring without weakening catalog equality or adding a second retry or runtime owner.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: The linked stable-release report shows established channel replies failing before agent execution after supported hot config reloads.
  • 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): Recorded terminal output exercises shared dispatch through a real ephemeral Gateway and registered synthetic channel, with an HTTP mock provider: replies succeed before and after hot reload while the monitor retains its original config and the process stays running.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded terminal output exercises shared dispatch through a real ephemeral Gateway and registered synthetic channel, with an HTTP mock provider: replies succeed before and after hot reload while the monitor retains its original config and the process stays running.

Evidence

What I checked:

  • Current main still needs the fix: Fetched main still conditions prepared-runtime selection on usePublishedModelRuntime, leaving callers that omit the argument outside the published dispatch path. (src/auto-reply/reply/dispatch-from-config.gather.ts:413, c07d397c7970)
  • Latest release retains the conditional path: The v2026.9.4 source also gates publication lookup on the optional argument. The local release blob was unavailable; the read-only GitHub contents endpoint supplied the matching source. (src/auto-reply/reply/dispatch-from-config.gather.ts:388, 3a9d69db306c)
  • Existing publication owner supplies the repair: The changed gather step unconditionally calls the existing loader. That owner returns undefined outside the Gateway lifecycle, waits abortably for replacement and per-agent publication, and selects the configured agent’s committed runtime. This repair does not depend on a Codex harness contract. (src/agents/prepared-reply-dispatch-runtime.ts:143, 2cc2a2148443)
  • SDK and override compatibility: The shipped optional argument remains accepted with a documented next-major removal window. Execution still applies explicit configOverride patches and disables prepared-context binding for those overrides; inspected sibling tests retain standalone fallback and override assertions. (src/auto-reply/reply/dispatch-from-config.types.ts:45, 2cc2a2148443)
  • Regression protects delivery and catalog isolation: The new test dispatches before and after hot reload with the same retained config and asserts both delivered results. Separate cases retain old-config rejection, lease isolation, and model-neutral advancement without rediscovery. The PR records baseline failure and candidate success; this review inspected tests without executing them. (src/agents/prepared-model-runtime.hot-reload-dispatch.test.ts:120, 2cc2a2148443)
  • Recorded production-boundary proof: The supplied PR body, captured in context sourceRevision ea20acf456c449cf4a70e76f07cbc3315db94fb094ff81bc2eeba918ba08d623, records a real ephemeral Gateway, registered synthetic low-level channel, and HTTP mock provider. It reports two replies and two provider requests across tools.exec.mode deny-to-auto, with one monitor start, retained config A, committed config B, and unchanged Gateway PID. This covers shared dispatch, not real WeChat or Windows. (2cc2a2148443)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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 (5 earlier review cycles)
  • reviewed 2026-09-13T12:05:29.776Z sha 35b1d36 :: blocked before merge. :: none
  • reviewed 2026-09-13T12:26:27.256Z sha 35b1d36 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-13T12:42:28.033Z sha 35b1d36 :: blocked before merge. :: none
  • reviewed 2026-09-13T12:57:27.653Z sha 2cc2a21 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-13T13:13:14.975Z sha 2cc2a21 :: needs maintainer review before merge. :: none

@steipete steipete closed this Sep 13, 2026
@steipete steipete reopened this Sep 13, 2026
@steipete
steipete merged commit 60643b4 into main Sep 13, 2026
366 of 369 checks passed
@steipete
steipete deleted the steipete/upd-hot-reload-dispatch-admission branch September 13, 2026 13:31
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '0ac8a700e43efceef73d92fe8e50b185819e38ad': (27 commits)
  test(acpx): prove targeted turn cancellation (#137049)
  fix(ci): honor realtime meeting live-test opt-in (#147044)
  improve: reduce heartbeat enrollment work for large fleets (#147055)
  fix(gateway): install despite stale Linux session bus addresses (#146569)
  chore(i18n): refresh native locales (#147025)
  fix: avoid Gateway reinstalls when macOS service inspection is inconclusive (#146880)
  fix(pairing): QR setup rejects trusted-proxy gateways without a shared secret (#147036)
  fix(update): bound activation and accept slow Windows identity reads (#147019)
  perf(accounts): avoid materializing avatars for owner checks (#147032)
  improve(status): report external and ArrayBuffer memory (#141902)
  fix(update): preserve linked plugins during post-core sync (#147009)
  fix(channels): keep replies working after hot config reloads (#147001)
  refactor(gateway): defer worker transcript runtime loading (#143495)
  improve: reduce GitHub OAuth maintenance work for large agent rosters (#147021)
  fix(test): avoid settings lock writer startup timeouts (#147029)
  fix(update): correct backup guidance and cover incident regressions (#147023)
  refactor(gateway): share connection lifecycle across transports (#145950)
  refactor(telegram): share HTML text escaping (#146936)
  perf(build): reduce disk use in UI performance checks (#146687)
  refactor(memory-wiki): share freshness result construction (#146935)
  ...

# Conflicts:
#	src/config/sessions/session-accessor.sqlite-reclamation-memory.test.ts
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
…w#147001)

Keep inbound channel replies working after hot config reloads when a long-lived plugin monitor retains its startup config. Shared reply dispatch now always selects the Gateway's committed model-runtime publication, preserving exact catalog isolation and publication waits without restarting the monitor.

The shipped optional usePublishedModelRuntime SDK argument remains accepted, deprecated, and ignored until the next SDK major. Standalone dispatch and explicit per-turn overrides retain their existing contracts; transport durability remains owned by channel ingress.

The low-level regression delivers before reload, fails on the original code after reload with PreparedModelCatalogConfigReplacedError, and passes after the fix. Focused dispatch and sibling tests, standalone runner fixtures, build, and changed-file checks passed. A synthetic Gateway/channel/HTTP-provider harness delivered two replies around reload with the same Gateway process and monitor; real WeChat and Windows coverage remains unproven.

Fixes openclaw#146854
Related: openclaw#145563

Reported by @sunhsiao (openclaw#146854). Reproduction discussion and regression shape from @Lidashi1025 and @BronyaZaychik0328 (openclaw#145563).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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.

[Bug]: PreparedModelCatalogConfigReplacedError still drops inbound channel messages on stable 2026.9.4 after live tools.* config reloads

1 participant