Repository navigation
refactor(gateway): decide what a turn may do once, as a turn grant - #204756
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: needs changes before merge. What this changesThis PR adds an admission-owned turn grant for owner tools, commands, skill authoring, and pending-question replacement. Example: An admitted operator.admin Control UI client sends /status with commands.allowFrom set to {"*": ["someone-else"]}.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep open: this maintainer-authored PR consolidates admission decisions usefully, but incomplete caller migration and a failing consumer test block merge. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherGateway admission turns authenticated principal facts and scopes into run authority; chat, command, question, and tool owners consume its grant. flowchart TD
A[Authenticated request] --> B[Admission and scope checks]
C[Saved requester source] --> B
B --> D[Admitted authority and turn grant]
D --> E[Commands and owner tools]
D --> F[Skill authoring]
D --> G[Pending question replacement]
Technical reviewBest possible solution: Keep the grant on the existing admission authority, complete constructor and consumer migration, and preserve the saved-source format. Do we have a high-confidence way to reproduce the issue? Current-main source shows the administrator allowlist denial and native/system-provenance question exclusions; the author reports base-failing/head-passing tests, but this read-only review ran no reproduction. Is this the best way to solve the issue? The existing admission authority is the appropriate owner for these decisions, and the maintainer-authored PR explicitly accepts the changed command and narrowing behavior. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b99d3787909e. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +29, Tests +229, Docs +7, Other +267. Total +532 across 45 files. Added test files: 2. View PR surface stats
Preflight sourceSource 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
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 24, 2026, 11:38 AM ET / 16:38 UTC. |
|
E2E verdict (one-admission run.sh, head production code {
"pass": true,
"prefix": "HEAD",
"sessionKey": "agent:main:one-admission-9801cbd2",
"models": [
"gpt-5.5-2026-04-23"
],
"relayStatuses": [
200
],
"checks": [
{
"id": "R.running-turn-finishes",
"pass": true,
"detail": {
"state": "final",
"toolEnds": 3,
"toolEndsAfterRevoke": 3
}
},
{
"id": "Q.queued-input-refused-visibly",
"pass": true,
"detail": {
"accepted": true,
"providerRequestsWithQueuedMarker": 0,
"visibleRefusalInTranscript": true
}
},
{
"id": "S.stop-cancels",
"pass": true,
"detail": {
"abort": {
"ok": true,
"aborted": true,
"runIds": [
"35e52660-f2f7-465f-b3d0-a2a9c015bc50"
]
},
"state": "aborted",
"requestsWithStopMarker": 1
}
}
],
"elapsedMs": 61420
} |
|
Stopped under the two-CI-round rule.
Proposed split:
|
decideTurnGrant in operator-admission.ts is the only producer of the frozen TurnGrant on the admitted operator authority. Control UI turns read it for owner tools, skill authoring, question replacement and commands.allowFrom; the isHumanTurn, client-id, turn-kind, provenance and internal-start branches are gone, and workspace skill authoring no longer re-reads the live role mid-turn. The turn grant matrix runs in the admission table's after-start rows. Lint allowlists and ceilings shrink with the removed readers. Co-authored-by: obviyus <[email protected]>
0690b48 to
aca8f96
Compare
|
E2E on the exact head Z5 reconnect skill case: turns A, B (after reconnect) and C each list {
"pass": true,
"prefix": "HEAD",
"sessionKey": "agent:main:one-admission-7dfadcab",
"models": [
"gpt-5.5-2026-04-23"
],
"relayStatuses": [
200
],
"checks": [
{
"id": "R.running-turn-finishes",
"pass": true,
"detail": {
"state": "final",
"toolEnds": 3,
"toolEndsAfterRevoke": 3
}
},
{
"id": "Q.queued-input-refused-visibly",
"pass": true,
"detail": {
"accepted": true,
"providerRequestsWithQueuedMarker": 0,
"visibleRefusalInTranscript": true
}
},
{
"id": "S.stop-cancels",
"pass": true,
"detail": {
"abort": {
"ok": true,
"aborted": true,
"runIds": [
"513e6ac9-7b6f-4727-b2b2-aead77464731"
]
},
"state": "aborted",
"requestsWithStopMarker": 1
}
}
],
"elapsedMs": 54464
}``` |
|
Landed as 63e0742. Admission now produces one frozen turn grant, and Control UI turns read it for owner tools, skill authoring, question replacement and
|
…4904) ## Problem The same person got a different answer depending on how the turn started (OA2 PR 2, channels). - A Discord or Telegram sender listed in `commands.ownerAllowFrom` got owner-only commands and tools, but no operator authority. Their channel turns ran as System. `github_publish` and other operator tools then refused them ("Inspecting your PR requires your verified linked GitHub account."), while the same owner's Control UI turn passed. The owner cannot fix this by linking: a channel identity cannot be bound to the reserved owner profile. - A linked channel sender got its role's scopes (`operator.admin` in the matrix fixture), while the same person over Tailscale got their `gateway.auth.identityScopes` capped by role. This was the one `KNOWN_DIVERGENT` cell left by #204756. - Channel ingress decided owner status itself (`message-access/runtime.ts` read `isConfiguredCommandOwner` and `prepareCommandOwnerAuthority`). ## Fix - **Admission decides the channel sender.** `src/gateway/operator-admission.ts` now owns the channel sender decision: - `prepareChannelSenderAdmission(sender, getConfig)` gathers the link, the operator profile and the command-owner policy once at ingress. `message-access/runtime.ts` only hands over `ChannelSenderFacts` (`verified` or `asserted`). It leaves the turn-flag allowlist. - `decideChannelOwnerPrincipal(config, sender)`: a **verified** sender in the global `commands.ownerAllowFrom` (wildcard stripped) is the owner principal: owner profile, `operator.admin`, the same grant as the owner's Control UI turn. A sender whose link already yields an operator profile keeps that profile's grant and its recoverable source (round-1 review: scheduled plugin commands and restart need that source). Asserted channels (Signal, WhatsApp, ...) are excluded and keep today's owner-only commands and tools. - **Every start re-checks it.** The admitted authority records the sender as `channelOwner`. Queued and continued work re-admits through `decideOperatorAdmission`, which refuses when the sender left `commands.ownerAllowFrom`, like a revoked linked requester. The authority records no durable source, so restart recovery keeps today's path for these turns (session principal). - **Linked senders:** `resolveLinkedOperatorScopes` uses the socket rule: the verified login's `identityScopes`, capped by role; the role's scopes only when no identity scopes apply. - **Consumers:** `channel-command-user-turn.ts` reads `grant.owner` (leaves the owner-producer allowlist). - **Matrix** (`operator-admission.table.test.ts`): `KNOWN_DIVERGENT` is empty and deleted. New channel cells: configured Discord owner → owner grant (`owner`, `commands: "all"`); allowlisted unlinked guest → no grant; linked person → the Tailscale person's grant. - **Lint allowlists shrink:** turn flags 21 → 20 (`message-access/runtime.ts`), owner producers 52 → 51 (`channel-command-user-turn.ts`). - Docs: `gateway/config-channels/commands.md` states the owner rule. ## Decisions (recorded, not asked) - **Owner rule** (Ayaan, recorded in ONE-ADMISSION-PLAN): verified sender + global `commands.ownerAllowFrom` = owner principal. Everyone in that list gets owner power, including operator tools and PR actions; that list is by definition the owners. Channel/context allowlists never qualify. - **Owner removed while a message is queued:** the queued message is refused at start (same as a revoked linked requester), instead of running without owner power. Rare and visible; the sender sends again. - **Not in this PR** (kept, cut less): the channel cron-creator mint (`get-reply-run.cron-requester.ts`; needs `grant.automations`), Telegram/Discord native slash-command allowlist composition (a list-membership fact, read before any turn exists), `github_publish` requester re-checks (PR 3), restart/durable sources for channel owners (PR 4). `channel-operator-authority.ts` stays in `ADMISSION_FILES`: its live-identity checks still read role policy. ## User impact - A Discord or Telegram owner configured in `commands.ownerAllowFrom` gets the same permissions in the channel as in the Control UI, with no Control UI step. - A linked channel sender gets the same scopes as that person over the Control UI. ## Evidence - **Production lines:** `src` + `extensions` (non-test) +139 / −93. Not net negative: the owner principal is new behavior Ayaan asked for (decision recorded in the one-admission plan). The gather/decide move out of `message-access/runtime.ts` is net zero; the rest is the decision, its replay re-check and the `channelOwner` fact. - **Matrix, head** (`operator-admission.table.test.ts`, real Gateway, 5 boots): 151/151 passed, including the channel owner cell, the guest cell and the linked-person cell. - **Red on base `48f162d64bc8`** (head tests against base code): linked-person cell fails (`fresh: { owner: true }` vs the Tailscale person's `owner: false`); configured-owner cell fails (base admits the configured owner with no operator authority, so its queued work is never re-admitted against the owner list). - **Pre-push:** one `ocx test` call over 151 importer/touched files: 1 failure, `chat-send-pending-input-withdrawal.test.ts` "settles queued input (restart, restart, discard: false)", which also fails on base `48f162d64bc8` (not ours). `pnpm tsgo:core`, `pnpm tsgo:test`, oxlint, boundary-guard lint and oxfmt clean. `pnpm check:changed`: all lanes ok after removing a now-unused export it flagged. - **E2E:** `one-admission-e2e/run.sh` on heads `e329c508d869`, `a804c9d7c2de` and `6177d4488f81`: Q (queued input refused visibly), R (running turn finishes) and S (Stop cancels) all pass (`verdict.json` + `results.jsonl` kept in the task proof directory). - **Discord ingress proof:** the matrix channel rows run the real Discord identity declaration (`verified`), the real `message-access/runtime.ts` ingress and the real host context builder against a real Gateway, queue and agent run. A live Discord QA-bot run was not used: QA-bot readiness passed, but in this PR nothing user-visible in Discord differs between a configured owner on base and on head (owner-only tools and `/status` already worked there through the owner flag). The visible difference, `github_publish` for a Discord owner, lands with PR 3, which owns the live Discord run. Co-authored-by: Ayaan Zaidi <[email protected]>
…penclaw#204756) ## Problem The same person got a different answer depending on how the turn started: - A Control UI steer from a native app, or one sent with system provenance, could not replace a pending question. - An `operator.admin` client outside `commands.allowFrom` was refused slash commands (openclaw#198259). - Skill authoring read `isHumanTurn` on chat.send and a list of internal start kinds on the agent RPC. Same-person internal turns got the false refusal "Skill authoring needs a fresh message". - Workspace skill authoring re-read the live role in the middle of a turn. ## Fix This is OA2 PR 1b. It builds on the lint guard from openclaw#204823. Admission now decides what a turn may do, and the Control UI entry kinds read that decision. - **`TurnGrant`** (`owner`, `skillAuthoring`, `questionReplace`, `commands`) is a frozen field on `AdmittedRunOperatorAuthority`. Only `decideTurnGrant(scopes)` in `src/gateway/operator-admission.ts` produces it. - Every authority constructor calls it: replay `decide`, fresh Gateway admission, channel capture and continuation narrowing. - It is in memory only, so no schema changes. A replay admits again from its recorded source. - **Owner tools** (`dangerous-tools.ts`) and the **transcript owner stamp** (`chat-user-turn-recorder.ts`) read `grant.owner`, which is `operator.admin` in the admitted scopes. - **Commands:** chat.send puts the grant on the command context as `TurnGrant`. - `grant.commands === "all"` (`operator.admin`) passes `commands.allowFrom`, per Ayaan's decision. Non-admins keep the list and its visible refusal. - `TurnGrant` is trusted only on the internal provider, like `GatewayClientScopes`. - Docs are updated (`tools/slash-commands`, `gateway/config-channels/commands`). - **Skill authoring:** deleted `isHumanTurn`, `canPrepareSkillAuthoring` and the agent RPC internal-start list. `grant.skillAuthoring` decides. - The client checks stay: in-process runtime callers carry no attributed person. - Workspace authoring reads `grant.owner` instead of re-reading the role mid-turn. - Also deleted the mid-preparation "requester changed" scope re-check. - `skill-library-authoring.ts` leaves `ADMISSION_FILES`. - **Question replacement:** deleted the Control UI client-id, `turnKind`, provenance and internal re-entry gates. `grant.questionReplace` plus the request shape (steer, non-command, pending question) decide. - **Lint allowlists shrink:** - `ADMISSION_FILES` 63 → 62; - turn-kind flags 24 → 21 (`chat-send-input-dispatch`, `chat-send-agent-dispatch.types`, `skill-library-authoring`); - owner producers 53 → 52 (`chat-user-turn-recorder`); - capability provenance 5 → 4 (`chat-send-question-replacement`). - **Matrix:** the admission table's real-Gateway `after-start` rows now also check the grant at fresh admission and at saved-source replay. Cells: Control UI token, password, OpenClaw ID owner, Tailscale, Tailscale device and trusted proxy; CLI via Gateway; Discord linked identity. - `KNOWN_DIVERGENT` is shrink-only, with a ceiling. Its one entry: a linked Discord sender gets its role's scopes while the same person over Tailscale gets `identityScopes`. PR 2 fixes it. ## Decisions (recorded, not asked) - **Owner:** `grant.owner` is `operator.admin` in the admitted scopes. Saved channel and parent-bound command ownership stays in `requesterOwner`, read only by scheduled occurrences, until PR 2 (verified configured channel owner) and PR 4 (parent-bound sources). The round-2 review of the earlier head found that putting that fact in the grant would give owner-only tools to a read/write channel command owner. - **Internal starts:** same-person internal starts (agent RPC internal events, approval follow-ups, re-entries with handler options) now get the grant their admission produced. The skill tool shape is already stable per session, so the provider request does not change. The client checks still exclude in-process runtime callers. - **Read-only steer:** a read-only client no longer replaces a pending question (`questionReplace` needs `operator.sessions.write`). - **Narrowing:** a continuation that narrows scopes re-derives its grant from the narrowed scopes. - **Deferred:** `grant.automations` (the cron-creator classifier) and moving the fresh-turn decision out of `operator-run-authority.ts` go in a later PR. `prActions` comes with PR 3. ## User impact - An admin on Control UI or WebChat can run slash commands even when `commands.allowFrom` does not list it. - A steer from any client with session write (native app, system-provenance turn, reconnect) can replace an ordinary pending question. - Same-person internal turns no longer get the false "Skill authoring needs a fresh message" refusal. - Owner tools, the transcript owner stamp and workspace skill authoring follow one admission decision. ## Evidence - **Production lines:** `src` (non-test) +109 / −110. - **Red on base `d96b6e90fee5`** (head tests run against base code): question replacement from a native app, a system-input turn, and the read-only case; `/status` for an admitted admin outside `commands.allowFrom`. All four fail on base and pass on head. - **Matrix:** on the earlier head, all 8 cells passed and the one `KNOWN_DIVERGENT` cell still diverged. The admission table also passed. - **E2E `one-admission-e2e/run.sh`:** Q, R and S all pass. Q: queued input refused visibly. R: a running turn finishes. S: Stop cancels. - **Z5 reconnect skill case:** turns A, B and C each list `skill_library`. - **Z1 openclaw#167867 case:** turns A, B and C each see `scope=gateway total=3`. - **Failing on base too (not ours):** `subagent-registry.requester-wake.e2e` (6 receipt cases time out) and `reef-shutdown.gateway`. Co-authored-by: Ayaan Zaidi <[email protected]>
…nclaw#204904) ## Problem The same person got a different answer depending on how the turn started (OA2 PR 2, channels). - A Discord or Telegram sender listed in `commands.ownerAllowFrom` got owner-only commands and tools, but no operator authority. Their channel turns ran as System. `github_publish` and other operator tools then refused them ("Inspecting your PR requires your verified linked GitHub account."), while the same owner's Control UI turn passed. The owner cannot fix this by linking: a channel identity cannot be bound to the reserved owner profile. - A linked channel sender got its role's scopes (`operator.admin` in the matrix fixture), while the same person over Tailscale got their `gateway.auth.identityScopes` capped by role. This was the one `KNOWN_DIVERGENT` cell left by openclaw#204756. - Channel ingress decided owner status itself (`message-access/runtime.ts` read `isConfiguredCommandOwner` and `prepareCommandOwnerAuthority`). ## Fix - **Admission decides the channel sender.** `src/gateway/operator-admission.ts` now owns the channel sender decision: - `prepareChannelSenderAdmission(sender, getConfig)` gathers the link, the operator profile and the command-owner policy once at ingress. `message-access/runtime.ts` only hands over `ChannelSenderFacts` (`verified` or `asserted`). It leaves the turn-flag allowlist. - `decideChannelOwnerPrincipal(config, sender)`: a **verified** sender in the global `commands.ownerAllowFrom` (wildcard stripped) is the owner principal: owner profile, `operator.admin`, the same grant as the owner's Control UI turn. A sender whose link already yields an operator profile keeps that profile's grant and its recoverable source (round-1 review: scheduled plugin commands and restart need that source). Asserted channels (Signal, WhatsApp, ...) are excluded and keep today's owner-only commands and tools. - **Every start re-checks it.** The admitted authority records the sender as `channelOwner`. Queued and continued work re-admits through `decideOperatorAdmission`, which refuses when the sender left `commands.ownerAllowFrom`, like a revoked linked requester. The authority records no durable source, so restart recovery keeps today's path for these turns (session principal). - **Linked senders:** `resolveLinkedOperatorScopes` uses the socket rule: the verified login's `identityScopes`, capped by role; the role's scopes only when no identity scopes apply. - **Consumers:** `channel-command-user-turn.ts` reads `grant.owner` (leaves the owner-producer allowlist). - **Matrix** (`operator-admission.table.test.ts`): `KNOWN_DIVERGENT` is empty and deleted. New channel cells: configured Discord owner → owner grant (`owner`, `commands: "all"`); allowlisted unlinked guest → no grant; linked person → the Tailscale person's grant. - **Lint allowlists shrink:** turn flags 21 → 20 (`message-access/runtime.ts`), owner producers 52 → 51 (`channel-command-user-turn.ts`). - Docs: `gateway/config-channels/commands.md` states the owner rule. ## Decisions (recorded, not asked) - **Owner rule** (Ayaan, recorded in ONE-ADMISSION-PLAN): verified sender + global `commands.ownerAllowFrom` = owner principal. Everyone in that list gets owner power, including operator tools and PR actions; that list is by definition the owners. Channel/context allowlists never qualify. - **Owner removed while a message is queued:** the queued message is refused at start (same as a revoked linked requester), instead of running without owner power. Rare and visible; the sender sends again. - **Not in this PR** (kept, cut less): the channel cron-creator mint (`get-reply-run.cron-requester.ts`; needs `grant.automations`), Telegram/Discord native slash-command allowlist composition (a list-membership fact, read before any turn exists), `github_publish` requester re-checks (PR 3), restart/durable sources for channel owners (PR 4). `channel-operator-authority.ts` stays in `ADMISSION_FILES`: its live-identity checks still read role policy. ## User impact - A Discord or Telegram owner configured in `commands.ownerAllowFrom` gets the same permissions in the channel as in the Control UI, with no Control UI step. - A linked channel sender gets the same scopes as that person over the Control UI. ## Evidence - **Production lines:** `src` + `extensions` (non-test) +139 / −93. Not net negative: the owner principal is new behavior Ayaan asked for (decision recorded in the one-admission plan). The gather/decide move out of `message-access/runtime.ts` is net zero; the rest is the decision, its replay re-check and the `channelOwner` fact. - **Matrix, head** (`operator-admission.table.test.ts`, real Gateway, 5 boots): 151/151 passed, including the channel owner cell, the guest cell and the linked-person cell. - **Red on base `4061fdbf46e5`** (head tests against base code): linked-person cell fails (`fresh: { owner: true }` vs the Tailscale person's `owner: false`); configured-owner cell fails (base admits the configured owner with no operator authority, so its queued work is never re-admitted against the owner list). - **Pre-push:** one `ocx test` call over 151 importer/touched files: 1 failure, `chat-send-pending-input-withdrawal.test.ts` "settles queued input (restart, restart, discard: false)", which also fails on base `4061fdbf46e5` (not ours). `pnpm tsgo:core`, `pnpm tsgo:test`, oxlint, boundary-guard lint and oxfmt clean. `pnpm check:changed`: all lanes ok after removing a now-unused export it flagged. - **E2E:** `one-admission-e2e/run.sh` on heads `e329c508d869`, `a804c9d7c2de` and `6177d4488f81`: Q (queued input refused visibly), R (running turn finishes) and S (Stop cancels) all pass (`verdict.json` + `results.jsonl` kept in the task proof directory). - **Discord ingress proof:** the matrix channel rows run the real Discord identity declaration (`verified`), the real `message-access/runtime.ts` ingress and the real host context builder against a real Gateway, queue and agent run. A live Discord QA-bot run was not used: QA-bot readiness passed, but in this PR nothing user-visible in Discord differs between a configured owner on base and on head (owner-only tools and `/status` already worked there through the owner flag). The visible difference, `github_publish` for a Discord owner, lands with PR 3, which owns the live Discord run. Co-authored-by: Ayaan Zaidi <[email protected]>
…204904) Bounded release port of the linked-sender scope rule from #204904: a linked channel sender now gets the verified login's gateway.auth.identityScopes capped by its role, and the role's scopes only when no identity scopes apply, the same rule as a socket connection. Previously the role's scopes won outright, so a linked maintainer whose identity only grants operator.write still received channel operator.admin. Release adaptation for 2026.11.11: #204904 also moves channel-sender admission into the one-admission turn grant (#204756) and makes commands.ownerAllowFrom channel senders the owner principal. That architecture is absent here and the owner principal is new privilege behavior, so both are excluded. Adds a regression test in operator-role-policy.test.ts. (cherry picked from commit e2a9a6d) Co-authored-by: Ayaan Zaidi <[email protected]> Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]>
## Problem Fixes #198259. On a Gateway with `gateway.auth.mode=password` and `commands.allowFrom: {"*": [...]}`, the owner's Control UI `/status` (and every other text command) returned `started`, then a final with no assistant message. The command gate (`rejectUnauthorizedCommand`) replied only to native commands; every other denial was silent. Thirteen commands (`/status`, `/help`, `/commands`, `/skill`, `/context`, `/usage`, `/fast`, `/session`, `/diagnostics`, `/agents`/`/subagents`, `/tts`, `/whoami`, `/restart`, `/update`) also set `silentUnauthorized`, which dropped the native refusal too. ## Fix - `command-gates.ts` is the one owner of the denial outcome: - Gateway clients (Control UI, WebChat, CLI) get a refusal that names the policy and the next step: add the Gateway user profile ID to `commands.allowFrom`, or move the `"*"` entries to per-channel keys so Control UI commands follow operator access. - Native commands get the existing refusal for every command. - Text commands from external channel senders stay silent, so strangers in shared chats get no reply. This is the recorded intentional non-outcome. - Deleted the `silentUnauthorized` option and its 13 uses. - Docs (`docs/tools/slash-commands.md`): password/token Control UI clients have no user identity, and how to keep their commands available. Supersedes the denial part of #198874 (draft, maintainer edits off). Thanks @RomneyDa for the first cut of the visible WebChat refusal. ## Owner identity: no change (policy question) The issue asks that the password owner (`gateway-owner`) pass `commands.allowFrom`. The docs are not silent here: since #144601 they say "A shared owner profile used only for attribution does not grant this access." Every holder of the shared password or token gets that profile, so making it matchable would admit them all. This PR keeps that rule and does not add an owner bypass. The documented route for the reporter: list channel senders under per-channel keys and omit `"*"`; Control UI commands then follow operator scopes. Open policy question for @obviyus: should `operator.admin` Gateway clients pass `commands.allowFrom` (today the list is the only authority when set)? Default kept: no. ## User impact - Control UI owner denied by `commands.allowFrom`: sees why and what to change, instead of nothing. - Native `/status`, `/help` and the others from a denied sender: see "You are not authorized to use this command." instead of no response (Discord shows "did not respond" otherwise). - External channel text senders: unchanged (silent). ## Evidence - Red on base `e24a2eecffb7`, green on head: `commands-info.test.ts` "denied /status" (Control UI owner refusal names `commands.allowFrom`; native refusal). Silence for external text senders and the per-channel-key route pass on both. - Pre-push: touched tests + importers of every changed source (15 files), `tsgo:core`, `tsgo:test`, oxfmt, oxlint. - Head E2E `9f42a4647b`, isolated password-auth Gateway from source, Control UI client (`operator.admin`, password), `chat.send /status`: - `commands.allowFrom: {"*": ["someone-else"]}` (the issue config): base `736ec651c262` gave `started`, then a final with no assistant message; head replies with the refusal that names `commands.allowFrom`. - `commands.allowFrom: {"telegram": ["someone-else"]}` (the documented route): `/status` returns the full status card. - One-admission E2E on head (queued refusal, running turn finishes, Stop cancels): Q, R, S pass. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 7f5ec42) Companion audit: The approval context follow-up f57a179 is separately selected. #204756 is a main-only authority refactor, #205780 adds the /context budget card, and #207006 changes loop test scaffolding; none is needed for baseline denial. #144601 verified-sender matching is already an ancestor of the pinned baseline. Co-authored-by: RomneyDa <[email protected]>
Problem
The same person got a different answer depending on how the turn started:
operator.adminclient outsidecommands.allowFromwas refused slash commands (commands.allowFrom silently denies ALL WebChat/Control UI slash commands on password-auth gateways (empty senderCandidates) #198259).isHumanTurnon chat.send and a list of internal start kinds on the agent RPC. Same-person internal turns got the false refusal "Skill authoring needs a fresh message".Fix
This is OA2 PR 1b. It builds on the lint guard from #204823. Admission now decides what a turn may do, and the Control UI entry kinds read that decision.
TurnGrant(owner,skillAuthoring,questionReplace,commands) is a frozen field onAdmittedRunOperatorAuthority. OnlydecideTurnGrant(scopes)insrc/gateway/operator-admission.tsproduces it.decide, fresh Gateway admission, channel capture and continuation narrowing.dangerous-tools.ts) and the transcript owner stamp (chat-user-turn-recorder.ts) readgrant.owner, which isoperator.adminin the admitted scopes.TurnGrant.grant.commands === "all"(operator.admin) passescommands.allowFrom, per Ayaan's decision. Non-admins keep the list and its visible refusal.TurnGrantis trusted only on the internal provider, likeGatewayClientScopes.tools/slash-commands,gateway/config-channels/commands).isHumanTurn,canPrepareSkillAuthoringand the agent RPC internal-start list.grant.skillAuthoringdecides.grant.ownerinstead of re-reading the role mid-turn.skill-library-authoring.tsleavesADMISSION_FILES.turnKind, provenance and internal re-entry gates.grant.questionReplaceplus the request shape (steer, non-command, pending question) decide.ADMISSION_FILES63 → 62;chat-send-input-dispatch,chat-send-agent-dispatch.types,skill-library-authoring);chat-user-turn-recorder);chat-send-question-replacement).after-startrows now also check the grant at fresh admission and at saved-source replay. Cells: Control UI token, password, OpenClaw ID owner, Tailscale, Tailscale device and trusted proxy; CLI via Gateway; Discord linked identity.KNOWN_DIVERGENTis shrink-only, with a ceiling. Its one entry: a linked Discord sender gets its role's scopes while the same person over Tailscale getsidentityScopes. PR 2 fixes it.Decisions (recorded, not asked)
grant.ownerisoperator.adminin the admitted scopes. Saved channel and parent-bound command ownership stays inrequesterOwner, read only by scheduled occurrences, until PR 2 (verified configured channel owner) and PR 4 (parent-bound sources). The round-2 review of the earlier head found that putting that fact in the grant would give owner-only tools to a read/write channel command owner.questionReplaceneedsoperator.sessions.write).grant.automations(the cron-creator classifier) and moving the fresh-turn decision out ofoperator-run-authority.tsgo in a later PR.prActionscomes with PR 3.User impact
commands.allowFromdoes not list it.Evidence
src(non-test) +109 / −110.23e252373e9b(head tests run against base code): question replacement from a native app, a system-input turn, and the read-only case;/statusfor an admitted admin outsidecommands.allowFrom. All four fail on base and pass on head.KNOWN_DIVERGENTcell still diverged. The admission table also passed.one-admission-e2e/run.sh: Q, R and S all pass. Q: queued input refused visibly. R: a running turn finishes. S: Stop cancels.skill_library.scope=gateway total=3.subagent-registry.requester-wake.e2e(6 receipt cases time out) andreef-shutdown.gateway.