Skip to content

feat: tune inbound batching without reconnecting channels - #138780

Merged
steipete merged 2 commits into
mainfrom
codex/hot-reload-channel-debounce
Sep 5, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/hot-reload-channel-debounce

Conversation

@steipete

@steipete steipete commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Related: #138638, #138556

What Problem This Solves

Changing inbound batching currently reconnects channels to replace a captured delay. This lets Discord, Feishu, iMessage, Mattermost, Microsoft Teams, Signal, Slack, Telegram, and WhatsApp adopt committed messages.inbound timing while keeping their channel runtimes.

Shared-policy planning also stops treating one plugin's no-op declaration as permission to skip another owner's refresh.

Why This Change Was Made

The nine adapters use the existing per-entry resolveDebounceMs callback and bound runtime-config reader. The public createChannelInboundDebouncer retains its numeric startup snapshot and snapshot timing by default. Explicit transport overrides remain fixed, and independently scoped configurations stay isolated from unrelated Gateway snapshots.

The canonical policy catalog aggregates each channel's narrowest declaration independently. Undeclared channels retain conservative refresh behavior; narrower owner restart declarations and explicit global policies keep precedence. A synthesized no-channel-restart rule also preserves independently registered service interests. The service composition regression failed two cases before the fix; all 12 broad/equal/narrow, mixed/all-live, and explicit-global-noop cases now pass. The six previously verified acknowledgement consumers declare their live-read behavior through the same policy contract.

Redundant timing resolver wrappers and startup snapshots are removed. Production is +161/−123, net +38 lines; tests/support are +966/−160, net +806; docs are +30/−8, net +22. The production growth implements per-owner aggregation and explicit live-read opt-ins while preserving the shipped helper contract. No configuration keys, SDK fields, protocol fields, or persistent-store changes are added.

User Impact

Newly admitted work uses committed timing. A setting change alone does not reschedule an existing batch; later admitted messages can adjust its idle deadline within the original maximum deadline. Slack and WhatsApp carry one timing value into both pending-work bookkeeping and queue admission. Telegram's separate forwarded-message window, control-message bypass, shutdown, and explicitly deferred reply ownership keep their existing behavior.

Evidence

Evidence Observed result
Before-fix owner regressions Stale timing reproduced for all nine consumers; original shared-owner cases also failed before aggregation was repaired
Local checks Full build and selected canonical checks passed; final integration passed core/core-test types and focused typed lint; independent P0–P2 reviews are clean
Linux build and owner coverage Frozen f18961af5c23 built successfully in 223s; 614 distinct tests across 14 files/12 shards passed, including all 456 planner cases
Five real Gateway flows Slack, Discord, Signal, Telegram, and WhatsApp each passed 0 → 10000 → 0 ms; enabled admission took 10.16–10.20s and returned to 169–206ms after disable. Each retained its PID, boot ID, channel start time, and one unclosed operator connection
Four retained-monitor processes Feishu, iMessage, Mattermost, and Microsoft Teams passed real-clock 0 → delay → 0 transitions with one retained debouncer/client/socket per owner
Test-only CI follow-up ec335f132184 updates one stale exact WhatsApp metadata assertion; its focused test and independent review passed. Every other file is byte-identical to the tested f18961af5c23
Required CI CI run 33943196524 passed on ec335f132184; the corrected metadata assertion passed and the earlier tooling watchdog did not recur

Linux Testbox run: provider blacksmith-testbox, lease tbx_01m1qr50btf2xy785k0rf6hxq8, final command exit 0. Candidate/build commit is f18961af5c2337ccebc248d8d79ff9334e001e41; verified source tree is 587c9496f05ab7eb8e35b72e83b66c22775520d4; final source carrier is 2374b9ac5b7a9228fc56007ef92702645b286653. The driver supplies GIT_COMMIT before building and verifies the existing build when resuming; it never restamps an artifact.

The first command passed its build and suites, then its external receipt parser missed ANSI-prefixed monitor records. The corrected continuation preserved that initial receipt, verified the same tree/build, and completed the remaining Gateway flows. Final channel-debounce-receipt.tgz: 46,722 bytes, SHA-256 902795e5de90734fd2bbc09843c0fd246db7e4e0d338830dcd87a1e531494da8.

Compatibility Decision

Retain conservative per-owner refresh for undeclared plugins, as requested for this reload redesign. An individual plugin's live-read declaration must not leave another plugin running with a stale policy snapshot. Existing configuration remains valid and the public helper defaults remain unchanged. An undeclared plugin may refresh its own channel runtime on a shared-policy edit; the Gateway keeps running and manually stopped accounts stay stopped. This is the disposition for ClawSweeper's two compatibility before-merge items. No behavior is assumed for untested external-plugin combinations.

Known Follow-up and Proof Limits

Durable collector coalescing versus deferred reply ownership: WhatsApp's durable ingress uses the same retained-lane phase for collector buffering and an explicitly deferred reply, which can prevent another same-conversation message from reaching a pending collector. Mattermost has an analogous source-level risk. A captured original-order reproduction and an unconditional-release trial showed why that lifecycle needs its own repair: releasing the lane fixed batching but broke deferred-reply ordering. This PR preserves that contract and proves timing when work reaches the collector.

Linux proof uses synthetic providers and data. The five Gateway lanes run the real plugins and public config RPC; the other four exercise actual retained monitor/receive owners with real clocks and existing synthetic transport or reply-policy boundaries. They are distinct from full Gateway or authenticated vendor-account coverage.

The source-hash-checked, task-local Crabline 0.1.20 decoder fixture incorporates the four standard tokens already merged in crabline#294. Its exact patch and real Baileys encoder/decoder checks are captured in the artifact. Installed dependencies remain unchanged; no npm publication or real vendor-account coverage is claimed.

@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: imessage Channel integration: imessage channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web gateway Gateway runtime channel: feishu Channel integration: feishu plugin: file-transfer size: XL maintainer Maintainer-authored PR labels Sep 5, 2026
@openclaw-barnacle openclaw-barnacle Bot closed this Sep 5, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 5, 2026
@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 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 4, 2026, 11:08 PM ET / September 5, 2026, 03:08 UTC.

ClawSweeper review

What this changes

The PR lets nine channel plugins adopt inbound batching delays without reconnecting and makes shared-setting reload decisions independently for each plugin.

Merge readiness

⛔ Blocked before merge - 2 items remain

The work remains distinct from current main and the merged acknowledgement change. The verified merge result resolves the prior planner-conflict concern; no introduced blocking correctness defect was found.

Priority: P2
Reviewed head: f18961af5c2337ccebc248d8d79ff9334e001e41

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent implementation using existing primitives, meaningful owner-level coverage, and explicit compatibility limits.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from the ordinary contributor proof gate. Its captured body reports a real Slack Gateway timing transition through the changed handler with unchanged connections; broader qualification remains pending, and retained-monitor tests are supplemental.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the ordinary contributor proof gate. Its captured body reports a real Slack Gateway timing transition through the changed handler with unchanged connections; broader qualification remains pending, and retained-monitor tests are supplemental.
Evidence reviewed 11 items Verified merge result and review continuity: The test merge records the pinned main followed by the exact reviewed head as its parents. Its planner retains service composition and account targeting, resolving the earlier conflict concern. The earlier reviewed head was unavailable for direct comparison, so patch identity with that head is not asserted.
Current main still needs this capability: Current main includes messages.inbound in the shared channel-refresh policy and places individual channel rules ahead of the shared fallback. It does not contain this PR's independent aggregation of each channel's live-read declaration.
Canonical batching contract preserved: The existing queue resolves timing at enqueue, flushes pending work before immediate same-key work, and preserves the first batch's maximum deadline. The channel helper still returns a numeric startup snapshot; live timing remains an explicit callback.
Findings None None.
Security None None.

How this fits together

The Gateway publishes committed configuration and decides which channel connections need refreshing. Channel receive handlers use batching delays to combine incoming messages before admitting agent turns.

flowchart TD
  A[Committed settings] --> B[Gateway reload planner]
  B --> C{Plugin reads settings live?}
  C -->|Yes| D[Keep connection]
  C -->|No| E[Refresh channel runtime]
  F[Incoming messages] --> G[Batch with effective delay]
  D --> G
  E --> G
  G --> H[Agent turn admission]
Loading

Before merge

  • Resolve merge risk (P1) - Undeclared channel plugins can reconnect after acknowledgement or shared-policy edits that previously left them connected; the captured runtime evidence does not cover every external-plugin combination.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
Agent review details

Security

None.

PR surface

Source +38, Tests +806, Docs +22. Total +866 across 41 files.

View PR surface stats
Area Files Added Removed Net
Source 25 161 123 +38
Tests 13 965 159 +806
Docs 3 30 8 +22
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 41 1156 290 +866

Review metrics

Metric Value Why it matters
Production versus test growth Production +38 net; tests/support +806 net; docs +22 net Production growth implements independent owner aggregation and explicit live-read opt-ins while preserving the helper's snapshot contract.
Configuration contract 0 new settings; 9 inbound live-read opt-ins; 6 acknowledgement opt-ins Existing configuration gains live behavior through plugin declarations without adding another configuration or SDK field.

Merge-risk options

Maintainer options:

  1. Retain conservative per-owner refresh (recommended)
    Accept the documented reconnect behavior for undeclared plugins, consistent with the linked compatibility disposition and mixed-owner planner coverage.

Technical review

Best possible solution:

Retain the single batching engine and documented per-owner reload contract, preserving explicit timing overrides, pending deadlines, and conservative refresh for undeclared plugins.

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

Not applicable as a new live-tuning capability. Current-main source establishes the existing reconnect behavior; this read-only review did not execute runtime tests.

Is this the best way to solve the issue?

Yes: explicit use of the existing timing callback and per-owner reload aggregation fit the current architecture. Making the shared helper automatically live would unnecessarily change its startup-snapshot contract.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: Live batching adjustment is a useful, bounded channel-runtime improvement without evidence of an urgent default-path outage.
  • merge-risk: 🚨 compatibility: Independent shared-policy aggregation changes when existing undeclared plugins reconnect, even though configuration values and helper defaults remain intact.
  • 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 maintainer-authored PR is exempt from the ordinary contributor proof gate. Its captured body reports a real Slack Gateway timing transition through the changed handler with unchanged connections; broader qualification remains pending, and retained-monitor tests are supplemental.

Evidence

What I checked:

  • Verified merge result and review continuity: The test merge records the pinned main followed by the exact reviewed head as its parents. Its planner retains service composition and account targeting, resolving the earlier conflict concern. The earlier reviewed head was unavailable for direct comparison, so patch identity with that head is not asserted. (src/gateway/config-reload-plan.ts:334, ee938a145a3d)
  • Current main still needs this capability: Current main includes messages.inbound in the shared channel-refresh policy and places individual channel rules ahead of the shared fallback. It does not contain this PR's independent aggregation of each channel's live-read declaration. (src/gateway/config-reload-plan.ts:293, 790fbf0304a6)
  • Canonical batching contract preserved: The existing queue resolves timing at enqueue, flushes pending work before immediate same-key work, and preserves the first batch's maximum deadline. The channel helper still returns a numeric startup snapshot; live timing remains an explicit callback. (src/auto-reply/inbound-debounce.ts:357, f18961af5c23)
  • Pending-work timing stays consistent: Slack captures one delay before awaited pending-key flushes and carries it into enqueue. WhatsApp likewise uses one delay for pending-key tracking and queue admission, while its delivery coordinator preserves explicit transport overrides. (extensions/slack/src/monitor/message-handler.ts:420, f18961af5c23)
  • Reload composition coverage: Added planner cases cover broad/equal/narrow service prefixes, explicit global no-op precedence, mixed live and undeclared channels, and owner-specific restart exceptions. Existing account-scoped service cases remain present. (src/gateway/config-reload.test.ts:432, f18961af5c23)
  • Runtime publication reaches retained consumers: No-op reload plans still publish the committed runtime snapshot. The retained config reader follows that snapshot only when its initial config belongs to the active runtime; scoped configurations remain isolated. (src/gateway/config-reload.ts:730, f18961af5c23)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • joshavant: 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 (1 earlier review cycle)
  • reviewed 2026-09-05T02:57:59.577Z sha 7a1b3a2 :: blocked before merge. :: none

@steipete
steipete force-pushed the codex/hot-reload-channel-debounce branch from 7a1b3a2 to f18961a Compare September 5, 2026 02:59
@steipete
steipete merged commit eb11061 into main Sep 5, 2026
187 checks passed
@steipete
steipete deleted the codex/hot-reload-channel-debounce branch September 5, 2026 04:11
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
…38780)

* feat(channels): hot reload inbound batching without reconnecting

* test(whatsapp): include live policies in reload metadata expectation
vincentkoc added a commit to LiuwqGit/openclaw that referenced this pull request Sep 5, 2026
* origin/main:
  fix(gateway): keep webhook ingress retryable during hot reload (openclaw#138627)
  fix: restore Gateway restarts after Git updates (openclaw#138781)
  fix(gateway): stop repeated teardown after WebSocket failures (openclaw#138818)
  fix(gateway): abort exact live runs when cancelling tasks (openclaw#118358)
  refactor(memory): share typed embedding-cache writes (openclaw#138827)
  fix(a2a): preserve tasks while reserving commands for users (openclaw#138731)
  feat: tune inbound batching without reconnecting channels (openclaw#138780)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: imessage Channel integration: imessage channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: file-transfer rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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