Repository navigation
refactor(channels): admit channel senders through the turn grant - #204904
Conversation
- Channel ingress hands sender facts to admission (prepareChannelSenderAdmission); a verified sender in commands.ownerAllowFrom is the owner principal with the owner's Control UI grant. - Every start re-checks the owner list; the owner authority records no durable source. - Linked senders get identityScopes capped by role, as on a socket. - Matrix: KNOWN_DIVERGENT is empty and removed; channel owner and guest cells added. Co-authored-by: obviyus <[email protected]>
|
🦞👀 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. |
|
- A verified owner whose link already yields an operator profile keeps that profile, so scheduled plugin commands and restart keep its recoverable channel source. Co-authored-by: obviyus <[email protected]>
|
Rejected review findings:
|
…grant # Conflicts: # src/gateway/operator-admission.ts
|
Maintainer override: the one red job is not caused by this PR.
|
|
Codex review: needs maintainer review before merge. What this changesThis PR centralizes channel sender admission, grants verified configured owners operator authority, and caps linked senders by their identity scopes. Example: Discord sender 123456789012345678 appears in commands.ownerAllowFrom and has no linked profile.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR implements an approved channel-admission change that current main lacks; no actionable code defect was established. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherChannel ingress supplies authenticated sender facts to Gateway admission, which produces the authority consumed by commands, agent tools, and queued starts. flowchart TD
A[Channel message] --> B[Verified sender facts]
B --> C[Gateway admission]
D[Owner list and linked profile] --> C
C --> E[Frozen turn grant]
E --> F[Commands and agent tools]
E --> G[Queued start]
G --> C
Technical reviewBest possible solution: Keep admission as the sole grant owner, preserve linked recovery sources, and retain the documented boundary between verified and asserted senders. Do we have a high-confidence way to reproduce the issue? Current-main source requires a linked requester for channel operator authority and gives linked senders role scopes ahead of identity scopes; the PR reports corresponding red-on-base matrix cases, but no reproduction was run during this read-only review. Is this the best way to solve the issue? The change uses the existing admission, grant, and recovery owners without adding parallel machinery; the retained helpers serve distinct preparation and decision boundaries, and the changed tests cover distinct owner, guest, linked-scope, and queued-revocation behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3f4e2bd3a4c6. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +43, Tests -2, Docs +1, Other -2. Total +40 across 16 files. Added test files: 0. 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. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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, 5:07 PM ET / 22:07 UTC. |
|
Landed as e2a9a6d. A verified Discord or Telegram sender in |
Release adaptation: Backport only the linked identity/role ceiling intersection using the release authority owner. Keep existing ingress, command-owner, queue and recovery behavior. Cover both ceilings through the release verified-channel ingress fixture. (cherry picked from commit e2a9a6d) Co-authored-by: Ayaan Zaidi <[email protected]> Co-authored-by: RomneyDa <[email protected]>
…04978) ## Problem `github_publish` re-derived the caller's rights at tool time instead of using what the turn was admitted with (OA2 PR 3, DESIGN §9 row 3). - The agent tool reaches the Gateway as the in-process System client with the method's least scopes (`operator.sessions.write` for `edit`, `inspect_pr`, `prepare_pr`, `refresh_base`). `prepareGitHubPublicationRequesterV2` re-ran operator admission on that client, so the requester snapshot was the turn's scopes narrowed to the method minimum, and `github-publication-actions.ts` intersected again with the caller's scopes. - Result: the Gateway owner or an admin, in any entry kind (Control UI, Discord owner, Telegram owner, linked channel sender), lost operator write for sessions-write actions. Editing a PR in a conversation they did not start was refused ("The original GitHub publication requester is no longer authorized."). - The requester also re-read the session's `createdActor`/`owner` on every `assertCurrent()`, a mid-run authority re-check. - Refusals named a fix that does not apply: "Inspecting your PR requires your verified linked GitHub account." for a conversation with no operator identity, "…require full operator write permission." with no next step. ## Fix - **Requester from the turn grant.** A tool call builds its requester snapshot from the calling turn's admitted authority (`resolveGatewayToolOperatorSelection().operatorAuthority`): same profile, same scopes. A direct Gateway request (Control UI button, RPC) is still admitted once by `prepareGatewayOperatorRunAuthority`. - **One rights rule.** `captureGitHubPublicationActionAuthority` returns the requester's scopes; a tool turn without an operator principal (System) holds no PR rights, as before. `github-publication-actions.ts` uses it for lifecycle actions; the `actionScopes` intersection is gone. - **Deleted re-checks:** `options.sessionMutationAuthorization.assertCurrent()` and the `hasCurrentClientAuthority` check at requester preparation; the `createdActor`/`owner` re-read in `prepareRequesterPolicy.assertCurrent` and in the task-requester `assertCurrent` (plus its profile re-read); the caller-selection re-check in the action authority. - **Refusal texts name the next step:** - no operator identity: "This conversation has no Gateway operator identity, so it cannot inspect PRs. A Gateway owner adds this sender to commands.ownerAllowFrom; anyone else asks an admin to link this channel account to their Gateway profile, then retries." - no linked GitHub: "Link your GitHub account once in the Control UI under Settings → Profile → Identity, on the configured GitHub host, then retry the inspection." - lifecycle without write: "The merge action needs operator write permission. Ask a Gateway admin to run it, or to give your role operator.write." - requester refused: "This requester is not authorized to publish from this conversation." (next action: publish from a conversation you started and can write to, or ask a Gateway admin). ### `assertCurrent()` calls in `github-publication-actions.ts` | Call | Before | After | |---|---|---| | `preparePublishingSession(…, () => sessionMutationAuthorization.assertCurrent())` | authority re-check | **deleted**; replaced by `signal.throwIfAborted()` (Stop) | | `target.assertCurrent()` | target relation / session revision | kept (data fence) | | `admitted.requester.assertCurrent()` | requester policy re-read (role, `createdActor`, `owner`) + Stop | kept; now only Stop + session id/lifecycle revision (data) | | write-scope check inside `assertRequester` (ran before every step) | authority re-check | **moved** to one check at action start | | `inspection?.assertCurrent()` | inspection receipt / head | kept (data) | | composite `assertCurrent()` ×5 (evidence prepare, effect, present, read failure) | requester + identity + inspection | kept; requester part is now Stop + revision only | Kept data fences unchanged: requestId/head receipts, `expectedHeadCommit`, evidence receipt, metadata CAS, attribution freshness. ## Decisions (recorded, not asked) - **Accepted edge:** a role revoked or a session reassigned while a turn runs no longer stops a PR action inside that turn; the next turn is admitted against current policy (AGENTS.md "a started request may finish"). Stop still cancels. - **A tool call with no turn grant** (only test fixtures; production in-process tool calls always arrive as the System client) falls back to admitting the client, which for the System client is no principal. - **Tests deleted (assert removed behavior):** `github-personal-publication-outcomes` "does not resume shared GitHub writes after the RPC session changes owner" (mid-run owner re-check); `github-pr-workspace-preparation` "refuses a maintainer's narrowed/missing selected authority" and two `github-publication-workflows` cases ("narrowed" tool, "admin" via `gateway-session` scopes) — these assert that the tool bridge's method scopes narrow the turn's rights; `session-pr-workspace-adoption` no longer expects an admin assist to be refused. - `github-publication-requester.ts` stays in `ADMISSION_FILES`: restart recovery (`restoreGitHubPublicationRequester`) still re-admits a stored requester against the current role. Moving that into `decideOperatorAdmission` is PR 4 (replays). ## User impact - The owner and admins get the same `github_publish` rights from every entry kind as their turn grant says: they can edit, prepare and refresh PRs in conversations they did not start. - Members keep own-conversation rights; lifecycle actions still need `operator.write`. Guests and turns with no operator identity get nothing, with a refusal that says what to do. ## Evidence - **Production lines** (`src`, non-test): +49 / −66 (net −17). - **Matrix** (`src/gateway/github-publication-turn-grant.test.ts`, new): owner × {Control UI, Discord owner, Telegram owner}, admin × {Control UI, linked channel}, member × {Control UI, linked channel}, guest × {Control UI, linked channel}; each cell runs `inspect`, `edit` and `merge` through the real `github_publish` tool and `sessions.github.action` handler with the System bridge client the in-process dispatch uses. Head 9/9. **Base `e2a9a6d6f3e8`: owner × Control UI / Discord owner / Telegram owner and admin × Control UI / linked channel fail** (`edit` refused "The original GitHub publication requester is no longer authorized."); member and guest cells pass on both. - **Live Discord (QA Lab, Convex-leased bots, isolated Gateway, live `openai/gpt-5.6-luna`, Docker sandbox, no Control UI step):** the driver bot is the configured verified owner (`commands.ownerAllowFrom`), mentions the SUT and asks it to resolve the merge conflict on a scratch PR. Head: `prepare_pr` → base merge → publish; the PR went from `CONFLICTING` to `MERGEABLE`/`CLEAN`; pushed merge commit `9fd180559e7b` ("Merge selected base main") and publish commit `af7c3714887a`. The Discord transcript and tool trace are kept in the task proof directory. - **Base, same run:** also succeeded (pushed `4147b28a4722`). #204904 already admits the configured Discord owner with operator authority, and in their own Discord conversation the owner is the conversation's creator, so the narrowed scopes still pass. A live title edit through `edit` + `pullRequestUrl` also passed on base. The base-red difference is the matrix case above: owner/admin acting in a conversation they did not start. - **Pre-push:** one `ocx test` call over 49 files (touched tests plus importer tests of every changed source and test-support file): 886 passed, 0 failed. `pnpm tsgo:core`, `pnpm tsgo:test`, oxfmt and oxlint clean; `pnpm check:changed` all lanes ok after deleting a now-unused test-support export. - **E2E Q/R/S** (`one-admission-e2e/run.sh` on `982f3b6e4578`): Q queued input refused visibly, R running turn finishes after revoke, S Stop cancels: all pass (`verdict.json` + `results.jsonl` in the task proof directory). The follow-up commit `e594443bccd6` only rewords one comment (session-identity ratchet counts the word "replaced"). - **CI round 1:** only `checks-fast-baseline-ratchets` red (session-identity ratchet 4 > 3 in `github-publication-requester.ts`, from that comment); fixed in round 2. 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]>
…enclaw#204978) ## Problem `github_publish` re-derived the caller's rights at tool time instead of using what the turn was admitted with (OA2 PR 3, DESIGN §9 row 3). - The agent tool reaches the Gateway as the in-process System client with the method's least scopes (`operator.sessions.write` for `edit`, `inspect_pr`, `prepare_pr`, `refresh_base`). `prepareGitHubPublicationRequesterV2` re-ran operator admission on that client, so the requester snapshot was the turn's scopes narrowed to the method minimum, and `github-publication-actions.ts` intersected again with the caller's scopes. - Result: the Gateway owner or an admin, in any entry kind (Control UI, Discord owner, Telegram owner, linked channel sender), lost operator write for sessions-write actions. Editing a PR in a conversation they did not start was refused ("The original GitHub publication requester is no longer authorized."). - The requester also re-read the session's `createdActor`/`owner` on every `assertCurrent()`, a mid-run authority re-check. - Refusals named a fix that does not apply: "Inspecting your PR requires your verified linked GitHub account." for a conversation with no operator identity, "…require full operator write permission." with no next step. ## Fix - **Requester from the turn grant.** A tool call builds its requester snapshot from the calling turn's admitted authority (`resolveGatewayToolOperatorSelection().operatorAuthority`): same profile, same scopes. A direct Gateway request (Control UI button, RPC) is still admitted once by `prepareGatewayOperatorRunAuthority`. - **One rights rule.** `captureGitHubPublicationActionAuthority` returns the requester's scopes; a tool turn without an operator principal (System) holds no PR rights, as before. `github-publication-actions.ts` uses it for lifecycle actions; the `actionScopes` intersection is gone. - **Deleted re-checks:** `options.sessionMutationAuthorization.assertCurrent()` and the `hasCurrentClientAuthority` check at requester preparation; the `createdActor`/`owner` re-read in `prepareRequesterPolicy.assertCurrent` and in the task-requester `assertCurrent` (plus its profile re-read); the caller-selection re-check in the action authority. - **Refusal texts name the next step:** - no operator identity: "This conversation has no Gateway operator identity, so it cannot inspect PRs. A Gateway owner adds this sender to commands.ownerAllowFrom; anyone else asks an admin to link this channel account to their Gateway profile, then retries." - no linked GitHub: "Link your GitHub account once in the Control UI under Settings → Profile → Identity, on the configured GitHub host, then retry the inspection." - lifecycle without write: "The merge action needs operator write permission. Ask a Gateway admin to run it, or to give your role operator.write." - requester refused: "This requester is not authorized to publish from this conversation." (next action: publish from a conversation you started and can write to, or ask a Gateway admin). ### `assertCurrent()` calls in `github-publication-actions.ts` | Call | Before | After | |---|---|---| | `preparePublishingSession(…, () => sessionMutationAuthorization.assertCurrent())` | authority re-check | **deleted**; replaced by `signal.throwIfAborted()` (Stop) | | `target.assertCurrent()` | target relation / session revision | kept (data fence) | | `admitted.requester.assertCurrent()` | requester policy re-read (role, `createdActor`, `owner`) + Stop | kept; now only Stop + session id/lifecycle revision (data) | | write-scope check inside `assertRequester` (ran before every step) | authority re-check | **moved** to one check at action start | | `inspection?.assertCurrent()` | inspection receipt / head | kept (data) | | composite `assertCurrent()` ×5 (evidence prepare, effect, present, read failure) | requester + identity + inspection | kept; requester part is now Stop + revision only | Kept data fences unchanged: requestId/head receipts, `expectedHeadCommit`, evidence receipt, metadata CAS, attribution freshness. ## Decisions (recorded, not asked) - **Accepted edge:** a role revoked or a session reassigned while a turn runs no longer stops a PR action inside that turn; the next turn is admitted against current policy (AGENTS.md "a started request may finish"). Stop still cancels. - **A tool call with no turn grant** (only test fixtures; production in-process tool calls always arrive as the System client) falls back to admitting the client, which for the System client is no principal. - **Tests deleted (assert removed behavior):** `github-personal-publication-outcomes` "does not resume shared GitHub writes after the RPC session changes owner" (mid-run owner re-check); `github-pr-workspace-preparation` "refuses a maintainer's narrowed/missing selected authority" and two `github-publication-workflows` cases ("narrowed" tool, "admin" via `gateway-session` scopes) — these assert that the tool bridge's method scopes narrow the turn's rights; `session-pr-workspace-adoption` no longer expects an admin assist to be refused. - `github-publication-requester.ts` stays in `ADMISSION_FILES`: restart recovery (`restoreGitHubPublicationRequester`) still re-admits a stored requester against the current role. Moving that into `decideOperatorAdmission` is PR 4 (replays). ## User impact - The owner and admins get the same `github_publish` rights from every entry kind as their turn grant says: they can edit, prepare and refresh PRs in conversations they did not start. - Members keep own-conversation rights; lifecycle actions still need `operator.write`. Guests and turns with no operator identity get nothing, with a refusal that says what to do. ## Evidence - **Production lines** (`src`, non-test): +49 / −66 (net −17). - **Matrix** (`src/gateway/github-publication-turn-grant.test.ts`, new): owner × {Control UI, Discord owner, Telegram owner}, admin × {Control UI, linked channel}, member × {Control UI, linked channel}, guest × {Control UI, linked channel}; each cell runs `inspect`, `edit` and `merge` through the real `github_publish` tool and `sessions.github.action` handler with the System bridge client the in-process dispatch uses. Head 9/9. **Base `c50a20d272b5`: owner × Control UI / Discord owner / Telegram owner and admin × Control UI / linked channel fail** (`edit` refused "The original GitHub publication requester is no longer authorized."); member and guest cells pass on both. - **Live Discord (QA Lab, Convex-leased bots, isolated Gateway, live `openai/gpt-5.6-luna`, Docker sandbox, no Control UI step):** the driver bot is the configured verified owner (`commands.ownerAllowFrom`), mentions the SUT and asks it to resolve the merge conflict on a scratch PR. Head: `prepare_pr` → base merge → publish; the PR went from `CONFLICTING` to `MERGEABLE`/`CLEAN`; pushed merge commit `9fd180559e7b` ("Merge selected base main") and publish commit `af7c3714887a`. The Discord transcript and tool trace are kept in the task proof directory. - **Base, same run:** also succeeded (pushed `4147b28a4722`). openclaw#204904 already admits the configured Discord owner with operator authority, and in their own Discord conversation the owner is the conversation's creator, so the narrowed scopes still pass. A live title edit through `edit` + `pullRequestUrl` also passed on base. The base-red difference is the matrix case above: owner/admin acting in a conversation they did not start. - **Pre-push:** one `ocx test` call over 49 files (touched tests plus importer tests of every changed source and test-support file): 886 passed, 0 failed. `pnpm tsgo:core`, `pnpm tsgo:test`, oxfmt and oxlint clean; `pnpm check:changed` all lanes ok after deleting a now-unused test-support export. - **E2E Q/R/S** (`one-admission-e2e/run.sh` on `982f3b6e4578`): Q queued input refused visibly, R running turn finishes after revoke, S Stop cancels: all pass (`verdict.json` + `results.jsonl` in the task proof directory). The follow-up commit `e594443bccd6` only rewords one comment (session-identity ratchet counts the word "replaced"). - **CI round 1:** only `checks-fast-baseline-ratchets` red (session-identity ratchet 4 > 3 in `github-publication-requester.ts`, from that comment); fixed in round 2. Co-authored-by: Ayaan Zaidi <[email protected]>
#205082) ## Problem OA2 PR 4b (background leftovers from #205015). A scheduled run still decided its owner status from something other than its admission: - **A legacy parent-bound cron source made any non-member requester the owner** (`requesterOwner = principal?.kind !== "member"` in `decideOperatorAdmission`). A writer's parent-bound automation ran with owner status (`senderIsOwner: true`) that the same writer never has on a fresh turn (D12 / matrix M8). ## Fix - **Parent-bound owner rule deleted, with the whole `requesterOwner` field.** Its only reader (scheduled occurrence minting, `cron/execution-context-admission.ts`) now reads `grant.owner`, the same answer as the requester's fresh turn. The `operatorSource` parameter threaded through `restoreGatewayOperatorSource` / `restoreGatewayQueuedOperatorRecovery` / `restoreScheduledAutomationOperator` existed only for that rule; it is gone from the queue lifecycle, cron, cron stream, plugin command and session-event callers. - **Lint allowlist shrinks:** owner producers 51 → 50 (`operator-admission.ts` no longer writes an owner field). ## Decisions (recorded, not asked) **Cut less: `grant.automations` is not in this PR.** I implemented it (Fable 5.2 consult: `manage` iff owner, `self` iff `operator.cron`; the classifier keeps its fresh-user-turn gate and reads the grant instead of connect scopes) and removed it before the first push: - A direct socket with no admitted operator authority has no grant. `gateway.auth.mode: "none"` local clients are such sockets (`prepareGatewayOperatorRunAuthority` returns `undefined`: no profile, no shared secret). Today they get local automation management from the connect facts; reading the grant would silently take it away. That is a UX regression, so I did not land it. - The same gap shows in 5 suites whose clients carry no admitted authority (`agent-run-local-operator-authority`, `cron-creator-transports`, `requester-cron-authority.integration`, `cron-stream-approval.integration`, `message-handler.post-connect-health`, chat-b local turns). - **Next split (PR 4c):** admit an authless local socket as the local-host principal (DESIGN §2 `local-host`), then add `grant.automations` and move the classifier and the channel-owner mint onto it. The channel mint has its own blocker: a configured owner linked to a non-admin personal profile is admitted as that profile (#204904), so reading the grant would drop their management. - **Children:** unchanged. A subagent child or `sessions_send` target gets no automation capability (fresh-user-turn gate). `requester-cron-authority.ts` keeps the **parent's** capability for the parent's own completion turn after `sessions_yield`; it is not a child right. - **Channel-owner recorded source: not added** (Fable fork C2). A channel-owner-created cron job already stores its `channelRequester`, and every occurrence re-checks `commands.ownerAllowFrom`, so it survives a restart and honours removal from the owner list. Channel-owner durable wakes still fall back to the session principal: not patched; it needs a stored source kind, which is a stored-row decision. - **The durable process record gets no source in this PR**; its storage is a separate decision. - **Cut less: `automations-run-scope.ts` trigger fallback stays.** With it deleted, `run.operator-continuation.test.ts` (self removal, queued owner payload edit) went red: an in-session scheduled continuation builds its tools without the admitted scheduled scope registered for that run, so the fallback is what restricts it to its own job. Deleting the fallback first needs that continuation to carry its admitted scope. - **Cut less: `attempt-session-target.ts` keeps its source dispatch.** The admission source it dispatches also carries the pre-start session-event config gate (`session-event-policy.ts`, a no-op once the turn starts); with the dispatch removed, `session-run.session-model-strictness.integration.test.ts` "selected-model-denied" lost its pre-start refusal. Splitting that gate out of the source is the next step before the R7 re-check can go. - **Tests changed:** the `cron-operator-source` table cell expects the parent-bound writer occurrence to have the writer's fresh grant (`grant.owner` and `senderIsOwner` false); `operator-run-recovery.start-grant.test.ts` and `execution-context-admission.test.ts` drop the removed `operatorSource` / `requesterOwner` inputs. ## User impact - A writer's or member's automation created in a parent conversation no longer runs with owner status (owner-only tools); it gets what that person gets on a new turn. ## Evidence - **Production lines** (`src` + `scripts`, non-test): +5 / −40. - **Red on base `4369ec1e2a91`:** `operator-admission.table.test.ts` `cron-operator-source` `after-start` and `stop` (real token-mode Gateway, real `chat.send` creates a parent-bound automation as a writer, real scheduled occurrence): on base the occurrence ran with `senderIsOwner: true`; on head it gets the writer's fresh grant (`grant.owner` false) and still runs. - **Pre-push:** one `ocx test` call over 162 files (touched tests plus importer tests of every changed source and test-support file, except the very broad importer sets of `admitted-run-context.ts`/`operator-admission.ts`, which CI runs). It included the removed `grant.automations` classifier change; after removing it, the 11 failed files plus the start-grant and table tests ran again: 434/434 green. CI round 1 reds (`run.operator-continuation`, `execution-context-owner-authority`, `session-run.session-model-strictness.integration`) came from the trigger-fallback and session-target cuts, now restored; those files plus `run-attempt-dispatch.owner` and the boundary guards pass locally. The first run's other reds were the classifier fixtures above and a mid-run `node_modules` re-materialization (`ERR_MODULE_NOT_FOUND` in `@openclaw/fs-safe`), not this diff. `pnpm tsgo:core` and `pnpm tsgo:test` clean; oxfmt and oxlint clean on changed files. - **E2E Q/R/S** (`one-admission-e2e/run.sh` on `f676d7804421`, isolated Gateway, live `gpt-5.5`): queued input refused visibly, running turn finishes after revoke, Stop cancels: all pass; rerun on the final head `7bc86192fe5f`: all pass. - **Discord owner cron after restart** (isolated Gateway, live Discord QA bots, live model, `commands.ownerAllowFrom` = the driver, no linked profile): the owner asked in Discord for a one-shot automation; the job persisted (`sessionTarget: current`, delivery `announce` to the Discord channel); the Gateway restarted about 3.5 minutes before it was due; after the restart the run finished `ok`, `deliveryStatus: delivered`, and the SUT posted `OA2CRON_3D017BC29D FIRED` in the channel. Live Peanutto Gateway pid unchanged. - **Local review:** clean on `f676d7804421` and on the final head `7bc86192fe5f` (patch is correct, no findings). Co-authored-by: Ayaan Zaidi <[email protected]>
…roves it (#205155) ## Problem An owner listed in `commands.ownerAllowFrom` got a different answer depending on the channel they wrote from (OA2 D23). - Since #204904, a configured owner on a channel that declares its sender id `verified` is the Gateway owner: same grant as the owner's Control UI turn, including operator tools and pull request actions. - Only Discord, Telegram, Google Chat, Mattermost, X and native Slack declared `verified`. The other bundled channels used the default `asserted`, even where the platform authenticates the sender. - So an owner on Signal, WhatsApp, Matrix, Teams and others kept owner-only tools but got no operator grant: `github_publish` refused them with "This conversation has no Gateway operator identity … A Gateway owner adds this sender to commands.ownerAllowFrom", which they already were. ## Fix Each channel plugin declares what its transport proves. No core decision changes. **Now `verified`** (the platform authenticates the sender id, and the plugin reads it from the platform's authenticated delivery): | Channel | Why the sender id is proven | |---|---| | WhatsApp | Baileys reads DM `remoteJid` / group `participant` from WhatsApp stanza metadata on the linked-device session (Noise handshake pinned to WhatsApp's certificate chain); LIDs resolve through the device's own mapping, never message text. The primary identifier was typed `phone`, which the host never treats as a person; it is WhatsApp's stable id, so that override is removed. | | Signal | signal-cli reports `sourceNumber`/`sourceUuid` from the decrypted, sender-certified envelope; the daemon is the operator's own linked device. | | Matrix | `event.sender` comes from the homeserver, which authenticates local users and checks federation signatures; allowlists match MXIDs only, never display names. | | Microsoft Teams | The Teams SDK validates the Bot Framework JWT before dispatch (401 on bad signature or audience); the connector supplies `from.aadObjectId`/`from.id`. | | LINE | `X-Line-Signature` HMAC over the raw body is checked before the user id is read. | | Nextcloud Talk | The bot webhook HMAC (bot secret) is checked before the actor id is read. | | Zalo | Bot API updates arrive on the secret-token webhook or token-authenticated polling. | | Zalo Personal | `uidFrom` arrives on the authenticated Zalo session, not from message content. | | Synology Chat | The NAS sends `user_id` on the token-checked outgoing webhook. | **Stays `asserted`:** | Channel | Why | |---|---| | iMessage | The same `imsg` watch also delivers SMS (spoofable caller id), and rows carry no validated service field. | | SMS | Twilio signs the webhook, not the originating number. | | IRC | Server prefixes prove no account. | | Tlon | Club authors are explicitly unverified; group authors come from content. | | Slack relay | The relay authenticates the router, not each Slack event. Native Socket Mode / HTTP Events (the default) were already `verified` per event (#159694); unchanged here. | | A2A | The token authenticates a peer agent, not a person. | | Feishu | Its primary identifier is a plugin kind, not a stable id, so `verified` would not change the grant. | | QA channel | Synthetic test transport. | **Not in this PR (cut less), follow-up:** Nostr and Buzz (every event signature is verified against the sender pubkey), Twitch (`user-id` tag on the authenticated chat connection) and ClickClack (author from the re-fetched server message) also prove the sender. Their declaration sits inside a transport loop, so a red-on-base owner cell needs either a test-only export (refused by the unused-export check) or moving the declaration into an `ingress-identity.ts` module. That move is a separate PR. **Refusal text.** Where a channel cannot prove the sender, the `github_publish` refusal now says: "This channel cannot confirm who you are, so it cannot inspect PRs; use Control UI, Discord or Telegram for this. If you are not the Gateway owner, ask an admin to link your channel account to your Gateway profile first." Same text at both throw sites (`github-publication-inspect.ts`, `github-publication-inspect-reader.ts`). **Docs:** `gateway/config-channels/commands.md` lists the channels that prove the sender. ## Decisions (recorded, not asked) - **Transport security is the operator's configuration**, as for Telegram's API root: a Signal daemon, a Matrix homeserver on a private network (plaintext is opt-in), or a Zalo API override reached over plaintext is the operator's choice. Accepted edge, named here, no code. The delta is small: an asserted owner already had owner-only tools (exec), which a forged transport would reach anyway. - **One refusal text for every no-identity case.** The inspect refusal cannot tell an asserted-channel owner from an unlinked sender or a source-less scheduled run; the second sentence covers the non-owner case. - **Declarations moved next to their normalizers** so the test can run the real declaration: LINE → `bot-access.ts`, Nextcloud Talk → `policy.ts`, Zalo → `group-access.ts`, Zalo Personal → `ingress.ts` (with its allowlist normalizer). The Zalo/Zalo Personal moves also keep `monitor.ts` under the line cap. - Production lines are not net negative: each channel adds its declaration and a one-line reason (requested behavior). ## User impact - An owner on WhatsApp, Signal, Matrix, Teams, LINE, Nextcloud Talk, Zalo, Zalo Personal or Synology Chat gets the same permissions as in the Control UI (operator tools, `github_publish`, PR actions), with no Control UI step. - A linked person on those channels gets their profile's Control UI grant (same rule as Discord/Telegram since #204904). - An owner on iMessage, SMS or IRC is told the channel cannot confirm who they are and where to go instead. ## Evidence - **Owner cell per channel** (`test/channel-verified-owner.integration.test.ts`, new): each flipped channel's real declaration (WhatsApp, Signal, Matrix, Teams, Synology Chat through the plugin's own ingress function) runs through the real host ingress and context builder, with the real plugin registered so the owner entry uses its allowlist normalizer; asserts the owner profile with `operator.admin`. Head 9/9. **Base (declarations `asserted`): all fail** (no operator authority). - Pre-push, E2E and CI: comments below. Co-authored-by: Ayaan Zaidi <[email protected]>
…ch and ClickClack (#205184) ## Problem Follow-up to #205155 (OA2 D23). Since #204904, a sender listed in `commands.ownerAllowFrom` on a channel that declares its sender id `verified` is the Gateway owner, with the same grant as the owner's Control UI turn (operator tools, `github_publish`, PR actions). Nostr, Buzz, Twitch and ClickClack prove the sender, but still used the default `asserted`. An owner on those channels kept owner-only tools but got no operator grant, so `github_publish` told them "This channel cannot confirm who you are … use Control UI, Discord or Telegram". #205155 left them out only because their declarations sat inside transport loops, where an owner cell could not run them without a test-only export. ## Fix Each plugin's identity declaration moves, unchanged, into its own `src/ingress-identity.ts`, which the transport imports, and declares `authentication: "verified"`. No core change. | Channel | Why the sender id is proven (checked in the transport) | |---|---| | Nostr | `nostr-bus.ts` runs `verifyEvent` (canonical hash + Schnorr signature against `event.pubkey`) on every DM before sender policy and decryption; invalid signatures are dropped as permanent errors. The sender id is `event.pubkey`. | | Buzz | The relay client is `nostr-tools` `Relay`, which runs `verifyEvent` on every `EVENT` before `onevent` (`relay.js` in 2.25.4, the pinned version); failing events go to `oninvalidevent`. The connection is NIP-42 authenticated and messages are admitted only from room members. The sender id is `event.pubkey`. | | Twitch | `twitch-client.ts` reads `msg.userInfo.userId`, the `user-id` tag Twitch's server sets on each message delivered over the OAuth-authenticated chat connection; clients cannot set server tags. Both the allowlist and the role identity use it as the primary id; role aliases stay `asserted` (roles are not a person). | | ClickClack | `gateway.ts` treats the pushed event as a routing hint and re-fetches the message from the server API with the bot token; `author_id` comes from the server's own copy. | Files: `extensions/{nostr,buzz,twitch,clickclack}/src/ingress-identity.ts` (new, holds the moved declaration and its normalizers); the transports import it; each plugin gets a one-line `test-api.ts` (same pattern as #205155). Docs: `gateway/config-channels/commands.md` adds the four channels to the list that proves the sender. ## Decisions (recorded, not asked) - **Production lines are not net negative** (+16: four `authentication` lines, their reasons, and the new modules' imports/exports). The declarations themselves move unchanged; the behavior is the requested one, and there is nothing in these paths to cut. - **Relay trust for Nostr/Buzz is cryptographic**, not transport-level: a relay cannot forge a signature for another pubkey. Accepted edge, no code: a Twitch or ClickClack server the operator points the plugin at is trusted to report the sender, the same as Telegram's API root in #205155. ## User impact - An owner on Nostr, Buzz, Twitch or ClickClack gets the same permissions as in the Control UI (operator tools, `github_publish`, PR actions), with no Control UI step. - A linked person on those channels gets their profile's Control UI grant (same rule as the other verified channels). - Other senders: no change. Allowlists, pairing and role policy are untouched. ## Evidence - **Owner cells** in `test/channel-verified-owner.integration.test.ts`: Nostr, Buzz, Twitch (allowlist policy), Twitch (role policy), ClickClack. Each runs the plugin's real declaration through the real host ingress and context builder with the real plugin registered, and asserts the owner profile with `operator.admin`. Head: 14/14. **With the four declarations set back to `asserted`: the 5 new cells fail** (`expected undefined to be 'gateway-owner'`), the 9 existing cells pass. - Pre-push, E2E and CI: comments below. Co-authored-by: Ayaan Zaidi <[email protected]>
…205173) ## Problem OA2 PR 4c, steps 1 and 2 (DESIGN §2, PR 4b leftovers from #205082). The same owner got a different automations answer depending on how the turn started: - **An authless local socket had no admitted authority.** On a `gateway.auth.mode: "none"` Gateway, a local client (CLI, local Control UI) was never admitted through `decideOperatorAdmission`, so its turn carried no grant. Its automation rights came from a transport check instead. - **Automation management was decided outside admission, from the transport.** The cron-creator classifier gave `manage` only to `operator.admin` **and** (local socket **or** Control UI admin **or** native-app admin). The same owner over a remote CLI, TUI or any other client got only caller-scoped creation. `operator.cron` was read from raw connect scopes, not from the admitted grant. - **Children got nothing.** A subagent child of an owner turn had no automation rights at all (fresh-turn gate), so "update my automation" worked from the parent and failed from its subagent. - **The channel-owner cron mint ignored the admitted grant.** A configured owner linked to a personal profile was admitted as that profile (#204904), but the mint still gave full management from the owner list. ## Fix - **`grant.automations`** (`"none" | "self" | "manage"`) is decided once in `decideTurnGrant`: `manage` iff the grant is owner (`operator.admin`), `self` iff `operator.cron` (or `operator.write`, which covers it), else `none`. - **Local-host principal:** an authless local operator socket (`authMethod: "none"`, handshake-attested direct-local, no named-profile actor, not an agent runtime) is admitted through `decideOperatorAdmission` as the owner principal with its own connect scopes — the same admission an HTTP `mode: "none"` owner request already uses (#205091). The HTTP owner path and the socket path now share one helper. Like every other socket path, the admitted run keeps the request's invocation ceiling and lifetime (`retainGatewayOperatorInvocation`: delegated-child participation ceiling, invocation signal and release). - **Classifier reads the grant.** `cron-creator-authority-admission.ts` keeps only the turn-shape gate (fresh direct input, not system, not handoff). The rights come from `grant.automations`. Deleted: the `operator.admin` + `isLocalClient`/UI-admin/native-app-admin rule, the raw `operator.cron` connect-scope read, and the Template setup `controlUiAdmin` + admin check (it now requires a `manage` grant). - **`localClient` / `uiAdminSource` settled:** deleted from the manage rule. An owner's remote and local browser (and CLI, TUI, native app) get the same `manage`. The management entitlement source collapses to `"operator" | "channel-owner"`; `resolveGatewayUiAdminSource` becomes the boolean `isGatewayUiAdmin` (its labels had no reader left). Local-host stays only as **job provenance** (`callerOrigin: local`, already stored on jobs) for a `manage` turn on a direct-local socket; it grants nothing more. - **Children:** a subagent child (`lane: "subagent"`) gets the automations of its own admitted grant: the parent's authority, re-admitted at launch and capped by the child launch's operator scopes (`operator.write`). An owner's or writer's child gets `self`; a child of a read-only or unadmitted parent gets `none`. - **Channel-owner mint:** a channel turn with an admitted operator authority mints channel-owner management only when its grant is `manage`. - **Deleted:** the expired (2026-10-12) `controlUiAdmin` harness getter on the creator capability, and the `controlUiAdmin` admission output (no production reader). - Docs: `automation/cron-jobs/managing-jobs.md` conversational management. ## Decisions (recorded, not asked) - **Deliberate widenings (same principal, same answer):** - An owner on a remote non-UI client (remote CLI, TUI) now manages every automation, like the owner's Control UI. That socket already holds `operator.admin`, so it can already call every `cron.*` method directly; only the model's tool gains reach. - A local CLI owner now also gets the management entitlement (it already had the local creator origin). - **Subagent children get the parent's re-admitted automations right** (MATRIX M9). Before, a child had none. A child never exceeds its parent. It does not reach `manage`: the in-process child launch carries `operator.write`, which caps the child's admitted grant at `self`. Lifting that cap is a launch-scope change, not an automations rule; not in this PR. - **Narrowing (brief rule, #204904):** a configured `commands.ownerAllowFrom` owner whose verified channel identity is linked to a non-admin personal profile now gets that profile's automations, not channel-owner management. - **Asserted-identity owners keep today's mint.** Signal/WhatsApp/iMessage owners are not admitted through `decideOperatorAdmission` (DESIGN §10, D23): they have no grant to read. Cutting their mint would remove automation management they have today, so the mint still applies when there is no admitted grant. Closing that needs the D23 decision, not this PR. - **Accepted edge:** an authless Gateway that also configures named roles has no owner profile at startup; a local socket turn there is now refused at admission. `mode: "none"` with named roles has no identities to apply roles to, so this combination is not a working setup. - **Split (brief rule: over ~25 files → land steps 1–2 first).** 37 files. Steps 3 (in-session scheduled scope into admission, delete the `automations-run-scope.ts` trigger fallback) and 4 (split the pre-start session-event config check out of the `attempt-session-target.ts` source, delete the R7 re-check) go in the next PR. The replay `automationAdmin` output (saved UI-admin delegation) stays with step 3: it decides what an in-session scheduled run gets. ## User impact - The owner manages automations from chat the same way from any client, including a local client of an authless Gateway. - A subagent of an owner or writer turn can create and edit its own automations. - A channel owner linked to a non-admin profile manages only their own automations from that channel. ## Evidence - **Production lines** (`src`, non-test): +77 / −78 (net −1).. - **Red on base, green on head:** - `message-handler.post-connect-health.test.ts` "admits an authless local socket as the local host": real WS handshake on an authless Gateway, real `prepareGatewayOperatorRunAuthority` → owner profile, `grant.automations: "manage"`. Base returns no authority. - Same file, trusted-proxy person over `openclaw-tui` with `operator.admin`: head gets management through the grant; base gave caller-scoped only. - `agent-run-local-operator-authority.test.ts`: remote Control UI, native app and CLI owners get the same management; a subagent child gets automations from its admitted grant; a local-host admission keeps the request's invocation signal and release (local review round 2). - `operator-admission.table.test.ts`: matrix grants carry `automations` (owner `manage`, writer `self`) for every entry kind. - **Pre-push:** (1) one `ocx test` call over 125 files (touched tests plus importers of every changed source/test-support), then (2) one frozen-tree `ocx test` call over the 32 touched/re-run files: all green except `src/cron/service.pr-automation.test.ts`, which fails the same way on the merge base `529e37f3a53a` (13 failed on base, `ocx base merge-base`). `pnpm tsgo:core` and `tsgo:core:test` clean; oxfmt/oxlint clean; line-cap ratchet OK. `pnpm check:changed`: all lanes ok except two that fail on files this PR does not touch (changelog attribution in `CHANGELOG/2026.11.10.md`; Knip unused exports in `update-cli`, `schtasks-process`, `upgrade-survivor`). - **E2E:** see the follow-up comment (Q/R/S on the exact head). Co-authored-by: Ayaan Zaidi <[email protected]>
…ds used (#205232) ## Problem A channel turn that ran on a provided reply operation could get two owner answers in the same turn (OA2 PR 6b, channel command owner). - Command authorization (`command-auth.ts`) decides `senderIsOwner` once for the turn's commands. - `get-reply-run-execute.ts` then re-read the bound channel owner binding (`getCommandOwnerAuthority(ctx).isCurrent()`) for the agent run when a reply operation was provided. When that binding had ended but the sender was still a configured owner, commands ran as the owner and the run's tools did not. ## Fix - `get-reply-run-execute.ts`: the run takes `command.senderIsOwner`, the decision its commands used. The second read is deleted. Command authorization already includes the bound owner binding, so a bound owner keeps owner status. - Owner-producer lint allowlist (`OWNER_PRODUCER_FILES`): 33 → 32. - `message-action-dispatch.ts` moves under the "scheduled and requester-owner continuations" group in the allowlist. Its `policy === "operator" ? true` is the scheduled job's operator, not a channel command owner; PR 6c owns that cut. No code change. ## Decisions (recorded, not asked) Cut less. A design consult on the full 6b scope picked this option. The other channel command-owner producers stay, each for a stated reason: - `command-auth.ts` keeps the `commands.ownerAllowFrom` config match. Asserted-identity channel owners (iMessage, SMS, IRC, Slack relay) and pre-turn senders (native slash commands, plugin SDK `resolveCommandAuthorization[Async]`) have no admitted grant. A grant with owner and no scopes would need a new admission state and a replay exception, and would put the owner profile on a sender whose identity is only asserted. - `reply-source-admission.ts`: queued asserted owners have no grant. For a linked sender who is also in `commands.ownerAllowFrom`, the grant follows the linked profile (#204904), so a switch to `grant.owner` would remove owner commands from a listed owner. - `agent-run-user-turn.ts`: `agent` RPC clients with admin scope do not hold an admitted authority when the owner bit is computed. A switch would remove owner from them. - Discord native command auth and Discord voice stay listed: `resolveDiscordOwnerAccess` matches names, tags and Discord prefixes, which the core matcher does not. Voice has no admission until the plugin ingress owner claim is decided (PR 6e). ## User impact - A configured channel owner gets the same owner answer for commands and for the run's tools in one turn. - No other change. ## Evidence - Production (`src` + `extensions`, non-test): +1 / −4. - New cell `get-reply-run.owner-decision.test.ts`: red on base `da3479a658bf` (run not owner while its commands were owner), green on head. - Pre-push: one `ocx test` call over 15 files (touched tests, importers of `get-reply-run-execute.ts` and `get-reply-run.ts`, `test/scripts/oxlint-boundary-guards.test.ts`): all passed. `pnpm tsgo:core` and `pnpm tsgo:test` clean. oxfmt/oxlint clean on changed files. - E2E (one-admission run.sh Q/R/S) on the exact head: results in a follow-up comment. 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]>
openclaw#205082) ## Problem OA2 PR 4b (background leftovers from openclaw#205015). A scheduled run still decided its owner status from something other than its admission: - **A legacy parent-bound cron source made any non-member requester the owner** (`requesterOwner = principal?.kind !== "member"` in `decideOperatorAdmission`). A writer's parent-bound automation ran with owner status (`senderIsOwner: true`) that the same writer never has on a fresh turn (D12 / matrix M8). ## Fix - **Parent-bound owner rule deleted, with the whole `requesterOwner` field.** Its only reader (scheduled occurrence minting, `cron/execution-context-admission.ts`) now reads `grant.owner`, the same answer as the requester's fresh turn. The `operatorSource` parameter threaded through `restoreGatewayOperatorSource` / `restoreGatewayQueuedOperatorRecovery` / `restoreScheduledAutomationOperator` existed only for that rule; it is gone from the queue lifecycle, cron, cron stream, plugin command and session-event callers. - **Lint allowlist shrinks:** owner producers 51 → 50 (`operator-admission.ts` no longer writes an owner field). ## Decisions (recorded, not asked) **Cut less: `grant.automations` is not in this PR.** I implemented it (Fable 5.2 consult: `manage` iff owner, `self` iff `operator.cron`; the classifier keeps its fresh-user-turn gate and reads the grant instead of connect scopes) and removed it before the first push: - A direct socket with no admitted operator authority has no grant. `gateway.auth.mode: "none"` local clients are such sockets (`prepareGatewayOperatorRunAuthority` returns `undefined`: no profile, no shared secret). Today they get local automation management from the connect facts; reading the grant would silently take it away. That is a UX regression, so I did not land it. - The same gap shows in 5 suites whose clients carry no admitted authority (`agent-run-local-operator-authority`, `cron-creator-transports`, `requester-cron-authority.integration`, `cron-stream-approval.integration`, `message-handler.post-connect-health`, chat-b local turns). - **Next split (PR 4c):** admit an authless local socket as the local-host principal (DESIGN §2 `local-host`), then add `grant.automations` and move the classifier and the channel-owner mint onto it. The channel mint has its own blocker: a configured owner linked to a non-admin personal profile is admitted as that profile (openclaw#204904), so reading the grant would drop their management. - **Children:** unchanged. A subagent child or `sessions_send` target gets no automation capability (fresh-user-turn gate). `requester-cron-authority.ts` keeps the **parent's** capability for the parent's own completion turn after `sessions_yield`; it is not a child right. - **Channel-owner recorded source: not added** (Fable fork C2). A channel-owner-created cron job already stores its `channelRequester`, and every occurrence re-checks `commands.ownerAllowFrom`, so it survives a restart and honours removal from the owner list. Channel-owner durable wakes still fall back to the session principal: not patched; it needs a stored source kind, which is a stored-row decision. - **The durable process record gets no source in this PR**; its storage is a separate decision. - **Cut less: `automations-run-scope.ts` trigger fallback stays.** With it deleted, `run.operator-continuation.test.ts` (self removal, queued owner payload edit) went red: an in-session scheduled continuation builds its tools without the admitted scheduled scope registered for that run, so the fallback is what restricts it to its own job. Deleting the fallback first needs that continuation to carry its admitted scope. - **Cut less: `attempt-session-target.ts` keeps its source dispatch.** The admission source it dispatches also carries the pre-start session-event config gate (`session-event-policy.ts`, a no-op once the turn starts); with the dispatch removed, `session-run.session-model-strictness.integration.test.ts` "selected-model-denied" lost its pre-start refusal. Splitting that gate out of the source is the next step before the R7 re-check can go. - **Tests changed:** the `cron-operator-source` table cell expects the parent-bound writer occurrence to have the writer's fresh grant (`grant.owner` and `senderIsOwner` false); `operator-run-recovery.start-grant.test.ts` and `execution-context-admission.test.ts` drop the removed `operatorSource` / `requesterOwner` inputs. ## User impact - A writer's or member's automation created in a parent conversation no longer runs with owner status (owner-only tools); it gets what that person gets on a new turn. ## Evidence - **Production lines** (`src` + `scripts`, non-test): +5 / −40. - **Red on base `1686137e00b6`:** `operator-admission.table.test.ts` `cron-operator-source` `after-start` and `stop` (real token-mode Gateway, real `chat.send` creates a parent-bound automation as a writer, real scheduled occurrence): on base the occurrence ran with `senderIsOwner: true`; on head it gets the writer's fresh grant (`grant.owner` false) and still runs. - **Pre-push:** one `ocx test` call over 162 files (touched tests plus importer tests of every changed source and test-support file, except the very broad importer sets of `admitted-run-context.ts`/`operator-admission.ts`, which CI runs). It included the removed `grant.automations` classifier change; after removing it, the 11 failed files plus the start-grant and table tests ran again: 434/434 green. CI round 1 reds (`run.operator-continuation`, `execution-context-owner-authority`, `session-run.session-model-strictness.integration`) came from the trigger-fallback and session-target cuts, now restored; those files plus `run-attempt-dispatch.owner` and the boundary guards pass locally. The first run's other reds were the classifier fixtures above and a mid-run `node_modules` re-materialization (`ERR_MODULE_NOT_FOUND` in `@openclaw/fs-safe`), not this diff. `pnpm tsgo:core` and `pnpm tsgo:test` clean; oxfmt and oxlint clean on changed files. - **E2E Q/R/S** (`one-admission-e2e/run.sh` on `f676d7804421`, isolated Gateway, live `gpt-5.5`): queued input refused visibly, running turn finishes after revoke, Stop cancels: all pass; rerun on the final head `7bc86192fe5f`: all pass. - **Discord owner cron after restart** (isolated Gateway, live Discord QA bots, live model, `commands.ownerAllowFrom` = the driver, no linked profile): the owner asked in Discord for a one-shot automation; the job persisted (`sessionTarget: current`, delivery `announce` to the Discord channel); the Gateway restarted about 3.5 minutes before it was due; after the restart the run finished `ok`, `deliveryStatus: delivered`, and the SUT posted `OA2CRON_3D017BC29D FIRED` in the channel. Live Peanutto Gateway pid unchanged. - **Local review:** clean on `f676d7804421` and on the final head `7bc86192fe5f` (patch is correct, no findings). Co-authored-by: Ayaan Zaidi <[email protected]>
…roves it (openclaw#205155) ## Problem An owner listed in `commands.ownerAllowFrom` got a different answer depending on the channel they wrote from (OA2 D23). - Since openclaw#204904, a configured owner on a channel that declares its sender id `verified` is the Gateway owner: same grant as the owner's Control UI turn, including operator tools and pull request actions. - Only Discord, Telegram, Google Chat, Mattermost, X and native Slack declared `verified`. The other bundled channels used the default `asserted`, even where the platform authenticates the sender. - So an owner on Signal, WhatsApp, Matrix, Teams and others kept owner-only tools but got no operator grant: `github_publish` refused them with "This conversation has no Gateway operator identity … A Gateway owner adds this sender to commands.ownerAllowFrom", which they already were. ## Fix Each channel plugin declares what its transport proves. No core decision changes. **Now `verified`** (the platform authenticates the sender id, and the plugin reads it from the platform's authenticated delivery): | Channel | Why the sender id is proven | |---|---| | WhatsApp | Baileys reads DM `remoteJid` / group `participant` from WhatsApp stanza metadata on the linked-device session (Noise handshake pinned to WhatsApp's certificate chain); LIDs resolve through the device's own mapping, never message text. The primary identifier was typed `phone`, which the host never treats as a person; it is WhatsApp's stable id, so that override is removed. | | Signal | signal-cli reports `sourceNumber`/`sourceUuid` from the decrypted, sender-certified envelope; the daemon is the operator's own linked device. | | Matrix | `event.sender` comes from the homeserver, which authenticates local users and checks federation signatures; allowlists match MXIDs only, never display names. | | Microsoft Teams | The Teams SDK validates the Bot Framework JWT before dispatch (401 on bad signature or audience); the connector supplies `from.aadObjectId`/`from.id`. | | LINE | `X-Line-Signature` HMAC over the raw body is checked before the user id is read. | | Nextcloud Talk | The bot webhook HMAC (bot secret) is checked before the actor id is read. | | Zalo | Bot API updates arrive on the secret-token webhook or token-authenticated polling. | | Zalo Personal | `uidFrom` arrives on the authenticated Zalo session, not from message content. | | Synology Chat | The NAS sends `user_id` on the token-checked outgoing webhook. | **Stays `asserted`:** | Channel | Why | |---|---| | iMessage | The same `imsg` watch also delivers SMS (spoofable caller id), and rows carry no validated service field. | | SMS | Twilio signs the webhook, not the originating number. | | IRC | Server prefixes prove no account. | | Tlon | Club authors are explicitly unverified; group authors come from content. | | Slack relay | The relay authenticates the router, not each Slack event. Native Socket Mode / HTTP Events (the default) were already `verified` per event (openclaw#159694); unchanged here. | | A2A | The token authenticates a peer agent, not a person. | | Feishu | Its primary identifier is a plugin kind, not a stable id, so `verified` would not change the grant. | | QA channel | Synthetic test transport. | **Not in this PR (cut less), follow-up:** Nostr and Buzz (every event signature is verified against the sender pubkey), Twitch (`user-id` tag on the authenticated chat connection) and ClickClack (author from the re-fetched server message) also prove the sender. Their declaration sits inside a transport loop, so a red-on-base owner cell needs either a test-only export (refused by the unused-export check) or moving the declaration into an `ingress-identity.ts` module. That move is a separate PR. **Refusal text.** Where a channel cannot prove the sender, the `github_publish` refusal now says: "This channel cannot confirm who you are, so it cannot inspect PRs; use Control UI, Discord or Telegram for this. If you are not the Gateway owner, ask an admin to link your channel account to your Gateway profile first." Same text at both throw sites (`github-publication-inspect.ts`, `github-publication-inspect-reader.ts`). **Docs:** `gateway/config-channels/commands.md` lists the channels that prove the sender. ## Decisions (recorded, not asked) - **Transport security is the operator's configuration**, as for Telegram's API root: a Signal daemon, a Matrix homeserver on a private network (plaintext is opt-in), or a Zalo API override reached over plaintext is the operator's choice. Accepted edge, named here, no code. The delta is small: an asserted owner already had owner-only tools (exec), which a forged transport would reach anyway. - **One refusal text for every no-identity case.** The inspect refusal cannot tell an asserted-channel owner from an unlinked sender or a source-less scheduled run; the second sentence covers the non-owner case. - **Declarations moved next to their normalizers** so the test can run the real declaration: LINE → `bot-access.ts`, Nextcloud Talk → `policy.ts`, Zalo → `group-access.ts`, Zalo Personal → `ingress.ts` (with its allowlist normalizer). The Zalo/Zalo Personal moves also keep `monitor.ts` under the line cap. - Production lines are not net negative: each channel adds its declaration and a one-line reason (requested behavior). ## User impact - An owner on WhatsApp, Signal, Matrix, Teams, LINE, Nextcloud Talk, Zalo, Zalo Personal or Synology Chat gets the same permissions as in the Control UI (operator tools, `github_publish`, PR actions), with no Control UI step. - A linked person on those channels gets their profile's Control UI grant (same rule as Discord/Telegram since openclaw#204904). - An owner on iMessage, SMS or IRC is told the channel cannot confirm who they are and where to go instead. ## Evidence - **Owner cell per channel** (`test/channel-verified-owner.integration.test.ts`, new): each flipped channel's real declaration (WhatsApp, Signal, Matrix, Teams, Synology Chat through the plugin's own ingress function) runs through the real host ingress and context builder, with the real plugin registered so the owner entry uses its allowlist normalizer; asserts the owner profile with `operator.admin`. Head 9/9. **Base (declarations `asserted`): all fail** (no operator authority). - Pre-push, E2E and CI: comments below. Co-authored-by: Ayaan Zaidi <[email protected]>
…ch and ClickClack (openclaw#205184) ## Problem Follow-up to openclaw#205155 (OA2 D23). Since openclaw#204904, a sender listed in `commands.ownerAllowFrom` on a channel that declares its sender id `verified` is the Gateway owner, with the same grant as the owner's Control UI turn (operator tools, `github_publish`, PR actions). Nostr, Buzz, Twitch and ClickClack prove the sender, but still used the default `asserted`. An owner on those channels kept owner-only tools but got no operator grant, so `github_publish` told them "This channel cannot confirm who you are … use Control UI, Discord or Telegram". openclaw#205155 left them out only because their declarations sat inside transport loops, where an owner cell could not run them without a test-only export. ## Fix Each plugin's identity declaration moves, unchanged, into its own `src/ingress-identity.ts`, which the transport imports, and declares `authentication: "verified"`. No core change. | Channel | Why the sender id is proven (checked in the transport) | |---|---| | Nostr | `nostr-bus.ts` runs `verifyEvent` (canonical hash + Schnorr signature against `event.pubkey`) on every DM before sender policy and decryption; invalid signatures are dropped as permanent errors. The sender id is `event.pubkey`. | | Buzz | The relay client is `nostr-tools` `Relay`, which runs `verifyEvent` on every `EVENT` before `onevent` (`relay.js` in 2.25.4, the pinned version); failing events go to `oninvalidevent`. The connection is NIP-42 authenticated and messages are admitted only from room members. The sender id is `event.pubkey`. | | Twitch | `twitch-client.ts` reads `msg.userInfo.userId`, the `user-id` tag Twitch's server sets on each message delivered over the OAuth-authenticated chat connection; clients cannot set server tags. Both the allowlist and the role identity use it as the primary id; role aliases stay `asserted` (roles are not a person). | | ClickClack | `gateway.ts` treats the pushed event as a routing hint and re-fetches the message from the server API with the bot token; `author_id` comes from the server's own copy. | Files: `extensions/{nostr,buzz,twitch,clickclack}/src/ingress-identity.ts` (new, holds the moved declaration and its normalizers); the transports import it; each plugin gets a one-line `test-api.ts` (same pattern as openclaw#205155). Docs: `gateway/config-channels/commands.md` adds the four channels to the list that proves the sender. ## Decisions (recorded, not asked) - **Production lines are not net negative** (+16: four `authentication` lines, their reasons, and the new modules' imports/exports). The declarations themselves move unchanged; the behavior is the requested one, and there is nothing in these paths to cut. - **Relay trust for Nostr/Buzz is cryptographic**, not transport-level: a relay cannot forge a signature for another pubkey. Accepted edge, no code: a Twitch or ClickClack server the operator points the plugin at is trusted to report the sender, the same as Telegram's API root in openclaw#205155. ## User impact - An owner on Nostr, Buzz, Twitch or ClickClack gets the same permissions as in the Control UI (operator tools, `github_publish`, PR actions), with no Control UI step. - A linked person on those channels gets their profile's Control UI grant (same rule as the other verified channels). - Other senders: no change. Allowlists, pairing and role policy are untouched. ## Evidence - **Owner cells** in `test/channel-verified-owner.integration.test.ts`: Nostr, Buzz, Twitch (allowlist policy), Twitch (role policy), ClickClack. Each runs the plugin's real declaration through the real host ingress and context builder with the real plugin registered, and asserts the owner profile with `operator.admin`. Head: 14/14. **With the four declarations set back to `asserted`: the 5 new cells fail** (`expected undefined to be 'gateway-owner'`), the 9 existing cells pass. - Pre-push, E2E and CI: comments below. Co-authored-by: Ayaan Zaidi <[email protected]>
…penclaw#205173) ## Problem OA2 PR 4c, steps 1 and 2 (DESIGN §2, PR 4b leftovers from openclaw#205082). The same owner got a different automations answer depending on how the turn started: - **An authless local socket had no admitted authority.** On a `gateway.auth.mode: "none"` Gateway, a local client (CLI, local Control UI) was never admitted through `decideOperatorAdmission`, so its turn carried no grant. Its automation rights came from a transport check instead. - **Automation management was decided outside admission, from the transport.** The cron-creator classifier gave `manage` only to `operator.admin` **and** (local socket **or** Control UI admin **or** native-app admin). The same owner over a remote CLI, TUI or any other client got only caller-scoped creation. `operator.cron` was read from raw connect scopes, not from the admitted grant. - **Children got nothing.** A subagent child of an owner turn had no automation rights at all (fresh-turn gate), so "update my automation" worked from the parent and failed from its subagent. - **The channel-owner cron mint ignored the admitted grant.** A configured owner linked to a personal profile was admitted as that profile (openclaw#204904), but the mint still gave full management from the owner list. ## Fix - **`grant.automations`** (`"none" | "self" | "manage"`) is decided once in `decideTurnGrant`: `manage` iff the grant is owner (`operator.admin`), `self` iff `operator.cron` (or `operator.write`, which covers it), else `none`. - **Local-host principal:** an authless local operator socket (`authMethod: "none"`, handshake-attested direct-local, no named-profile actor, not an agent runtime) is admitted through `decideOperatorAdmission` as the owner principal with its own connect scopes — the same admission an HTTP `mode: "none"` owner request already uses (openclaw#205091). The HTTP owner path and the socket path now share one helper. Like every other socket path, the admitted run keeps the request's invocation ceiling and lifetime (`retainGatewayOperatorInvocation`: delegated-child participation ceiling, invocation signal and release). - **Classifier reads the grant.** `cron-creator-authority-admission.ts` keeps only the turn-shape gate (fresh direct input, not system, not handoff). The rights come from `grant.automations`. Deleted: the `operator.admin` + `isLocalClient`/UI-admin/native-app-admin rule, the raw `operator.cron` connect-scope read, and the Template setup `controlUiAdmin` + admin check (it now requires a `manage` grant). - **`localClient` / `uiAdminSource` settled:** deleted from the manage rule. An owner's remote and local browser (and CLI, TUI, native app) get the same `manage`. The management entitlement source collapses to `"operator" | "channel-owner"`; `resolveGatewayUiAdminSource` becomes the boolean `isGatewayUiAdmin` (its labels had no reader left). Local-host stays only as **job provenance** (`callerOrigin: local`, already stored on jobs) for a `manage` turn on a direct-local socket; it grants nothing more. - **Children:** a subagent child (`lane: "subagent"`) gets the automations of its own admitted grant: the parent's authority, re-admitted at launch and capped by the child launch's operator scopes (`operator.write`). An owner's or writer's child gets `self`; a child of a read-only or unadmitted parent gets `none`. - **Channel-owner mint:** a channel turn with an admitted operator authority mints channel-owner management only when its grant is `manage`. - **Deleted:** the expired (2026-10-12) `controlUiAdmin` harness getter on the creator capability, and the `controlUiAdmin` admission output (no production reader). - Docs: `automation/cron-jobs/managing-jobs.md` conversational management. ## Decisions (recorded, not asked) - **Deliberate widenings (same principal, same answer):** - An owner on a remote non-UI client (remote CLI, TUI) now manages every automation, like the owner's Control UI. That socket already holds `operator.admin`, so it can already call every `cron.*` method directly; only the model's tool gains reach. - A local CLI owner now also gets the management entitlement (it already had the local creator origin). - **Subagent children get the parent's re-admitted automations right** (MATRIX M9). Before, a child had none. A child never exceeds its parent. It does not reach `manage`: the in-process child launch carries `operator.write`, which caps the child's admitted grant at `self`. Lifting that cap is a launch-scope change, not an automations rule; not in this PR. - **Narrowing (brief rule, openclaw#204904):** a configured `commands.ownerAllowFrom` owner whose verified channel identity is linked to a non-admin personal profile now gets that profile's automations, not channel-owner management. - **Asserted-identity owners keep today's mint.** Signal/WhatsApp/iMessage owners are not admitted through `decideOperatorAdmission` (DESIGN §10, D23): they have no grant to read. Cutting their mint would remove automation management they have today, so the mint still applies when there is no admitted grant. Closing that needs the D23 decision, not this PR. - **Accepted edge:** an authless Gateway that also configures named roles has no owner profile at startup; a local socket turn there is now refused at admission. `mode: "none"` with named roles has no identities to apply roles to, so this combination is not a working setup. - **Split (brief rule: over ~25 files → land steps 1–2 first).** 37 files. Steps 3 (in-session scheduled scope into admission, delete the `automations-run-scope.ts` trigger fallback) and 4 (split the pre-start session-event config check out of the `attempt-session-target.ts` source, delete the R7 re-check) go in the next PR. The replay `automationAdmin` output (saved UI-admin delegation) stays with step 3: it decides what an in-session scheduled run gets. ## User impact - The owner manages automations from chat the same way from any client, including a local client of an authless Gateway. - A subagent of an owner or writer turn can create and edit its own automations. - A channel owner linked to a non-admin profile manages only their own automations from that channel. ## Evidence - **Production lines** (`src`, non-test): +77 / −78 (net −1).. - **Red on base, green on head:** - `message-handler.post-connect-health.test.ts` "admits an authless local socket as the local host": real WS handshake on an authless Gateway, real `prepareGatewayOperatorRunAuthority` → owner profile, `grant.automations: "manage"`. Base returns no authority. - Same file, trusted-proxy person over `openclaw-tui` with `operator.admin`: head gets management through the grant; base gave caller-scoped only. - `agent-run-local-operator-authority.test.ts`: remote Control UI, native app and CLI owners get the same management; a subagent child gets automations from its admitted grant; a local-host admission keeps the request's invocation signal and release (local review round 2). - `operator-admission.table.test.ts`: matrix grants carry `automations` (owner `manage`, writer `self`) for every entry kind. - **Pre-push:** (1) one `ocx test` call over 125 files (touched tests plus importers of every changed source/test-support), then (2) one frozen-tree `ocx test` call over the 32 touched/re-run files: all green except `src/cron/service.pr-automation.test.ts`, which fails the same way on the merge base `2e167172fe19` (13 failed on base, `ocx base merge-base`). `pnpm tsgo:core` and `tsgo:core:test` clean; oxfmt/oxlint clean; line-cap ratchet OK. `pnpm check:changed`: all lanes ok except two that fail on files this PR does not touch (changelog attribution in `CHANGELOG/2026.11.10.md`; Knip unused exports in `update-cli`, `schtasks-process`, `upgrade-survivor`). - **E2E:** see the follow-up comment (Q/R/S on the exact head). Co-authored-by: Ayaan Zaidi <[email protected]>
…ds used (openclaw#205232) ## Problem A channel turn that ran on a provided reply operation could get two owner answers in the same turn (OA2 PR 6b, channel command owner). - Command authorization (`command-auth.ts`) decides `senderIsOwner` once for the turn's commands. - `get-reply-run-execute.ts` then re-read the bound channel owner binding (`getCommandOwnerAuthority(ctx).isCurrent()`) for the agent run when a reply operation was provided. When that binding had ended but the sender was still a configured owner, commands ran as the owner and the run's tools did not. ## Fix - `get-reply-run-execute.ts`: the run takes `command.senderIsOwner`, the decision its commands used. The second read is deleted. Command authorization already includes the bound owner binding, so a bound owner keeps owner status. - Owner-producer lint allowlist (`OWNER_PRODUCER_FILES`): 33 → 32. - `message-action-dispatch.ts` moves under the "scheduled and requester-owner continuations" group in the allowlist. Its `policy === "operator" ? true` is the scheduled job's operator, not a channel command owner; PR 6c owns that cut. No code change. ## Decisions (recorded, not asked) Cut less. A design consult on the full 6b scope picked this option. The other channel command-owner producers stay, each for a stated reason: - `command-auth.ts` keeps the `commands.ownerAllowFrom` config match. Asserted-identity channel owners (iMessage, SMS, IRC, Slack relay) and pre-turn senders (native slash commands, plugin SDK `resolveCommandAuthorization[Async]`) have no admitted grant. A grant with owner and no scopes would need a new admission state and a replay exception, and would put the owner profile on a sender whose identity is only asserted. - `reply-source-admission.ts`: queued asserted owners have no grant. For a linked sender who is also in `commands.ownerAllowFrom`, the grant follows the linked profile (openclaw#204904), so a switch to `grant.owner` would remove owner commands from a listed owner. - `agent-run-user-turn.ts`: `agent` RPC clients with admin scope do not hold an admitted authority when the owner bit is computed. A switch would remove owner from them. - Discord native command auth and Discord voice stay listed: `resolveDiscordOwnerAccess` matches names, tags and Discord prefixes, which the core matcher does not. Voice has no admission until the plugin ingress owner claim is decided (PR 6e). ## User impact - A configured channel owner gets the same owner answer for commands and for the run's tools in one turn. - No other change. ## Evidence - Production (`src` + `extensions`, non-test): +1 / −4. - New cell `get-reply-run.owner-decision.test.ts`: red on base `21958da63e7c` (run not owner while its commands were owner), green on head. - Pre-push: one `ocx test` call over 15 files (touched tests, importers of `get-reply-run-execute.ts` and `get-reply-run.ts`, `test/scripts/oxlint-boundary-guards.test.ts`): all passed. `pnpm tsgo:core` and `pnpm tsgo:test` clean. oxfmt/oxlint clean on changed files. - E2E (one-admission run.sh Q/R/S) on the exact head: results in a follow-up comment. Co-authored-by: Ayaan Zaidi <[email protected]>
Problem
The same person got a different answer depending on how the turn started (OA2 PR 2, channels).
commands.ownerAllowFromgot owner-only commands and tools, but no operator authority. Their channel turns ran as System.github_publishand 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.operator.adminin the matrix fixture), while the same person over Tailscale got theirgateway.auth.identityScopescapped by role. This was the oneKNOWN_DIVERGENTcell left by refactor(gateway): decide what a turn may do once, as a turn grant #204756.message-access/runtime.tsreadisConfiguredCommandOwnerandprepareCommandOwnerAuthority).Fix
src/gateway/operator-admission.tsnow 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.tsonly hands overChannelSenderFacts(verifiedorasserted). It leaves the turn-flag allowlist.decideChannelOwnerPrincipal(config, sender): a verified sender in the globalcommands.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.channelOwner. Queued and continued work re-admits throughdecideOperatorAdmission, which refuses when the sender leftcommands.ownerAllowFrom, like a revoked linked requester. The authority records no durable source, so restart recovery keeps today's path for these turns (session principal).resolveLinkedOperatorScopesuses the socket rule: the verified login'sidentityScopes, capped by role; the role's scopes only when no identity scopes apply.channel-command-user-turn.tsreadsgrant.owner(leaves the owner-producer allowlist).operator-admission.table.test.ts):KNOWN_DIVERGENTis 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.message-access/runtime.ts), owner producers 52 → 51 (channel-command-user-turn.ts).gateway/config-channels/commands.mdstates the owner rule.Decisions (recorded, not asked)
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.get-reply-run.cron-requester.ts; needsgrant.automations), Telegram/Discord native slash-command allowlist composition (a list-membership fact, read before any turn exists),github_publishrequester re-checks (PR 3), restart/durable sources for channel owners (PR 4).channel-operator-authority.tsstays inADMISSION_FILES: its live-identity checks still read role policy.User impact
commands.ownerAllowFromgets the same permissions in the channel as in the Control UI, with no Control UI step.Evidence
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 ofmessage-access/runtime.tsis net zero; the rest is the decision, its replay re-check and thechannelOwnerfact.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.48f162d64bc8(head tests against base code): linked-person cell fails (fresh: { owner: true }vs the Tailscale person'sowner: 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).ocx testcall 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 base48f162d64bc8(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.one-admission-e2e/run.shon headse329c508d869,a804c9d7c2deand6177d4488f81: Q (queued input refused visibly), R (running turn finishes) and S (Stop cancels) all pass (verdict.json+results.jsonlkept in the task proof directory).verified), the realmessage-access/runtime.tsingress 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/statusalready worked there through the owner flag). The visible difference,github_publishfor a Discord owner, lands with PR 3, which owns the live Discord run.