Skip to content

fix: Buzz bots recover relay stalls and reject revoked senders - #130467

Merged
steipete merged 4 commits into
mainfrom
codex/buzz-lifecycle-revalidation
Aug 26, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/buzz-lifecycle-revalidation

Conversation

@steipete

@steipete steipete commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Related: #129599

Release note: Buzz connection lifecycle: recheck queued sender membership after asynchronous admission, follow signed role updates without stale-query rollback, reconnect unacknowledged presence sessions, and preserve room activation floors across reconnects.

What Problem This Solves

Fixes cases where Buzz could admit a sender after room membership was revoked, remain marked ready on an open relay connection that stopped acknowledging presence, or execute pre-activation history after reconnecting. Current-member role changes could also leave the in-memory roster stale.

Why This Change Was Made

The bus owns a live admission assertion that is checked after queued/dedupe work and again after asynchronous ingress. Cancellation throws so the replay claim is released rather than recording a successful no-op. The existing presence heartbeat now treats the pinned relay library's publish timeout as fatal; explicit relay rejection remains nonfatal. Gateway reconnects reuse the canonical persisted activation floor instead of switching to a broader history window.

The membership tracker now applies the latest received, validated relay-signed roster through one owner, preserving pending removal denials and refusing rollback from older in-flight queries. It removes the obsolete self-join freshness inference that could reject already-reflected startup notifications. Role authority means the latest received signed roster, not unseen upstream database state.

Buzz's wire and signed-event filters differ: every wire filter must have #h for room-topic routing, while a signed roster has only #d. The existing manual-REQ helper carries room-scoped wire filters separately from the original strict client filters, preserving normal signature validation. There are no extra subscriptions, polling loops, dependencies, configuration fields, schema changes, or protocol changes.

Production: +109/-61 (net +48). The added ownership boundaries are live admission revalidation, signed roster delivery, and the explicit wire/client filter contract. The duplicate reconnect-history path, redundant fatal flag, and obsolete self-join inference are removed. Test support is counted separately, including an extracted relay fixture to keep the lifecycle test file within its existing size limit.

User Impact

Removed room members cannot start queued or asynchronously admitted turns. An unresponsive relay becomes visibly recovering and reconnects. Reconnects retain the documented activation boundary and replay deduplication. Signed Bot-role removal stops the active account until access is restored.

Sender membership is an admission boundary: removing a sender does not retroactively cancel a room turn already admitted for them. Bot-role loss or connection shutdown still fences output. Recipient room access remains the relay's responsibility; this is not a new privacy guarantee.

Evidence

  • Eleven selected regressions fail against the exact original production source at 2555e9fa4e4ba6ebe92c3baa8bd9b82398a352a5; the repaired owner tests pass.
  • Full Buzz suite: 31 files / 213 tests passed before the added admission-boundary characterization. Independent rerun exposed an asynchronous test-observation race; the same exact two-frame assertion now waits for actual socket delivery, and the independent socket rerun passed all 9 tests. The final socket suite passes all 10 tests, including an already-admitted room turn finishing after its sender is removed and a retired bot bus rejecting output. Targeted lint, the Buzz package typecheck, and Buzz tests under canonical compiler settings pass. Fixture typing and exported-type portability errors were reproduced and repaired without casts, relaxed flags, or weakened assertions.
  • The regression suite combines controlled WebSocket tests using the real relay client, authentication, signed events, persistent replay handling, and Gateway account lifecycle with separate queued/awaited admission tests. Together they cover revocation, activation floors, silent ACK loss versus explicit rejection, stale query/live roster ordering, removal/rejoin, replayed self-join, and forged/wrong-room roster rejection. These are fault fixtures, not the upstream service.
  • Real unmodified self-hosted Buzz at revision 4f554b6385065b698db819498a6f359b17a45459, using generated enrolled identities and private test rooms: the normal built Gateway passes the canonical canary and mention-gating scenarios (2/2), with a controlled model provider.
  • Live fault proof: freezing only the real relay container produced recovering / publish timed out before it resumed. The Gateway reauthenticated, returned to ready, and replied to another real Buzz message. A signed Bot-role downgrade stopped the active bus immediately; restoring the role recovered the account and another reply. Three live round trips passed. Activation-floor and exact replay assertions are covered by the controlled regression, not claimed from this live sequence.
  • A separate source-blind validator independently repeated the real Gateway flow: four freshly chosen human markers produced four matching replies from the configured bot, with no duplicate marked replies observed. It observed recovering during the relay freeze before resume, an explicit Bot-role error after downgrade, and readiness plus new replies after both recoveries. All five scoped behavior clauses passed; service roles were restored and the isolated Gateway stopped. This sequence does not establish an exactly-once guarantee.
  • The first real Gateway run caught a mixed-filter routing regression that the original fixture missed. The fixture now models the upstream topic and virtual-channel rules; that regression fails before the wire/client separation and passes afterward. Native upstream probes independently confirm both kind-9 messages and signed kind-39002 roster updates on the corrected wire subscription.

Dependency contracts were checked directly in Buzz room scope extraction, stored-event channel matching, signed roster emission, and the installed [email protected] publish/filter implementation. The existing Gateway-owned reconnect contract remains in force.

Keep release notes in the PR body and leave the release-owned changelog unchanged.
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: buzz size: XL maintainer Maintainer-authored PR labels Aug 26, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 7:33 PM ET / 23:33 UTC.

ClawSweeper review

What this changes

This PR makes the Buzz channel recover stalled relay sessions, apply live signed room rosters, recheck sender membership before dispatch, and preserve room activation floors across reconnects.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep this active maintainer repair open for normal exact-head merge review. The revised head addresses the prior admission-boundary concern and has no actionable correctness finding.

Priority: P1
Reviewed head: af63939921a2bc29c2f1f0ddc6dfa1e97705b024

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused real-client and socket evidence cover the lifecycle boundaries; exact-head CI remains the final merge gate.
Proof confidence 🦞 diamond lobster (5/6) Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless records real relay recovery and role-revocation runs.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless records real relay recovery and role-revocation runs.
Evidence reviewed 6 items Current-main gap: Current main reports failed presence publishes as warnings, leaving a relay session open and ready even when acknowledgements stop; this PR routes the timeout into bus recovery.
Admission owner boundary: The PR revalidates sender membership inside the queued replay owner and again after asynchronous ingress policy completes, before dispatch.
Current-main behavior: Main enqueues work after the first membership observation and invokes inbound handling without the current-membership assertion, leaving queued and async-admission revocation unaddressed.
Findings None None.
Security None None.

Live Verification

Command: pnpm test extensions/buzz/src/buzz-bus.socket.test.ts

Result: FAIL (failed) — step 1 run pnpm test extensions/buzz/src/buzz-bus.socket.test.ts: previous terminal command was still running after 30 seconds: "pnpm test extensions/buzz/src/buzz-bus.socket.test.ts"

$ node --import tsx scripts/test-projects.mts extensions/buzz/src/buzz-bus.socket.test.ts
[test] starting test/vitest/vitest.extensions.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130467-MH5foo/target

Assertions:

  • FAIL expect_output: finishes an admitted room turn after its sender is removed
  • FAIL expect_output: recovers the Gateway account after silent presence

How this fits together

The Buzz channel plugin turns relay events into authorized agent turns and sends replies back through the relay. Its gateway owns account status and reconnects when the bus reports a fatal transport or roster failure.

flowchart LR
A[Buzz relay event] --> B[Signed membership tracker]
B --> C[Admission check]
C --> D[Agent dispatch]
D --> E[Room reply]
F[Presence heartbeat] --> G[Gateway recovery]
G --> B
Loading

Before merge

  • Resolve merge risk (P1) - Production code grows by 48 net lines for a bug fix; the added lifecycle and roster ownership is justified only if the focused real-client evidence and exact-head CI remain green.
  • Resolve merge risk (P2) - The implementation depends on pinned relay-client timeout and manual-subscription behavior; this read-only checkout has no installed dependencies, so that dependency inspection could not be independently repeated here.
  • Resolve merge risk (P1) - Hosted checks are still running and the branch is behind main, so exact-head merge validation remains required.
  • Complete next step (P2) - This is an active maintainer-authored repair with no remaining discrete patch defect; complete ordinary exact-head CI and merge review.
Agent review details

Security

None.

PR surface

Source +404, Tests +549, Docs +12. Total +965 across 14 files.

View PR surface stats
Area Files Added Removed Net
Source 8 465 61 +404
Tests 5 711 162 +549
Docs 1 15 3 +12
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 14 1191 226 +965

Review metrics

Metric Value Why it matters
Production versus test delta production +109/-61 (net +48); test/test-support +1067/-162 (net +905); docs +15/-3 Production growth adds admission, live-roster, and stalled-session ownership; the larger test delta exercises them with socket and lifecycle fixtures.

Stored data model

Persistent data-model change detected: serialized state: extensions/buzz/src/buzz-relay.test-harness.ts, serialized state: extensions/buzz/src/relay-subscription.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Merge after exact-head gates (recommended)
    Accept the documented admission-time policy once the current head’s required checks and recorded real-client evidence are accepted.
  2. Pause for dependency confirmation
    Keep the PR open if maintainers want an independent audit of the pinned relay client’s timeout and custom subscription-frame behavior first.

Technical review

Best possible solution:

Retain the single bus-owned admission assertion and signed-roster owner, preserve the documented admission-time sender contract, and land only after exact-head CI and normal maintainer review pass.

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

Yes, at source level: current main lacks the queued and post-policy membership assertion, and the PR supplies focused socket coverage for those ordering cases.

Is this the best way to solve the issue?

Yes. Membership remains transport-owned, is rechecked only before dispatch, and the documented policy correctly avoids retroactively cancelling already admitted room work.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless records real relay recovery and role-revocation runs.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: This repairs active Buzz message admission and relay recovery paths.
  • merge-risk: 🚨 message-delivery: Relay recovery and inbound dispatch changes can affect room reply delivery and replay behavior.
  • merge-risk: 🚨 security-boundary: The patch controls sender admission and when a revoked bot loses relay-output authority.
  • merge-risk: 🚨 availability: Presence publish timeouts now retire and reconnect an otherwise open relay session.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless records real relay recovery and role-revocation runs.

Evidence

What I checked:

Likely related people:

  • Shakker: Recent main history contains multiple reconnect, membership, subscription, and replay repairs on the affected path. (role: recent Buzz lifecycle contributor; confidence: high; commits: d4490c6a9d9c, 6d7e371b0ebc, 8f3c61195197; files: extensions/buzz/src/buzz-bus.ts, extensions/buzz/src/room-membership-tracker.ts, extensions/buzz/src/gateway.ts)
  • Yuval Dinodia: Authored the prior retained-inbound reconnect repair that this PR extends with an activation-floor correction. (role: introduced related reconnect behavior; confidence: medium; commits: e8d546c8da8d; files: extensions/buzz/src/gateway.ts, extensions/buzz/src/recovery-watermark.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Let required checks complete on the current head.
  • Retain the PR-body dependency evidence for relay-client timeout and filter behavior.

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-08-26T22:45:28.004Z sha de654d3 :: needs real behavior proof before merge. :: [P1] Recheck membership immediately before reply delivery

@openclaw-barnacle openclaw-barnacle Bot reopened this Aug 26, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

I reviewed the final-delivery finding and all three Rank-up moves against the existing documented contract. We are preserving the existing admission-time contract: removing an ordinary sender blocks new and queued turns, but does not retroactively cancel a room turn that was already admitted. The documentation now states that boundary explicitly, and a focused real-client/socket test holds an admitted turn, applies a signed roster removing its sender, resumes it, and observes the actual reply addressed to the room. The Bot-role-loss control separately verifies that the retired bus rejects a later send.

Accordingly, the proposed final sender checks and the two associated final-effect proof requests are intentionally skipped. This is not a claim that removed principals gain private-room access. inbound.ts replies to the room, not a sender DM; the active bot's connection lifetime is checked at text/typing I/O. Recipient access belongs to the relay. In the tested upstream revision, member removal invalidates membership and evicts live subscriptions before emitting the removal notice, and the subscription owner removes the revoked room from its indexes. Public-room visibility remains the relay's policy. These source checks are not a new universal privacy guarantee.

Adding only a final sender assertion would not undo already executed agent tools. It would also throw inside the existing replay-guarded turn after work had occurred, potentially releasing the claim for replay. A broader retroactive cancellation policy needs an explicit run/side-effect lifecycle design; this PR does not introduce one.

The remaining review points were checked as well. The exact publish timed out error is the inspected [email protected] dependency contract, covered by real-client timeout versus explicit-rejection tests and actual frozen-relay recovery. Production remains +109/-61, net +48; test support is not production, and the added owner boundaries are explained in the PR body. The serialized-state heuristic refers to WebSocket frames and a test fixture, not a persistent-store/schema migration. The review's “still running after 30 seconds” transcript is not a terminal failing test result; our completed owner and independent socket runs, actual upstream Gateway checks, and source-blind live validation are recorded separately in the PR body.

Hosted CI also found a genuine test-helper export portability error. The helper now returns only its Relay override, while the mock factory owns the original-module merge. The exact package compiler failure was reproduced and repaired, including a forced-inclusion declaration check; no compiler flags or assertions were weakened. Exact-head hosted CI remains a separate merge gate.

@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 26, 2026
@steipete
steipete merged commit e9dc4b9 into main Aug 26, 2026
135 of 137 checks passed
@steipete
steipete deleted the codex/buzz-lifecycle-revalidation branch August 26, 2026 23:48
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 26, 2026
* origin/main: (26 commits)
  fix(plugins): preserve registry epoch on activation rollback (#129232)
  refactor(plugins): make discovery invocation-owned (#130486)
  feat(ui): save appearance preferences per user profile (#130340)
  fix: Buzz bots recover relay stalls and reject revoked senders (#130467)
  fix(code-mode): serialize catalog handles nested in final values (#130276)
  fix(webchat): CLI skill and harness-injected turns render as operator-sent messages (#130427)
  fix(agents): read the published model catalog owner from session_status (#130277)
  fix(channels): preserve long presentation text (#130368)
  fix(agents): route CLI bootstrap truncation notice into the system prompt (#130325)
  refactor(plugins): unify setup registration and artifact selection (#130474)
  fix(memory): prevent forgotten session content from returning (#130451)
  refactor(outbound): consolidate transport completion (#130460)
  fix(workers): protect in-flight workspace manifests from concurrent retention (#130449)
  fix(portals): keep worker previews reachable and owned by the active environment (#130434)
  fix(config): keep core channels keys in the generated config schema (#120736)
  chore(deps): refresh dependencies after seven-day cooldown (#130296)
  fix(agents): remind exec models to quote shell metacharacters (#125485)
  fix(auth): honor shared-store ownership in temp-state exec and agent deletion (#130437)
  fix(openshell): preserve file writes during concurrent mirror commands (#130447)
  fix(workers): report full nodes as at capacity, not offline (#130445)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…law#130467)

* fix(buzz): recover stalled sessions and revalidate room admission

* test: correct Buzz relay fixture types

Keep release notes in the PR body and leave the release-owned changelog unchanged.

* test: isolate Buzz relay mock exports

* test: clarify Buzz admission and output lifetimes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: buzz docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. 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