Skip to content

test(auto-reply): pin queued channel restart and collected sender authority (#203464, #203463) - #205757

Merged
obviyus merged 1 commit into
mainfrom
fix/oa2-issue-regressions
Nov 26, 2026
Merged

obviyus merged 1 commit into
mainfrom
fix/oa2-issue-regressions

Conversation

@obviyus

@obviyus obviyus commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Two issues reported possible admission gaps from static reads of main:

Neither has a regression test for the reported scenario.

Change

Test-only. Production code is unchanged (+0/−0).

  1. dispatch-from-config.pending-restart.test.ts: a Discord message is staged by a native-shaped recorder (channel observation sender, channel source turn key, no operator source). The test runs Gateway shutdown preservation, then the real startup replay continueSessionQueuedInputs. The replay ends the row as restart-unrecoverable (as the issue says). Then the durable ingress redelivers the same message under a fresh run id: the recorder reclaims the cancelled row (reclaimCancelledSourceTurn, isRetryableSessionPendingInputEndCause), dispatchReplyFromConfig runs it through normal reply admission, and the transcript holds the message exactly once.
  2. queue.collect-sender-authority.test.ts (new file; queue.collect.test.ts is at its line cap): in one group (collect mode, identity audit on), a guest message without admission evidence is queued, then an owner message with evidence. The guest text never runs in the owner's batch and never runs with senderIsOwner: true.

Why no fix

Evidence

Closes #203463
Closes #203464

…hority (#203464, #203463)

Regression tests for two reported admission gaps; production code unchanged.

Co-authored-by: obviyus <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added the P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. label Nov 26, 2026
@obviyus

obviyus commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

One-admission E2E on exact head aa63024ad82d (isolated Gateway, real model): Q queued input refused visibly ✓, Q refusal sentence in transcript ✓, R running turn finishes ✓, S Stop cancels ✓. verdict.json + results.jsonl: https://gist.github.com/obviyus/9dfe6c3b490daebc5442b456a46e10d1

@obviyus
obviyus merged commit ecd534c into main Nov 26, 2026
123 of 124 checks passed
@obviyus
obviyus deleted the fix/oa2-issue-regressions branch November 26, 2026 05:05
@obviyus

obviyus commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as ecd534c. Test-only: both reported gaps are pinned by regression tests at their owning boundary. #203464: Gateway replay refuses the source-less channel row, then durable ingress redelivery reclaims it and the message is answered once. #203463: the collect authorization key never batches an owner with a non-owner. Both tests are red under a mutation of the guarding code, and green on main. CI green, local review clean, Q/R/S E2E pass on the exact head.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 27, 2026
…hority (openclaw#203464, openclaw#203463) (openclaw#205757)

## Problem

Two issues reported possible admission gaps from static reads of `main`:

- openclaw#203464: a queued channel message could be silently lost after a Gateway restart, because native channel staging saves no operator recovery source and startup replay cancels such a row as `restart-unrecoverable`.
- openclaw#203463: a collected group batch could run with the last sender's owner rights when one message has no channel admission evidence (`resolveCollectedRun` in `src/auto-reply/reply/queue/drain.ts` returns the source run for unknown evidence).

Neither has a regression test for the reported scenario.

## Change

Test-only. Production code is unchanged (+0/−0).

1. `dispatch-from-config.pending-restart.test.ts`: a Discord message is staged by a native-shaped recorder (channel `observation` sender, channel source turn key, no operator source). The test runs Gateway shutdown preservation, then the real startup replay `continueSessionQueuedInputs`. The replay ends the row as `restart-unrecoverable` (as the issue says). Then the durable ingress redelivers the same message under a fresh run id: the recorder reclaims the cancelled row (`reclaimCancelledSourceTurn`, `isRetryableSessionPendingInputEndCause`), `dispatchReplyFromConfig` runs it through normal reply admission, and the transcript holds the message exactly once.
2. `queue.collect-sender-authority.test.ts` (new file; `queue.collect.test.ts` is at its line cap): in one group (collect mode, identity audit on), a guest message without admission evidence is queued, then an owner message with evidence. The guest text never runs in the owner's batch and never runs with `senderIsOwner: true`.

## Why no fix

- openclaw#203464: Discord, Telegram and the other durable-ingress channels keep the message in ingress custody until turn adoption (`docs/concepts/queue.md`, "Channel messages retained by durable ingress remain retryable…"; `ingress-monitor.test.ts` "defers a claimed event across restart drain…"). The Gateway replay refusal is not the end of the message: the redelivery reclaims the row (since openclaw#193602 and openclaw#200533, both before the issue). No OA2 PR changed this; the issue's chain stopped at the Gateway replay and missed the ingress redelivery.
- openclaw#203463: the collect storage key (`resolveFollowupAuthorizationKey`, `src/auto-reply/reply/queue/delivery-context.ts`) includes the requester principal, `senderId`, `senderE164` and `senderIsOwner` (since openclaw#122863 / openclaw#152460). An owner and a non-owner never share a collected claim, so the "return source" branch only sees items with the same sender and owner bit. Making that branch strip authority would remove owner tools from a single owner's batch when identity audit is off (no evidence is minted then), which is a UX regression with no security gain.

## Evidence

- Both tests pass on `main` `cb5ec7a5bab0`.
- Red when the guarding code is removed (local mutation, reverted):
  - `resolveFollowupAuthorizationKey` returning a constant → openclaw#203463 test fails: `expected '[Queued messages while agent was busy…' not to contain 'owner message'`.
  - `isRetryableSessionPendingInputEndCause` without `restart-unrecoverable` → openclaw#203464 test fails: `Pending input idempotency key conflicts with the accepted input` (the redelivered message would be refused).
- One-admission E2E on the exact head `aa63024ad82d`: Q, R, S pass (`verdict.json` + `results.jsonl`: https://gist.github.com/obviyus/9dfe6c3b490daebc5442b456a46e10d1).

Closes openclaw#203463
Closes openclaw#203464

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. size: S

Projects

None yet

1 participant