Skip to content

fix: keep ambient chatter from evicting user requests - #191733

Merged
RomneyDa merged 5 commits into
mainfrom
openclaw/fast-shell
Nov 5, 2026
Merged

RomneyDa merged 5 commits into
mainfrom
openclaw/fast-shell

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Closes #182176. Follow-up to #187833: optional room events must not evict or delay explicit user requests when the follow-up queue reaches capacity.

User Impact

Requests retain their place ahead of optional room events. Under the default summarize policy, overflow ambient text is compacted into bounded background context on an eligible pending turn, rather than always discarded or replayed as extra turns. Explicit old and new policies still discard ambient overflow without previews.

Behavior and limits

  • Shed optional ambient work first, preserving survivor FIFO. Active turns, protected recovery work, and required replies are not ambient eviction candidates.
  • A pending recipient in the same channel, account, room, thread, and Gateway retains the newest min(cap, 20) previews, ordered by mailbox arrival. Each message body is capped at 160 characters; sender and message ID fields at 80 each.
  • Previews are conversation data, not instructions or sender authority. Approved input text wins over raw text. If an input write hook has not approved the body, retain an omission notice instead of bypassing that hook.
  • Context attaches once, survives preparation retries without duplicate growth, and never creates another runnable queue or independent replay turn. It expires with its recipient; no eligible recipient means no preview. Recipient cancellation or discard may lose the context. This is bounded, best-effort preservation—not lossless history.
  • Source custody still settles as intentional non-delivery without opening execution delivery scopes. QA-channel's existing disposition callback releases its receipt; active delivery tracking stays intact. Discard logs include contextPreserved without message content.
  • Channel history retention and request-versus-request overflow remain unchanged. No new configuration or storage.

Evidence

  • Added preservation assertions fail on published head 6275c329bf19: ambient overflow has no context under summarize.
  • Revised candidate: 119 focused tests pass across overflow context, collection, pending inputs, and steering (four files, two Vitest shards, 65.14s wall time). Covers cross-sender attribution without authority transfer, thread/account/Gateway isolation, approved versus unstaged content, preview truncation/count limits, retry nonduplication, cancellation expiry, request priority, and existing receipt/delivery regressions.
  • Core and messaging-test typechecks, touched-file type-aware lint, formatting, git diff --check, line-cap ratchet, and staged test-line ratchet pass.
  • Fresh independent static review of the revised candidate found no actionable P0–P2 findings. Local ClawSweeper completed a full read-only review of 65181e714709..06a8405bf219 (high reasoning effort), finding no actionable correctness or security issues; no review findings remain. It did not execute tests or mutate GitHub.
  • Live Telegram/channel proof remains unverified. The earlier isolated Gateway attempt could not classify ambient QA-channel inputs. These queue-boundary tests are not presented as live channel evidence.
  • Previous-head CI failure was attributed to inherited test-budget debt: exact CI merge 2241d0d4d086 was 8 lines over its ceiling, and unchanged base 232327e0239a was already 8 over. The PR allocated its own complete test growth. Revised-head CI must be assessed separately.

Scope and review

The revised design replaces unconditional default-policy content loss with context owned by an existing pending turn. pr-simplify avoided a mailbox-wide buffer, cleanup state machine, new configuration, and independent replay work. Compared with the original merge base: production +172 net lines, tests +191, docs +28. The dedicated allocation covers exactly the PR's 191 net test lines; the shared scalar is unchanged.

@clawsweeper

clawsweeper Bot commented Nov 3, 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 channel: qa-channel Channel integration: qa-channel size: M labels Nov 3, 2026
@RomneyDa
RomneyDa marked this pull request as ready for review November 3, 2026 07:09
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR sheds optional ambient events before user requests and preserves bounded previews on an existing pending turn.

Example: With followup cap 2, Ada's deploy request is followed by Grace's and Linus's ambient messages.

  • Before: Grace's and Linus's messages evict Ada's request into an overflow-summary turn.
  • After: Ada's request keeps its place; Grace's ambient event is shed, with a bounded preview attached to Ada's turn under summarize.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused patch has no identified correctness defect, but required real-behavior proof is absent and exact-head CI failures remain unattributed.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Busy ambient rooms can displace explicit requests and spend additional model turns replaying optional chatter.
Reason: The production report establishes user impact, and maintainer authorship supplies direction for preferential ambient shedding and its documented best-effort preview limits.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored PR open: current main still allows ambient overflow to evict user requests, and source review found no actionable introduced defect.

Priority: P1
Reviewed head: 4ed43cefad119915653c76702b5827864a5a3d22

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Missing is a shipped Gateway/channel overflow run showing request preservation, bounded preview delivery, and terminal ambient receipt settlement; the body reports queue-boundary red/green tests only.
Agent review details

How this fits together

Channel inputs enter the shared session mailbox, which applies overflow policy and drains accepted work into agent turns while settling channel receipts.

flowchart TD
  A[Channel inputs] --> B[Session mailbox]
  B --> C[Overflow policy]
  C --> D[Pending user turn]
  C --> E[Ambient disposition]
  E --> F[Channel receipt settlement]
  C --> G[Bounded background previews]
  G --> D
  D --> H[Agent execution]
Loading

Technical review

Best possible solution:

Keep ambient shedding in the existing mailbox owner, with bounded recipient-owned context and unchanged authority and request-versus-request overflow rules.

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

Current-main source establishes the failure with followup cap 2: an oldest direct request followed by ambient events becomes an overflow summary; no target code was executed during this review.

Is this the best way to solve the issue?

The change repairs the shared mailbox boundary and uses the existing turn lifetime for previews; the added tests protect distinct failures without introducing a parallel queue or unnecessary test scaffolding.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Generic overflow summarization changes intended behavior with a stated reason (ac36eba: Queue modes gained bounded backlog handling that retained dropped messages as synthetic summary prompts.)
  • Summarized source attribution keeps the original intent (f58fd16: Restore each summary's own sender and room-event context without transferring live-item metadata.)
  • QA deferred-input completion changes intended behavior with a stated reason (ee860ff: Separate adoption and successful delivery so queued inputs neither replay after restart nor appear completed prematurely.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +172, Tests +191, Docs +28, Other +3. Total +394 across 13 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 177 5 +172
Tests 4 223 32 +191
Docs 2 29 1 +28
Config 0 0 0 0
Generated 0 0 0 0
Other 1 3 0 +3
Total 13 432 38 +394

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test growth Production +172 net lines; tests +191 net lines Growth implements bounded recipient-owned previews and distinct priority, isolation, receipt, retry, and cancellation regressions; a dedicated allocation covers the test growth.

Labels

Label changes:

  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🧂 unranked krab, so this older rating label is no longer current.

Label justifications:

  • P1: The linked production report establishes direct requests delayed and summarized by ambient bursts, and current main retains the responsible selection path.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-03T07:26:04.927Z sha 6275c32 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-03T23:09:51.884Z sha 6275c32 :: needs maintainer review before merge. :: none

Reviewed November 4, 2026, 9:23 PM ET / November 5, 2026, 02:23 UTC (Revision 3).

@RomneyDa

RomneyDa commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 3, 2026
RomneyDa and others added 2 commits November 4, 2026 18:08
@RomneyDa

RomneyDa commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 5, 2026
@RomneyDa

RomneyDa commented Nov 5, 2026 •

Copy link
Copy Markdown
Member Author

Follow-up to the current ClawSweeper review

Checked published head 4ed43cefad119915653c76702b5827864a5a3d22. The review reports no actionable code findings. This comment supplies concrete evidence and keeps the remaining gaps explicit; it does not claim the missing live overflow proof is complete.

Executed behavior evidence

The published head and locally tested candidate 06a8405bf219 have identical Git trees (cc4b2368d49de29f3a1aa51773d624e8b7b89d95). The retained focused run reports 119 tests passed (95 + 24 across four files). This is reused unchanged-code evidence, not a new run. The overflow regression exercises the production queue owner and verifies:

  • At cap 2, the two explicit requests execute in order; evicted and rejected ambient inputs settle without becoming replay turns or disturbing active delivery correlation.
  • Under summarize, their previews reach the surviving request as conversation data; old and new omit them.
  • At cap 3, a request followed by 25 ambient inputs executes before the last two ambient inputs; its compacted context retains previews 20–22 rather than an unbounded backlog.
  • Same-room sender attribution, scope isolation, approved-text truncation, unstaged-hook omission, retry nonduplication, and cancellation expiry are asserted.

The current-head CI changed-tests job also passed all 9 Gateway session-input lifecycle integration tests, including followup, steering, stop preservation, and announcement/recovery interactions. These are useful sibling checks, not ambient-channel overflow proof.

Current-head CI attribution

CI run 41953880508 tested merge 8c90dea47d4b8d67e04fbfd8111506382f511d5d against base e531410a397e5cdb3c839ce69ac10283a70bcb21.

Failure Evidence Conclusion
Test-line ratchet Merge: 6,477,710 lines / ceiling 6,477,659. CI delta: +191 test lines. Base allocation blobs give ceiling 6,477,468; derived base count is 6,477,519. Both base and merge are 51 lines over. This PR contributes +191 lines and +191 allocation; it does not increase the deficit. The older 8-line explanation does not describe this run.
Goal child-authority product test At line 569, expected FORBIDDEN / operator role changed, received gateway not connected. The test source is unchanged from the CI base. Inherited failure reproduced. Unchanged exact CI base fails with the identical signature at line 569; published PR head passes on its older base. See the reproduction below.

Gateway failure: attribution now established

Ran the same focused command with the repository test wrapper and pinned Bun runtime, using isolated test state:

node scripts/run-vitest.mjs src/gateway/server.goal-child-authority.product.test.ts --maxWorkers=1
Source Result
Published PR head 4ed43cefad119915653c76702b5827864a5a3d22 (older base) 1 test passed, 147.85s Vitest duration.
Unchanged exact CI base e531410a397e5cdb3c839ce69ac10283a70bcb21, separate detached checkout and frozen dependencies 1 test failed, 107.82s; same line 569, expected FORBIDDEN / operator role changed, received Error: gateway not connected.

These are local macOS replays, not a claim that Linux CI was rerun. The matching failure on unchanged base establishes that this PR is not required to cause it.

Source attribution: #192722 / 5b3ff077dcbd added disconnectDisallowedGatewayPolicyClients to refreshConnectedUserProfile. After the test changes the role from scoped (read/write) to revoked (read only), profile publication refreshes clients and closes the now-disallowed connection. The test waits for active work to drain, then still expects a users.self RPC to return a structured role rejection. The client instead rejects locally because its socket has already closed. The base, tested CI merge, and PR diff leave that test and disconnection owner unchanged relative to the base. No ambient inputs or queue-capacity overflow are required by this scenario.

Both substantive CI failures are therefore inherited: the 51-line budget deficit and this stale post-revocation RPC expectation. No CI retry, assertion weakening, or unrelated production change was made. This corrects the earlier unresolved attribution; it does not close the separate live-channel proof gap.

Live-channel proof attempt and blocker

Ran the canonical Telegram Test Server readiness command:

node .agents/skills/telegram-e2e-userbot/scripts/telegram-test-doctor.mjs

It returned ok: false: existing convex, bunx convex, and npx convex launchers were all UNAVAILABLE, with no supplied broker credential pair. It stopped before sending any Telegram test messages. No live Gateway was modified. This is an environment/readiness failure, not evidence for or against the queue behavior.

To complete the missing real-channel proof, the QA credential owner must supply authenticated access to the existing Convex broker, or privately provide OPENCLAW_QA_CONVEX_SITE_URL and OPENCLAW_QA_CONVEX_SECRET_CI. Then run the isolated group scenario with a busy turn, queued direct request, ambient overflow, model-visible bounded previews, and terminal source settlement. Until that run succeeds, live ambient overflow remains unverified.

No code, budgets, or branch history were changed for this follow-up. The PR remains unmerged.

@RomneyDa
RomneyDa merged commit 69d6eae into main Nov 5, 2026
131 of 135 checks passed
@RomneyDa
RomneyDa deleted the openclaw/fast-shell branch November 5, 2026 05:29
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 6, 2026
* fix: preserve user requests during ambient queue overflow

* fix: settle discarded ambient input without delivery scopes

* fix: keep ambient chatter from evicting user requests

OpenClaw-Publication: 4ccedf5d-d860-4b15-85e9-251f70601797

* fix: preserve bounded ambient context during queue overflow

* Publish openclaw/fast-shell

OpenClaw-Publication: 933231df-b944-4a6d-9e8d-becfd2191d99

---------

Co-authored-by: RomneyDa <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 13, 2026
Upstream openclaw#191733 sheds ambient room events at the cap with a settled,
no-retry discard, and isDiscardableRoomEvent has no owner check, so the
human owner's unaddressed room message could be silently consumed.

Mark it protected before capacity selection through the existing
protectFromQueueOverflow flag. Ownership is the channel-verified sender
identity in commands.ownerAllowFrom (isConfiguredCommandOwner), never
the wider senderIsOwner bit (operator.admin scope, operator profiles),
and a listed bot account such as a prince stays ambient. Non-owner
ambient discard is unchanged. At a full protected cap the existing
queue-cap refusal already releases the source for retry.

Refs #1564
github-actions Bot pushed a commit to clawhaven/openclaw that referenced this pull request Nov 23, 2026
* fix: preserve user requests during ambient queue overflow

* fix: settle discarded ambient input without delivery scopes

* fix: keep ambient chatter from evicting user requests

OpenClaw-Publication: 4ccedf5d-d860-4b15-85e9-251f70601797

* fix: preserve bounded ambient context during queue overflow

* Publish openclaw/fast-shell

OpenClaw-Publication: 933231df-b944-4a6d-9e8d-becfd2191d99

---------

Co-authored-by: RomneyDa <[email protected]>

Source: 69d6eae

Release adaptation: Selected queue-only production and regressions applied cleanly atop baseline source custody. Required requests displace ambient only, previews bounded to same route and approved text, attach once. Terminal discard uses existing lifecycle adoption without executable backlog. Excluded QA transport/docs/allocation. Later openclaw#193313 broader ingress policy-drop work not imported; baseline unbound payload/custody retained. Formatting/diff checks pass; runtime unavailable due established setup blocker.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 88dc9f72f0e34b12944e155d90d5c884b7f2bbb7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: qa-channel Channel integration: qa-channel docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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]: Ambient room events evict direct mentions from the follow-up queue; evicted mentions are replayed without sender or context

1 participant