Skip to content

fix: another person's mid-turn group message is dropped instead of queued - #184846

Draft
obviyus wants to merge 1 commit into
mainfrom
fix/cross-person-input-followup
Draft

obviyus wants to merge 1 commit into
mainfrom
fix/cross-person-input-followup

Conversation

@obviyus

@obviyus obviyus commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #157806

What Problem This Solves

Fixes: in a group chat, a message from a second person is dropped while someone else's turn is running, and the sender gets an admin-facing refusal ("collaborative steering is disabled … resend as /followup").

User Impact

User impact: with the default messages.queue.allowCollaborativeSteering: false, another person's mid-turn message is now queued as their own turn and runs after the current one, under their own identity and current permissions. They see the existing "Your message is queued for a new turn…" notice instead of a refusal. Nothing is dropped, and nobody needs to know about /followup or the config key. Operators who set allowCollaborativeSteering: true keep cross-person steering. Same-requester steering, queue caps, explicit /followup and access checks are unchanged.

Why This Change Was Made

#157806 correctly stopped one person's input from steering another person's execution with that execution's permissions. It enforced that by refusing the input. The same guarantee holds if the input instead becomes the sender's own followup turn, which the existing requester-mismatch followup path already supports. This change routes the disabled-collaboration case into that path on both the channel and chat.send entry points. It also removes the refusal helper, notice and its plumbing.

The session controller still rejects cross-requester injection into a live run. Only the reason changes, to the existing requester_origin_mismatch, so callers queue the followup instead of refusing.

Evidence

Targeted tests (exact head 0eef404, rebased on current main): 128 tests pass across steering fallback, native /steer → followup, chat.send direct followup and steering custody, message injection and the message-join controller. pnpm tsgo:core, oxlint, oxfmt --check and git diff --check are clean. With only the production changes reverse-applied, the new followup assertions fail (3 + 1 + 1 cases).

Live Telegram Test Server userbot proof (details). One DM conversation; the first requester is the Gateway operator (chat.send), the second is the real Telegram user; the mock model is held so the first turn stays active.

elapsed Telegram
30.4 s Telegram user sends a message mid-turn
31.4 s SUT: "Your message is queued for a new turn after the current turn finishes…"
50.9 s SUT replies in the Telegram user's own turn after the first turn is released
  • The held operator turn's model request does not contain the Telegram user's text. Later requests are the user's separate turn.
  • The Gateway logs steering rejected; applying follow-up policy {"reason":"requester-mismatch", … "activeRunId":"proof-operator-turn-1"}.
  • No refusal, /followup hint or config key is shown.

Authority (merge-risk item). The cross-person message now enters the same followup admission that explicit /followup and messages.queue.mode: "followup" already use on main. This PR adds no new admission path and no new authority. At admission the queued turn:

  • runs under the sender's own identity and requester key (asserted in chat-send-direct-followup.test.ts), never Alice's;
  • re-prepares tool and permission policy from current config (prepareReplyRunToolAuthority, followup-turn-execution.ts:380-386);
  • re-checks owner authority (agent-runner-admission.ts:41-43) and operator authority, and a revoked operator authority is consumed without execution (followup-runner.test.ts:514).

Known pre-existing gap, not introduced here. Channel sender access (allowFrom, group access) is decided once at ingress and is not re-evaluated when a queued followup drains. This is true for every queued followup on main today. docs/concepts/session-controller.md says "Authorization policy belongs at ingress", and Telegram's channels.telegram.{dmPolicy,allowFrom,groupAllowFrom,groupPolicy} reload as no-ops "captured at ingress/turn admission" (#146129).

  • A live run confirmed it: removing the user from allowFrom through hot-reload config.patch while their message waited did not stop that queued turn.
  • The narrow fix belongs in the channel message-access owner: a sender-access assertion composed into followup admission, like owner authority. It changes behavior for all queued channel input, so it will ship as a separate PR rather than widening this one.

Data compatibility. The removed collaborative-steering-disabled / collaborative_steering_disabled values lived only in in-memory admission state, transient injection outcomes and a diagnostics reason string.

  • No database row, durable queue entry, receipt or schema stores or parses them.
  • Refused input had no queue or recovery custody (old docs), so existing data cannot contain them.
  • The config key and its persisted Doctor default (false) are unchanged. Omitted, false and true all keep loading; only the runtime behavior of false changes.

Gap: in the chat.send path the queued admission records steering-unavailable rather than requester-mismatch; the user-facing notice is identical.

@clawsweeper

clawsweeper Bot commented Oct 26, 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 gateway Gateway runtime size: L labels Oct 26, 2026
@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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. 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 Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR queues another requester’s mid-turn message as their own followup instead of refusing it when collaborative steering is disabled.

Example: Alice’s turn is running when Bob sends “Check tomorrow’s schedule” with allowCollaborativeSteering set to false.

  • Before: Bob receives a refusal and must resend using /followup.
  • After: Bob receives a queued notice, and his request runs separately after Alice’s turn.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and the live trace establishes its central queueing behavior, but the authority evidence remains incomplete and broad exact-head runtime CI has not run.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Preference · Worth it: Yes · Fix scope: Complete
User problem: Another participant’s message is refused during an active turn, requiring them to understand and resend /followup.
Reason: The prior refusal was intentional, and the collaborator-authored PR supplies the owner decision to replace it with existing requester-separated queueing.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: this collaborator-authored PR addresses a useful group-chat limitation that remains on main, and inspection found no definite introduced code defect.

Priority: P2
Reviewed head: 0eef404122308801e8046339ce3313ab02ffda7c

Before merge

  • Add real behavior proof - Authority-chain proof required: the supplied Telegram Test Server trace demonstrates queue notice, active-turn separation, and a subsequent reply, with a scripted model on the earlier reviewed head; the changed channel fallback remains identical. The current-head Gateway regression checks Bob’s identity and refreshed policy through mocked execution, and the cited revoked-operator test mocks admission failure. Supply production-path evidence of an allowed Bob effect and rejection before I/O after Bob’s operator authority is revoked or reassigned while queued; the disclosed pre-existing allowFrom limitation is not evidence of that rejection. Also demonstrate fresh-install and latest-stable upgrade behavior for omitted, false, and true settings with existing settings and history intact. Redact credentials, IPs, phone numbers, and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Resolve security review attention item - Active-turn isolation remains enforced, while automatic delayed execution makes final-effect authority validation material.

Findings

None.

Tests

  • Missing end-to-end proof: Supply requester-bound allowed and forbidden final-effect evidence, including queued operator revocation or reassignment, plus fresh-install and latest-stable upgrade behavior for omitted, false, and true collaboration settings.
Agent review details

How this fits together

Channel messages and Gateway chat.send requests enter session-controller admission, which either injects compatible input into an active execution or queues a separate requester-owned execution and reply.

flowchart TD
  A[Channel message or chat send] --> B[Session controller admission]
  B --> C[Active requester comparison]
  C --> D[Compatible steering]
  C --> E[Requester followup queue]
  E --> F[Current execution policy]
  F --> G[Separate execution and reply]
Loading

Technical review

Best possible solution:

Use the existing requester-owned followup queue while preserving active-turn isolation, ordering, cancellation, and current-authority checks.

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

Current-main source deterministically refuses identified cross-requester steering with collaboration disabled; the supplied live trace demonstrates the proposed queued behavior, while its baseline runtime attempt failed during setup.

Is this the best way to solve the issue?

This is a focused change to an intentional refusal policy: it reuses established followup admission and removes the replaced refusal path without adding another queue or authority owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

Needs attention: Active-turn isolation remains enforced, while automatic delayed execution makes final-effect authority validation material.

Evidence

What I checked:

PR surface

Source -234, Tests -87, Docs -6, Generated 0. Total -327 across 29 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 16 31 265 -234
Tests 7 112 199 -87
Docs 5 22 28 -6
Config 0 0 0 0
Generated 1 2 2 0
Other 0 0 0 0
Total 29 167 494 -327

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This improves shared-conversation handling with an existing in-product /followup workaround.
  • merge-risk: 🚨 compatibility: Omitted or false collaboration settings now cause automatic later execution instead of refusal, including /steer and /tell; the collaborator-authored PR explicitly accepts that behavior change.
  • merge-risk: 🚨 security-boundary: Previously refused cross-person input gains delayed executable custody, making the sender’s authority at eventual effects material.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

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

  • Add final-effect proof for allowed Bob input and the nearest forbidden principal, including revocation or reassignment while queued before I/O.

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 (1 earlier review cycle)
  • reviewed 2026-10-26T17:48:10.115Z sha 0bcf3e0 :: needs real behavior proof before merge. :: none

Reviewed October 26, 2026, 9:48 PM ET / October 27, 2026, 01:48 UTC (Revision 2).

@obviyus

obviyus commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator Author

Live Telegram proof (Test Server userbot, exact head 0bcf3e02f1a62)

Scenario: a real two-requester mid-turn case in one Telegram DM conversation (agent:main:main). The harness has one QA Telegram user, so the first requester is the Gateway operator (chat.send) and the second is the real Telegram user.

  1. The mock model is held, so the first turn stays active.
  2. The operator starts a turn: gateway call chat.send {"sessionKey":"agent:main:main","message":"OPERATOR_TURN: …","idempotencyKey":"proof-operator-turn-1"}. Result: status: "started".
  3. At 30 s the QA user sends QA_MIDTURN_FROM_TELEGRAM: please reply when you can from Telegram, mid-turn.
  4. At 50 s the hold is released.

The runner was run-mock-sut-user-e2e.mjs --source-gateway --dm --scenario … --timeout-ms 120000, with a Convex-leased credential. The doctor reported ok: true beforehand.

Telegram timeline (SUT events after the sent action):

elapsed event
30.38 s QA user message sent (scenario action 2)
31.43 s SUT: "Your message is queued for a new turn after the current turn finishes. It hasn’t changed the work already in progress."
50.92 s SUT: OPENCLAW_E2E_OK (QA user's own turn, after the operator turn was released)

No refusal notice and no /followup or config-key text was sent.

Model boundary (/v1/responses requests):

Gateway: steering rejected; applying follow-up policy {"reason":"requester-mismatch","disposition":"followup-policy","channel":"telegram","activeRunId":"proof-operator-turn-1"}.

Baseline note: I attempted the same scenario on the base commit (050cb51a504b9), but it was not a valid comparison. That fresh worktree failed to load memory-core, and its operator turn errored before the mid-turn send. Old-code coverage remains the targeted regression tests, which fail on the base and pass here.

Bot ids, usernames and chat ids are omitted.

@obviyus
obviyus force-pushed the fix/cross-person-input-followup branch from 0bcf3e0 to 0eef404 Compare October 27, 2026 01:18
@obviyus

obviyus commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 27, 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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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 Oct 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant