Skip to content

fix(gateway): admit reconnect-resumed chat sends like fresh sends - #204669

Merged
obviyus merged 1 commit into
mainfrom
fix/reconnect-resume-admission
Nov 24, 2026
Merged

obviyus merged 1 commit into
mainfrom
fix/reconnect-resume-admission

Conversation

@obviyus

@obviyus obviyus commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

After a Control UI socket reconnect, the first message the owner types carries __controlUiReconnectResume: true. The UI sets this marker on any send whose sessionId matches the resumed session, including new typed input. The cron creator admission in cron-creator-authority-admission.ts treated that marker as "not direct input". So that one turn lost automation management: automations list returned scope=caller total=0 between two scope=gateway total=3 turns (#167867, #194428).

Fix

Each send is admitted on its own when it starts, and queued or replayed input goes through the same admission as new input. So the reconnect marker no longer takes part in the cron creator decision:

  • isReconnectResume is removed from GatewayChatUserTurn, from the chat-send external admission params and from the dispatch call site.
  • The chat admission, the dashboard hand-off follow-up check and the Template-setup admission no longer read it.
  • The marker itself stays. Session-id reuse on resume (auto-reply/reply/session.ts), goal-start rejection, question replacement and the skill-library human-turn flag still read it.

Decision recorded: no new distinction between typed and replayed outbox input. Replayed input is admitted the same as fresh input, by the same owner.

Production code: 3 files, net −5 lines.

Tests

  • chat.directive-tags.test.ts: the lazy configured-MCP cron authority table (moved to the sibling test-support file, next to deniedChatCronAuthorityCases, to keep the file under its line cap) gets a resumed row. A Control UI admin chat.send with __controlUiReconnectResume: true and the session's sessionId must get the same capability as the fresh row. Red on base, green on head.
  • Removed rows that asserted the old narrowing (agent-run-local-operator-authority.test.ts), and the dropped field in fixtures.

Evidence

  • Real Gateway, real model (Z1 harness, case [Bug]: New owner input after Control UI reconnect loses cron management authority despite current admin authentication #167867), head a496e4039557: an admin Control UI client creates 3 automations, then the agent runs automations list on turn A (fresh), turn B (after a socket reconnect, sent with __controlUiReconnectResume: true and the same sessionId), and turn C (fresh). Result: A scope=gateway total=3, B scope=gateway total=3, C scope=gateway total=3. On main 736ec651c262, B was scope=caller total=0.
  • One-admission E2E on head a496e4039557: Q (queued input refused visibly), R (a running turn finishes) and S (Stop cancels) all pass.
  • Red on base: the resumed row of the lazy configured-MCP table fails on merge base e24a2eecffb7 (capability withheld) and passes on head.
  • Pre-push: 20 test files (touched tests, direct importers, test-support importers). All pass except src/cron/service.pr-automation.test.ts (trigger.state is null in the trigger script), which fails the same way on merge base e24a2eecffb7.
  • pnpm tsgo:core, pnpm tsgo:test, oxlint and oxfmt on the changed files: clean.
  • Local ClawSweeper review on a496e4039557: complete, patch is correct, no findings.

- The Control UI reconnect marker no longer narrows the cron creator
  admission of a chat.send turn. Fixes #167867 and #194428.

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

clawsweeper Bot commented Nov 24, 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 gateway Gateway runtime agents Agent runtime and tooling size: S labels Nov 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: a496e4039557ba216cccda9d3048bc1a27cf1040
  • Maintainer: @obviyus
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/server-methods/chat-send-external-authority-contract.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server-methods/cron-creator-authority-admission.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@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. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 24, 2026
@clawsweeper

clawsweeper Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR admits reconnect-marked chat sends through the same existing permission checks as fresh sends.

Example: A Control UI administrator asks for an automation list after reconnecting to the same conversation.

  • Before: The reconnect turn returns scope=caller total=0 between fresh turns returning scope=gateway total=3.
  • After: All three turns return scope=gateway total=3 under the administrator's current admission.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A minimal, coherent repair with reported end-to-end results, a focused regression, and no actionable findings; broad CI remains pending.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The exact-head body supplies real Gateway/model output for authenticated Control UI sends before, during, and after reconnect: all retain gateway scope and three automations; it also reports queued refusal, running-turn completion, and Stop controls.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An authenticated administrator's first message after reconnect can silently lose access to automations in other conversations.
Reason: The maintainer-authored direction resolves the previously disputed replay distinction and restores documented administrator management through the existing owner.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR provides a focused, maintainer-directed fix for reconnect-related automation permission loss that remains on main; no actionable patch defects were found.

Priority: P2
Reviewed head: a496e4039557ba216cccda9d3048bc1a27cf1040

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Gateway receives authenticated chat.send requests, classifies their input source, and issues run-bound automation capabilities consumed by agent tools.

flowchart LR
  A[Control UI send] --> B[Authenticated Gateway request]
  B --> C[Chat admission]
  C --> D[Existing scope and source checks]
  D --> E[Run-bound automation capability]
  E --> F[Automation tool operation]
Loading

Technical review

Best possible solution:

Use the existing admission owner for reconnect-marked sends while preserving current scope, source, session, and run restrictions.

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

The UI marker and current-main rejection establish the failing path directly; the PR also reports a matching live reproduction, which this read-only review did not rerun.

Is this the best way to solve the issue?

This is the smallest complete fix: remove session-reconnect metadata from the existing permission decision and retain the marker for session continuity and its other consumers.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source -5, Tests +1. Total -4 across 8 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 2 7 -5
Tests 5 24 23 +1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 26 30 -4

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.

Root-cause cluster

Relationship: same_root_cause
Canonical: #167867
Summary: This PR addresses the documented reconnect admission exclusion; the broader intermittent-loss report overlaps, while the earlier candidate used a different classification policy.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P2: The fix restores automation management on affected reconnect turns with a limited admission-path change.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The fix restores automation management on affected reconnect turns with a limited admission-path change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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.

Reviewed November 24, 2026, 8:42 AM ET / 13:42 UTC.

@obviyus
obviyus merged commit 24a8e8f into main Nov 24, 2026
150 checks passed
@obviyus
obviyus deleted the fix/reconnect-resume-admission branch November 24, 2026 13:47
@obviyus

obviyus commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as 24a8e8f. A send that follows a Control UI reconnect now goes through the same cron creator admission as any fresh send, so the owner keeps automation management on that turn. Proof: real Gateway reproduction A/B/C all scope=gateway total=3 (B was scope=caller total=0 on main), one-admission E2E Q/R/S pass, CI green, local review clean.

obviyus added a commit that referenced this pull request Nov 24, 2026
… and answer pending questions (#204698)

Related: #167867, #204669

## What Problem This Solves

After the Control UI reconnects its socket, the first message you type carries a reconnect marker (`__controlUiReconnectResume`). Three Gateway checks still read that marker as "this is not fresh input":

1. **Skill authoring:** that one message gets no skill-library grant. If you ask the agent to save or update a skill, `skill_library` answers "Skill authoring needs a fresh message from the person requesting the change." The messages before and after it work.
2. **Pending questions:** while the agent waits on a multi-part, secret or `required_action` question, a steer message normally replaces that question. The first steer after a reconnect does not, so the run stays blocked on the question.
3. **Goal start:** a goal start with the marker is rejected. The Control UI never sends the marker with a goal start, so this refusal cannot be reached.

This is the same class as #204669 (the cron creator admission). Each send is admitted on its own when it starts. The marker must not change what new input can do.

## User Impact

The first message after a reconnect can save or update skills and can replace a pending question, the same as any other message.

## Why This Change Was Made

The three reads are deleted. No new code. Production lines: +2/−5.

Replay dedupe does not depend on the marker: a repeated `idempotencyKey` is answered from the chat-send dedupe cache (`chat-send-pre-admission.ts`).

Kept on purpose: the marker still reaches `chat-user-turn-recorder.ts` → `resumeRequestedSession`, which skips idle/daily session rollover when the reconnecting tab sends the session's current `sessionId` (#89017, "sessions persist after reconnects"). That is a session-lifecycle choice, not admission: it does not change tools, questions, goals or skills. So the marker itself stays.

Accepted edge case: an outbox message typed before a question appeared, and first sent after a reconnect, now also replaces that question, like any other steer.

## Evidence

- **Real Gateway, real model (gpt-5.5), head `66301b8523`:** an admin Control UI client asks the agent to call `skill_library list` on turn A (fresh), turn B (after a socket reconnect, with `__controlUiReconnectResume: true` and the same `sessionId`) and turn C (fresh). All three tool results list the library. On main `4164dcb200af`, turn B returned `{"status":"error","error":"Skill authoring needs a fresh message from the person requesting the change."}`. The check now reads the tool result, not the model's reply.
- **Red on base, green on head:**
  - `chat-send-session-binding.test.ts` › "grants skill authoring to the first message typed after a Control UI reconnect": a direct Control UI admin `chat.send` with the marker and the session's `sessionId` gets `skillLibraryAuthoring`. On merge base `500e19e4490b`: `expected undefined to be defined`.
  - `chat-send-question-replacement.test.ts` › `reconnect-resume` row: a reconnect-resumed steer replaces a pending multi-part question. On merge base: `expected false to be true`.
- Pre-push: 11 test files (touched tests and direct importers of the changed sources), 206 tests, all pass. `pnpm tsgo:core`, `pnpm tsgo:test`, oxfmt and oxlint on the changed files: clean.
- One-admission E2E (Q/R/S) and local review results: see comments.

Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 25, 2026
…04669)

## Problem

After a Control UI socket reconnect, the first message the owner types carries `__controlUiReconnectResume: true`. The UI sets this marker on any send whose `sessionId` matches the resumed session, including new typed input. The cron creator admission in `cron-creator-authority-admission.ts` treated that marker as "not direct input". So that one turn lost automation management: `automations list` returned `scope=caller total=0` between two `scope=gateway total=3` turns (#167867, #194428).

## Fix

Each send is admitted on its own when it starts, and queued or replayed input goes through the same admission as new input. So the reconnect marker no longer takes part in the cron creator decision:

- `isReconnectResume` is removed from `GatewayChatUserTurn`, from the chat-send external admission params and from the dispatch call site.
- The chat admission, the dashboard hand-off follow-up check and the Template-setup admission no longer read it.
- The marker itself stays. Session-id reuse on resume (`auto-reply/reply/session.ts`), goal-start rejection, question replacement and the skill-library human-turn flag still read it.

Decision recorded: no new distinction between typed and replayed outbox input. Replayed input is admitted the same as fresh input, by the same owner.

Production code: 3 files, net −5 lines.

## Tests

- `chat.directive-tags.test.ts`: the lazy configured-MCP cron authority table (moved to the sibling test-support file, next to `deniedChatCronAuthorityCases`, to keep the file under its line cap) gets a `resumed` row. A Control UI admin `chat.send` with `__controlUiReconnectResume: true` and the session's `sessionId` must get the same capability as the fresh row. Red on base, green on head.
- Removed rows that asserted the old narrowing (`agent-run-local-operator-authority.test.ts`), and the dropped field in fixtures.

## Evidence

- Real Gateway, real model (Z1 harness, case #167867), head `a496e4039557`: an admin Control UI client creates 3 automations, then the agent runs `automations list` on turn A (fresh), turn B (after a socket reconnect, sent with `__controlUiReconnectResume: true` and the same `sessionId`), and turn C (fresh). Result: A `scope=gateway total=3`, **B `scope=gateway total=3`**, C `scope=gateway total=3`. On main `736ec651c262`, B was `scope=caller total=0`.
- One-admission E2E on head `a496e4039557`: Q (queued input refused visibly), R (a running turn finishes) and S (Stop cancels) all pass.
- Red on base: the `resumed` row of the lazy configured-MCP table fails on merge base `e24a2eecffb7` (capability withheld) and passes on head.
- Pre-push: 20 test files (touched tests, direct importers, test-support importers). All pass except `src/cron/service.pr-automation.test.ts` (`trigger.state` is null in the trigger script), which fails the same way on merge base `e24a2eecffb7`.
- `pnpm tsgo:core`, `pnpm tsgo:test`, oxlint and oxfmt on the changed files: clean.
- Local ClawSweeper review on `a496e4039557`: complete, patch is correct, no findings.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 24a8e8f)
Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 25, 2026
… and answer pending questions (#204698)

Related: #167867, #204669

## What Problem This Solves

After the Control UI reconnects its socket, the first message you type carries a reconnect marker (`__controlUiReconnectResume`). Three Gateway checks still read that marker as "this is not fresh input":

1. **Skill authoring:** that one message gets no skill-library grant. If you ask the agent to save or update a skill, `skill_library` answers "Skill authoring needs a fresh message from the person requesting the change." The messages before and after it work.
2. **Pending questions:** while the agent waits on a multi-part, secret or `required_action` question, a steer message normally replaces that question. The first steer after a reconnect does not, so the run stays blocked on the question.
3. **Goal start:** a goal start with the marker is rejected. The Control UI never sends the marker with a goal start, so this refusal cannot be reached.

This is the same class as #204669 (the cron creator admission). Each send is admitted on its own when it starts. The marker must not change what new input can do.

## User Impact

The first message after a reconnect can save or update skills and can replace a pending question, the same as any other message.

## Why This Change Was Made

The three reads are deleted. No new code. Production lines: +2/−5.

Replay dedupe does not depend on the marker: a repeated `idempotencyKey` is answered from the chat-send dedupe cache (`chat-send-pre-admission.ts`).

Kept on purpose: the marker still reaches `chat-user-turn-recorder.ts` → `resumeRequestedSession`, which skips idle/daily session rollover when the reconnecting tab sends the session's current `sessionId` (#89017, "sessions persist after reconnects"). That is a session-lifecycle choice, not admission: it does not change tools, questions, goals or skills. So the marker itself stays.

Accepted edge case: an outbox message typed before a question appeared, and first sent after a reconnect, now also replaces that question, like any other steer.

## Evidence

- **Real Gateway, real model (gpt-5.5), head `66301b8523`:** an admin Control UI client asks the agent to call `skill_library list` on turn A (fresh), turn B (after a socket reconnect, with `__controlUiReconnectResume: true` and the same `sessionId`) and turn C (fresh). All three tool results list the library. On main `4164dcb200af`, turn B returned `{"status":"error","error":"Skill authoring needs a fresh message from the person requesting the change."}`. The check now reads the tool result, not the model's reply.
- **Red on base, green on head:**
  - `chat-send-session-binding.test.ts` › "grants skill authoring to the first message typed after a Control UI reconnect": a direct Control UI admin `chat.send` with the marker and the session's `sessionId` gets `skillLibraryAuthoring`. On merge base `500e19e4490b`: `expected undefined to be defined`.
  - `chat-send-question-replacement.test.ts` › `reconnect-resume` row: a reconnect-resumed steer replaces a pending multi-part question. On merge base: `expected false to be true`.
- Pre-push: 11 test files (touched tests and direct importers of the changed sources), 206 tests, all pass. `pnpm tsgo:core`, `pnpm tsgo:test`, oxfmt and oxlint on the changed files: clean.
- One-admission E2E (Q/R/S) and local review results: see comments.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 15b7df3)
Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 25, 2026
…enclaw#204669)

## Problem

After a Control UI socket reconnect, the first message the owner types carries `__controlUiReconnectResume: true`. The UI sets this marker on any send whose `sessionId` matches the resumed session, including new typed input. The cron creator admission in `cron-creator-authority-admission.ts` treated that marker as "not direct input". So that one turn lost automation management: `automations list` returned `scope=caller total=0` between two `scope=gateway total=3` turns (openclaw#167867, openclaw#194428).

## Fix

Each send is admitted on its own when it starts, and queued or replayed input goes through the same admission as new input. So the reconnect marker no longer takes part in the cron creator decision:

- `isReconnectResume` is removed from `GatewayChatUserTurn`, from the chat-send external admission params and from the dispatch call site.
- The chat admission, the dashboard hand-off follow-up check and the Template-setup admission no longer read it.
- The marker itself stays. Session-id reuse on resume (`auto-reply/reply/session.ts`), goal-start rejection, question replacement and the skill-library human-turn flag still read it.

Decision recorded: no new distinction between typed and replayed outbox input. Replayed input is admitted the same as fresh input, by the same owner.

Production code: 3 files, net −5 lines.

## Tests

- `chat.directive-tags.test.ts`: the lazy configured-MCP cron authority table (moved to the sibling test-support file, next to `deniedChatCronAuthorityCases`, to keep the file under its line cap) gets a `resumed` row. A Control UI admin `chat.send` with `__controlUiReconnectResume: true` and the session's `sessionId` must get the same capability as the fresh row. Red on base, green on head.
- Removed rows that asserted the old narrowing (`agent-run-local-operator-authority.test.ts`), and the dropped field in fixtures.

## Evidence

- Real Gateway, real model (Z1 harness, case openclaw#167867), head `a496e4039557`: an admin Control UI client creates 3 automations, then the agent runs `automations list` on turn A (fresh), turn B (after a socket reconnect, sent with `__controlUiReconnectResume: true` and the same `sessionId`), and turn C (fresh). Result: A `scope=gateway total=3`, **B `scope=gateway total=3`**, C `scope=gateway total=3`. On main `d5af0116c7e3`, B was `scope=caller total=0`.
- One-admission E2E on head `a496e4039557`: Q (queued input refused visibly), R (a running turn finishes) and S (Stop cancels) all pass.
- Red on base: the `resumed` row of the lazy configured-MCP table fails on merge base `5bfd560ab5f1` (capability withheld) and passes on head.
- Pre-push: 20 test files (touched tests, direct importers, test-support importers). All pass except `src/cron/service.pr-automation.test.ts` (`trigger.state` is null in the trigger script), which fails the same way on merge base `5bfd560ab5f1`.
- `pnpm tsgo:core`, `pnpm tsgo:test`, oxlint and oxfmt on the changed files: clean.
- Local ClawSweeper review on `a496e4039557`: complete, patch is correct, no findings.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 25, 2026
… and answer pending questions (openclaw#204698)

Related: openclaw#167867, openclaw#204669

## What Problem This Solves

After the Control UI reconnects its socket, the first message you type carries a reconnect marker (`__controlUiReconnectResume`). Three Gateway checks still read that marker as "this is not fresh input":

1. **Skill authoring:** that one message gets no skill-library grant. If you ask the agent to save or update a skill, `skill_library` answers "Skill authoring needs a fresh message from the person requesting the change." The messages before and after it work.
2. **Pending questions:** while the agent waits on a multi-part, secret or `required_action` question, a steer message normally replaces that question. The first steer after a reconnect does not, so the run stays blocked on the question.
3. **Goal start:** a goal start with the marker is rejected. The Control UI never sends the marker with a goal start, so this refusal cannot be reached.

This is the same class as openclaw#204669 (the cron creator admission). Each send is admitted on its own when it starts. The marker must not change what new input can do.

## User Impact

The first message after a reconnect can save or update skills and can replace a pending question, the same as any other message.

## Why This Change Was Made

The three reads are deleted. No new code. Production lines: +2/−5.

Replay dedupe does not depend on the marker: a repeated `idempotencyKey` is answered from the chat-send dedupe cache (`chat-send-pre-admission.ts`).

Kept on purpose: the marker still reaches `chat-user-turn-recorder.ts` → `resumeRequestedSession`, which skips idle/daily session rollover when the reconnecting tab sends the session's current `sessionId` (openclaw#89017, "sessions persist after reconnects"). That is a session-lifecycle choice, not admission: it does not change tools, questions, goals or skills. So the marker itself stays.

Accepted edge case: an outbox message typed before a question appeared, and first sent after a reconnect, now also replaces that question, like any other steer.

## Evidence

- **Real Gateway, real model (gpt-5.5), head `66301b8523`:** an admin Control UI client asks the agent to call `skill_library list` on turn A (fresh), turn B (after a socket reconnect, with `__controlUiReconnectResume: true` and the same `sessionId`) and turn C (fresh). All three tool results list the library. On main `455100f26b1b`, turn B returned `{"status":"error","error":"Skill authoring needs a fresh message from the person requesting the change."}`. The check now reads the tool result, not the model's reply.
- **Red on base, green on head:**
  - `chat-send-session-binding.test.ts` › "grants skill authoring to the first message typed after a Control UI reconnect": a direct Control UI admin `chat.send` with the marker and the session's `sessionId` gets `skillLibraryAuthoring`. On merge base `ab61848f5bfc`: `expected undefined to be defined`.
  - `chat-send-question-replacement.test.ts` › `reconnect-resume` row: a reconnect-resumed steer replaces a pending multi-part question. On merge base: `expected false to be true`.
- Pre-push: 11 test files (touched tests and direct importers of the changed sources), 206 tests, all pass. `pnpm tsgo:core`, `pnpm tsgo:test`, oxfmt and oxlint on the changed files: clean.
- One-admission E2E (Q/R/S) and local review results: see comments.

Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
…04669)

After a Control UI socket reconnect, the first message the owner types carries `__controlUiReconnectResume: true`. The UI sets this marker on any send whose `sessionId` matches the resumed session, including new typed input. The cron creator admission in `cron-creator-authority-admission.ts` treated that marker as "not direct input". So that one turn lost automation management: `automations list` returned `scope=caller total=0` between two `scope=gateway total=3` turns (#167867, #194428).

Each send is admitted on its own when it starts, and queued or replayed input goes through the same admission as new input. So the reconnect marker no longer takes part in the cron creator decision:

- `isReconnectResume` is removed from `GatewayChatUserTurn`, from the chat-send external admission params and from the dispatch call site.
- The chat admission, the dashboard hand-off follow-up check and the Template-setup admission no longer read it.
- The marker itself stays. Session-id reuse on resume (`auto-reply/reply/session.ts`), goal-start rejection, question replacement and the skill-library human-turn flag still read it.

Decision recorded: no new distinction between typed and replayed outbox input. Replayed input is admitted the same as fresh input, by the same owner.

Production code: 3 files, net −5 lines.

- `chat.directive-tags.test.ts`: the lazy configured-MCP cron authority table (moved to the sibling test-support file, next to `deniedChatCronAuthorityCases`, to keep the file under its line cap) gets a `resumed` row. A Control UI admin `chat.send` with `__controlUiReconnectResume: true` and the session's `sessionId` must get the same capability as the fresh row. Red on base, green on head.
- Removed rows that asserted the old narrowing (`agent-run-local-operator-authority.test.ts`), and the dropped field in fixtures.

- Real Gateway, real model (Z1 harness, case #167867), head `a496e4039557`: an admin Control UI client creates 3 automations, then the agent runs `automations list` on turn A (fresh), turn B (after a socket reconnect, sent with `__controlUiReconnectResume: true` and the same `sessionId`), and turn C (fresh). Result: A `scope=gateway total=3`, **B `scope=gateway total=3`**, C `scope=gateway total=3`. On main `736ec651c262`, B was `scope=caller total=0`.
- One-admission E2E on head `a496e4039557`: Q (queued input refused visibly), R (a running turn finishes) and S (Stop cancels) all pass.
- Red on base: the `resumed` row of the lazy configured-MCP table fails on merge base `e24a2eecffb7` (capability withheld) and passes on head.
- Pre-push: 20 test files (touched tests, direct importers, test-support importers). All pass except `src/cron/service.pr-automation.test.ts` (`trigger.state` is null in the trigger script), which fails the same way on merge base `e24a2eecffb7`.
- `pnpm tsgo:core`, `pnpm tsgo:test`, oxlint and oxfmt on the changed files: clean.
- Local ClawSweeper review on `a496e4039557`: complete, patch is correct, no findings.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 24a8e8f)

Companion audit: 15b7df3 and 1ef0005 are later independent lane picks. 35cd392 and 50a7368 change downstream reply waiting/snooze behavior; 5e3065e, 63e0742 and 8027293 are later authority-owner refactors; b5023a7 trims unrelated examples. None are companions to this correction.

Release adaptation: Remove only the transport marker from admitted direct automation provenance; adapt the requester custody fixture without changing its stable delegation or controls.

Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
… and answer pending questions (#204698)

Related: #167867, #204669

After the Control UI reconnects its socket, the first message you type carries a reconnect marker (`__controlUiReconnectResume`). Three Gateway checks still read that marker as "this is not fresh input":

1. **Skill authoring:** that one message gets no skill-library grant. If you ask the agent to save or update a skill, `skill_library` answers "Skill authoring needs a fresh message from the person requesting the change." The messages before and after it work.
2. **Pending questions:** while the agent waits on a multi-part, secret or `required_action` question, a steer message normally replaces that question. The first steer after a reconnect does not, so the run stays blocked on the question.
3. **Goal start:** a goal start with the marker is rejected. The Control UI never sends the marker with a goal start, so this refusal cannot be reached.

This is the same class as #204669 (the cron creator admission). Each send is admitted on its own when it starts. The marker must not change what new input can do.

The first message after a reconnect can save or update skills and can replace a pending question, the same as any other message.

The three reads are deleted. No new code. Production lines: +2/−5.

Replay dedupe does not depend on the marker: a repeated `idempotencyKey` is answered from the chat-send dedupe cache (`chat-send-pre-admission.ts`).

Kept on purpose: the marker still reaches `chat-user-turn-recorder.ts` → `resumeRequestedSession`, which skips idle/daily session rollover when the reconnecting tab sends the session's current `sessionId` (#89017, "sessions persist after reconnects"). That is a session-lifecycle choice, not admission: it does not change tools, questions, goals or skills. So the marker itself stays.

Accepted edge case: an outbox message typed before a question appeared, and first sent after a reconnect, now also replaces that question, like any other steer.

- **Real Gateway, real model (gpt-5.5), head `66301b8523`:** an admin Control UI client asks the agent to call `skill_library list` on turn A (fresh), turn B (after a socket reconnect, with `__controlUiReconnectResume: true` and the same `sessionId`) and turn C (fresh). All three tool results list the library. On main `4164dcb200af`, turn B returned `{"status":"error","error":"Skill authoring needs a fresh message from the person requesting the change."}`. The check now reads the tool result, not the model's reply.
- **Red on base, green on head:**
  - `chat-send-session-binding.test.ts` › "grants skill authoring to the first message typed after a Control UI reconnect": a direct Control UI admin `chat.send` with the marker and the session's `sessionId` gets `skillLibraryAuthoring`. On merge base `500e19e4490b`: `expected undefined to be defined`.
  - `chat-send-question-replacement.test.ts` › `reconnect-resume` row: a reconnect-resumed steer replaces a pending multi-part question. On merge base: `expected false to be true`.
- Pre-push: 11 test files (touched tests and direct importers of the changed sources), 206 tests, all pass. `pnpm tsgo:core`, `pnpm tsgo:test`, oxfmt and oxlint on the changed files: clean.
- One-admission E2E (Q/R/S) and local review results: see comments.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 15b7df3)

Companion audit: da88cb8 selected immediately next for the same fixture cleanup. 1ef0005 is a separate later lane pick; 283b6d7, 50a7368, 5e3065e and 63e0742 introduce unrelated sharing, snooze or authority-owner changes.

Release adaptation: Apply only skillLibrary.isHumanTurn and its directly admitted stable reconnect regression; omit the absent question replacement owner and unrelated goal change.

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

Labels

agents Agent runtime and tooling gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed size: S 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