docs(channel-inbound): document per-inbound cfg re-resolve contract for live bindings#90852
docs(channel-inbound): document per-inbound cfg re-resolve contract for live bindings#90852caster-Q wants to merge 1 commit into
Conversation
…or live bindings CLI binding edits (openclaw agents bind / agents add) must take effect on the next inbound message without a gateway restart. The reload planner already classifies `bindings`, `agents`, and `routing` as `kind: "none"` by design, and resolve-route.ts caches evaluated bindings in a WeakMap keyed on cfg object identity. The contract is that channel plugins re-resolve routing per inbound against a fresh runtime cfg. That contract was load-bearing but undocumented in the channel author guide. Telegram inlined it from the start; qqbot shipped without it, regressed in production, and added an ActiveCfgProvider helper in openclaw#73567 to close openclaw#69546; third-party channel plugins are repeating the same regression-then-fix cycle. This commit adds a "Routing and live bindings" section to sdk-channel-inbound.md spelling out the contract and pointing at the two in-tree reference implementations, plus inline cross-link comments on the two source-of-truth declarations (BASE_RELOAD_RULES_TAIL and the WeakMap cache) so future readers there land on the doc. Refs: openclaw#90842
|
Codex review: needs real behavior proof before merge. Reviewed June 6, 2026, 12:45 AM ET / 04:45 UTC. Summary PR surface: Source +13, Docs +44. Total +57 across 3 files. Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Review detailsBest possible solution: Retry the Codex review after fixing the execution failure. Do we have a high-confidence way to reproduce the issue? Unclear. The review failed before ClawSweeper could establish a reproduction path. Is this the best way to solve the issue? Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model gpt-5.5, reasoning high; reviewed against 9313471fa579. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +13, Docs +44. Total +57 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
|
Closing this PR — the docs guidance is based on an incorrect understanding of current runtime semantics. The fact I missed: in The only path that swaps the snapshot is That makes the docs in this PR misleading: it would tell a channel author the per-inbound Replaced the analysis on #90842 with a corrected root-cause section ( Sorry for the noise. |
Summary
What problem does this PR solve?
The "channel plugins must re-resolve routing per inbound against a fresh runtime cfg" contract is real and load-bearing in current
main—bindings/agents/routingare deliberatelykind: "none"in the reload plan, andresolve-route.tscaches evaluated bindings in aWeakMap<OpenClawConfig, ...>keyed on cfg object identity. But this contract is not written down anywhere a channel plugin author would find it, so authors keep re-discovering it the hard way (shipped regression → bug report → ~80-line per-event fix).Why does this matter now?
Three plugins in or adjacent to this tree have independently re-rolled the same fix: telegram inlined it from the start, qqbot shipped without it and recovered via #73567 (closing #69546), and at least one third-party channel plugin is currently broken because of the same omission. Each repeat costs a real regression and a small
ActiveCfgProvider-shaped patch. Writing the contract down once breaks the cycle for the next plugin author.What is the intended outcome?
A channel plugin author reading
docs/plugins/sdk-channel-inbound.mdlearns the per-inboundgetRuntimeConfig()contract before shipping, instead of after. Future readers ofconfig-reload-plan.ts:120-140andresolve-route.ts:205find inline comments pointing back to the doc, so neither source-level surprise drops a channel author into a stale-routing debug session.What is intentionally out of scope?
createActiveCfgProvider) — that is the "Option B" in [Feature]: Document and/or centralize the per-event cfg re-resolve contract for channel plugins #90842 and needs a separate maintainer call on the SDK API surface. Held as a sibling branch on the fork; will open as a follow-up draft only if maintainers want that direction.qqbotortelegramto dedup their inlined patterns — leaving in place; this PR is documentation only.What does success look like?
Merged docs that a channel author can find via the existing
sdk-channel-inbound.mdreading order, plus two inline source comments that survive future refactors of the reload planner and the routing WeakMap.What should reviewers focus on?
docs/plugins/sdk-channel-inbound.mdthe right home for this section, or would you prefer it insdk-runtime.md, a newchannel-routing.md, or split across both?config-reload-plan.ts:120-140andresolve-route.ts:205— phrasing acceptable, or too prescriptive?getRuntimeConfigimport path — usedopenclaw/plugin-sdk/runtime-config-snapshotper existingsdk-runtime.mdguidance; confirm that is the canonical name.Linked context
Which issue does this close?
Refs #90842 (does not auto-close; this is the docs-only "Option A" direction from that issue, and maintainers may also want the SDK helper "Option B" before closing).
Which issues, PRs, or discussions are related?
bindingstokind: "hot"(closed); this PR documents the chosen per-event direction insteadconfig.reload-bindingsRPC proposal (closed); same direction noteWas this requested by a maintainer or owner?
No — this is a contributor proposal in response to ClawSweeper's review on #90842 (
fix-shape-clear+needs-maintainer-review). Filed as draft so maintainers can shape the direction (or close in favor of a different placement / wording) before any merge.Real behavior proof (required for external PRs)
cfgreference and reuse it inside long-lived inbound handlers, causing CLI binding edits to be silently ignored until gateway restart.mainat commitc1ddfccf65c9cf3708771b356090b7331c543f58at time of investigation.bindings/routingreload classification, theWeakMap<OpenClawConfig, EvaluatedBindingsCache>cache, and the qqbotActiveCfgProviderconsumer pattern; that timeline carries theclawsweeper:source-reprolabel.sdk-channel-inbound.md→config-reload-plan.ts:120-140→resolve-route.ts:205form a closed loop so a reader landing on either source file is pointed back to the doc.pnpm docs:check-mdxlocally — dependencies are not installed in the fork checkout and the run requirespnpm install --frozen-lockfilefirst. Relying on CI to catch any MDX render breakage; happy to install deps and re-verify if CI flags anything.clawsweeper:source-repro. If a maintainer wants the live-route repro for their own records, the steps are in [Feature]: Document and/or centralize the per-event cfg re-resolve contract for channel plugins #90842's "Real environment we tested in" section.Tests and validation
Which commands did you run?
git diff --stat— confirmed the change is 3 files, +57 / -0 (docs + two small source comments, no code paths altered).grepfor broken cross-links — verifieddocs/plugins/sdk-channel-inbound.mdreferences resolve (sdk-runtime.md,config-reload-plan.ts,resolve-route.ts,extensions/telegram/...,extensions/qqbot/...) and that the source-side cross-references todocs/plugins/sdk-channel-inbound.md"Routing and live bindings" anchor match the section header.What regression coverage was added or updated?
None — docs-only. The behavior being documented already has source-level evidence on #90842 and a merged unit-test analogue at
extensions/qqbot/src/engine/gateway/stages/access-stage.test.ts(added in #73567), which already locks in the routing layer's per-event re-resolve invariant.