Repository navigation
refactor(admission): listed channel owner wins over a linked profile; Talk reads grant.owner (OA2 PR 6i) - #205451
Conversation
… Talk reads grant.owner - A verified sender in commands.ownerAllowFrom is the owner principal even when its channel identity is linked to a non-admin profile (decideChannelOwnerPrincipal first in the host context builder). - Talk consult owner bit comes from readGatewayRequestAdmission(client).grant.owner; the local admin-scope check and the scopes argument are deleted. - OWNER_PRODUCER_FILES 16 -> 15; matrix cell channel x listed-linked-owner. 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. |
|
|
E2E (one-admission run.sh, isolated Gateway, real |
|
Codex review: needs maintainer review before merge. What this changesThis PR gives verified listed channel owners precedence over linked profiles and makes Talk consume the admitted owner grant. Example: Discord sender 123456789012345678 is listed in commands.ownerAllowFrom and linked to a non-admin profile.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep this PR open: it addresses a current admission mismatch with a focused change, and source review found no actionable correctness or security defect. Reviewed head: Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherChannel ingress binds verified sender facts to a message context, admission produces its operator authority, and agent tools consume that grant; Talk adapts authenticated Gateway clients into the same tool-authority system. flowchart TD
A[Verified channel sender] --> B[Host context builder]
B --> C[Operator admission]
D[Authenticated Talk client] --> E[Request admission reader]
C --> F[Admitted turn grant]
E --> F
F --> G[Agent tool authority]
Technical reviewBest possible solution: Use the existing admission owner to select listed channel owners first and let Talk consume its grant, as this patch does. Do we have a high-confidence way to reproduce the issue? The current-main branch order directly establishes the linked-owner mismatch, and the PR reports a matching regression failing on base; this read-only review executed no target code. Is this the best way to solve the issue? The change is the smallest complete repair: reorder the existing principal selection, reuse the shared Talk admission reader, migrate callers, and extend the existing regression matrix without introducing another authority owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d2e01865d65f. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -2, Tests +6, Docs 0, Other -1. Total +3 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:
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 25, 2026, 12:11 PM ET / 17:11 UTC. |
|
Landed as 8712b18. A verified channel sender listed in |
… requester-owner continuation (OA2 PR 6j) (#205483) ## Problem OA2 PR 6j (one admission owner; split from #205451). A channel owner's requester continuation turn (yield resume after `sessions_yield`, or a `sessions_send` followup returning to the parent) carried a second owner producer next to `grant.owner`: - `cron-creator-authority-context.ts` `bindRequesterOwnerIdentity` read a `requesterOwner` identity that `createReplyCronAuthorityFactory` put on the cron run scope and that `requester-cron-authority.ts` carried to the continuation. - `openclaw-plugin-tools.ts` bound it whenever the turn's own `senderIsOwner` was not `true`, and `tool-factory-context.ts` then made **v2 plugin tools only** see `senderIsOwner = true` and the original owner's `requesterSenderId` / `messageChannel` / `agentAccountId`. - Core tools of the same turn use the turn's own bit. So whenever the continuation changed anything, one turn gave two owner answers: core owner-only tools "not owner", v2 plugin tools "owner". ## Fix - Deleted `bindRequesterOwnerIdentity`, `PluginToolOwnerContinuation`, the `ownerContinuation` parameter (plugin tool resolution and factory context), and the `requesterOwner` field with its whole pass-through chain: cron run scope type and constructor, `createCronCreatorAuthorityCapability`, Gateway cron creator admission, `chat-send-handler`, `chat-send-external-entry`, `agent-run-dispatch`, `requester-cron-authority`, `get-reply-run.cron-requester`. - v2 plugin tools now see the turn's own owner bit (`grant.owner`, or the `ownerAllowFrom` match that `agent-run-user-turn.ts` keeps for asserted-identity requester origins). - `requester-cron-authority.ts` followup capture keys on `managementEntitlement.source === "channel-owner"` instead of `requesterOwner`. Equivalent: the only minter of `channel-owner` (`createReplyCronAuthorityFactory`) always set `requesterOwner`. The automation `manage` transfer is unchanged. - Lint `OWNER_PRODUCER_FILES` 15 → 13 (`openclaw-plugin-tools.ts`, `tool-factory-context.ts` leave). `openclaw-tools.ts` (`spawnSenderIsOwner`), `scheduled-message-invocation.ts` (`profile.sender.isOwner`) and `execution-context-registry.ts` (`memory.owner`) move to the "recorded data read back" group: they read the bit scheduled occurrence admission minted (`facts.authority.owner`), never decide it. `message-action-dispatch.ts` stays as a producer (operator-policy scheduled write, `policy === "operator" ? true`). ## Decisions (recorded, not asked) - **Delete the continuation, do not keep it for asserted owners** (Fable 5.2, pick A): keeping it would keep a second owner producer behind a guard, and it is exactly the split "core says no, plugin says yes" inside one turn. - **No owner answer changes.** In every case where the continuation changed anything, the turn's own bit already says owner: - verified listed owners carry `grant.owner` (since #205451); - asserted-identity channel owners (iMessage, SMS, IRC, Tlon, Slack relay, A2A, Feishu): both continuation kinds carry the requester's channel origin as `agentToolCaller`, and `agent-run-user-turn.ts` sets the turn's owner bit from it through the `ownerAllowFrom` match (`prepareCommandOwnerAuthority`). `sessions_send` followup return: `sessions-send-reply-flow.ts`. `sessions_yield` resume: the spawn records completion custody with `retainRequester: true` (`subagent-registry-run-launch.ts`), the settle wake delivers inside `runWithRequester`, and `subagent-announce-direct-delivery.ts` passes `readRetainedRequesterToolCaller()`. The sender, channel and account stay on the turn. - Matrix cell (this PR, `subagent-registry.requester-automation-custody.test-support.ts`, run by `subagent-registry.completion-authority.test.ts`): "resumes an asserted channel owner's yielded turn as owner with its channel identity". It goes through the real yield mark, settle wake and `prepareAgentRunUserTurn`, for an iMessage `ownerAllowFrom` owner whose grant owner bit is false. It passes on main and on this head. With the retained caller removed (negative control) it fails: `senderIsOwner: false`, `senderId: undefined`. - The earlier `[INFERENCE]` in this body and in the stop comment ("the settle wake carries no requester origin") was wrong and is retracted. - **Not cut (`message-action-dispatch.ts`):** replacing `policy === "operator" ? true` with the run's bit would narrow operator-authorized scheduled message actions of non-owner operators; left for its own PR. ## User impact - v2 plugin tools give the same owner answer as core tools in every requester continuation turn. - No change to who is owner; only the second producer is gone. ## Evidence - Production (`src` + `scripts`, non-test): +16 / −149. - Deleted tests that asserted the removed plugin-only owner continuation: `agent.followup-owner.test.ts`, `server.sessions-send-owner-continuation.test.ts`, the continuation cases in `tool-factory-context.test.ts` and `requester-cron-authority.test.ts`. `sessions-send-owner-continuation.test.ts` now asserts the channel-owner automation management transfer through each followup outcome. - Pre-push: one `ocx test` call (`OPENCLAW_NODE_TEST_PLAN_CONTINUE_ON_FAILURE=1`) over the touched tests plus importers of the changed sources and test-support (90 files, exit 0, all passed); `pnpm tsgo:core`, `pnpm tsgo:test` clean; oxfmt clean; `pnpm check:changed` did not finish in 15 min under host load; CI runs it. - E2E (one-admission run.sh Q/R/S, isolated Gateway, live model): pass on `448d60b8b405`; later heads add only the session-identity allowlist and the test-only matrix cell (no production change). Co-authored-by: Ayaan Zaidi <[email protected]>
… Talk reads grant.owner (OA2 PR 6i) (openclaw#205451) ## Problem OA2 PR 6i (one admission owner, same person same answer). - A verified channel sender listed in `commands.ownerAllowFrom` whose channel identity is also linked to a non-admin profile got that profile's grant, not the owner grant. The same owner over the Control UI (or unlinked in Discord) is the owner. In Discord, `/status`-class commands said "owner" (command-auth matches the owner list) while the run's owner-only tools were refused (they follow `grant.owner`). - Talk decided its consult owner bit itself, from the socket's `operator.admin` scope (`talk/client-tool-authority.ts`). ## Fix - `host-context-builder.ts`: `decideChannelOwnerPrincipal` runs first. A listed verified sender is the owner principal even when linked; an unlisted linked sender keeps its profile's grant, as before. The owner principal records `channelOwner`, so queued, restart and durable work re-admit it against the current owner list (`channel-owner` source, openclaw#205129). - Talk: `resolveTalkAgentConsultAuthority(client)` reads `readGatewayRequestAdmission(client).grant.owner` (the admitted run's grant, else the connection's scopes grant). The local admin-scope check and the duplicate `scopes` argument are deleted (8 callers). - Lint: `OWNER_PRODUCER_FILES` 16 → 15 (Talk leaves). - Docs: `gateway/config-channels/commands.md`, `automation/cron-jobs/managing-jobs.md` state the listed-owner rule. ## Decisions (recorded, not asked) - **Listed owner wins** (one-admission plan, openclaw#205232 follow-up (i)): the list is by definition the owners; same grant as the owner's Control UI turn. Sources saved before this change by a linked listed owner (linked-profile `channel` kind) still restore the profile until that work finishes; named, no code. - **Talk tool context keeps command-auth's owner answer** (Fable 5.2 consult, pick A): `prepareTalkClientToolContext` passes along `resolveCommandAuthorization(...).senderIsOwner`, the same answer the person's `chat.send` turn gets (a Control UI profile id listed in `ownerAllowFrom` is a command owner there too). Removing it from Talk only would make Talk differ from chat. Command-auth's `ownerAllowFrom` match stays the producer for asserted-identity owners and pre-turn senders (openclaw#205232); `client-permission-parity` "configured ownership without admin" stays green unchanged. - **Split (6j):** the plugin requester-owner continuation (`openclaw-plugin-tools`, `tool-factory-context`, `bindRequesterOwnerIdentity` and its `requesterOwner` chain through chat-send, cron creator admission and subagent requester custody, `scheduled-message-invocation`, `message-action-dispatch`, `execution-context-registry`, `openclaw-tools`) is ~15 production files plus tests, over the file cap with this PR. After this PR every verified listed owner carries `grant.owner`; the continuation remains only for asserted-identity owners, which 6j must decide. ## User impact - A Discord/Telegram (any verified channel) owner listed in `commands.ownerAllowFrom` who also linked a member profile now gets owner-only tools, automation management and PR actions in the channel, the same as the owner in the Control UI. - Talk: no change for real sockets (the grant from connection scopes equals the old admin check). ## Evidence - Production (`src` + `scripts`, non-test): +16 / −19. - Matrix cell `operator-admission.table.test.ts` "channel: listed-linked-owner" (real Gateway, real Discord identity declaration, real ingress and host context builder): **red on base `9837ccd07e4d`** (`owner: false, automations: "self", commands: "none"`), green on head. - Pre-push: one `ocx test` call over 26 files (touched tests + importers of every changed source and test-support file, `OPENCLAW_NODE_TEST_PLAN_CONTINUE_ON_FAILURE=1`): all green except `gateway.sessions-send-provenance.e2e.test.ts` (collaborative steering refusal), which fails the same way on base `9837ccd07e4d` (not this change; no `ownerAllowFrom` in that test). `pnpm tsgo:core`, `pnpm tsgo:test`, oxlint and oxfmt clean. `pnpm check:changed`: only the main-owned parallels dead exports (`detectParallelsHostIp`, `listVmNames`) fail. - E2E (one-admission run.sh Q/R/S) on the exact head: see comment. - Live Discord QA bot: not run. The QA flow cannot create a linked member profile in its scratch Gateway (profiles come only from sign-in; `users.linkChannelIdentity` needs an existing non-owner profile). The matrix cell above runs the same Discord ingress path against a real Gateway. Co-authored-by: Ayaan Zaidi <[email protected]>
… requester-owner continuation (OA2 PR 6j) (openclaw#205483) ## Problem OA2 PR 6j (one admission owner; split from openclaw#205451). A channel owner's requester continuation turn (yield resume after `sessions_yield`, or a `sessions_send` followup returning to the parent) carried a second owner producer next to `grant.owner`: - `cron-creator-authority-context.ts` `bindRequesterOwnerIdentity` read a `requesterOwner` identity that `createReplyCronAuthorityFactory` put on the cron run scope and that `requester-cron-authority.ts` carried to the continuation. - `openclaw-plugin-tools.ts` bound it whenever the turn's own `senderIsOwner` was not `true`, and `tool-factory-context.ts` then made **v2 plugin tools only** see `senderIsOwner = true` and the original owner's `requesterSenderId` / `messageChannel` / `agentAccountId`. - Core tools of the same turn use the turn's own bit. So whenever the continuation changed anything, one turn gave two owner answers: core owner-only tools "not owner", v2 plugin tools "owner". ## Fix - Deleted `bindRequesterOwnerIdentity`, `PluginToolOwnerContinuation`, the `ownerContinuation` parameter (plugin tool resolution and factory context), and the `requesterOwner` field with its whole pass-through chain: cron run scope type and constructor, `createCronCreatorAuthorityCapability`, Gateway cron creator admission, `chat-send-handler`, `chat-send-external-entry`, `agent-run-dispatch`, `requester-cron-authority`, `get-reply-run.cron-requester`. - v2 plugin tools now see the turn's own owner bit (`grant.owner`, or the `ownerAllowFrom` match that `agent-run-user-turn.ts` keeps for asserted-identity requester origins). - `requester-cron-authority.ts` followup capture keys on `managementEntitlement.source === "channel-owner"` instead of `requesterOwner`. Equivalent: the only minter of `channel-owner` (`createReplyCronAuthorityFactory`) always set `requesterOwner`. The automation `manage` transfer is unchanged. - Lint `OWNER_PRODUCER_FILES` 15 → 13 (`openclaw-plugin-tools.ts`, `tool-factory-context.ts` leave). `openclaw-tools.ts` (`spawnSenderIsOwner`), `scheduled-message-invocation.ts` (`profile.sender.isOwner`) and `execution-context-registry.ts` (`memory.owner`) move to the "recorded data read back" group: they read the bit scheduled occurrence admission minted (`facts.authority.owner`), never decide it. `message-action-dispatch.ts` stays as a producer (operator-policy scheduled write, `policy === "operator" ? true`). ## Decisions (recorded, not asked) - **Delete the continuation, do not keep it for asserted owners** (Fable 5.2, pick A): keeping it would keep a second owner producer behind a guard, and it is exactly the split "core says no, plugin says yes" inside one turn. - **No owner answer changes.** In every case where the continuation changed anything, the turn's own bit already says owner: - verified listed owners carry `grant.owner` (since openclaw#205451); - asserted-identity channel owners (iMessage, SMS, IRC, Tlon, Slack relay, A2A, Feishu): both continuation kinds carry the requester's channel origin as `agentToolCaller`, and `agent-run-user-turn.ts` sets the turn's owner bit from it through the `ownerAllowFrom` match (`prepareCommandOwnerAuthority`). `sessions_send` followup return: `sessions-send-reply-flow.ts`. `sessions_yield` resume: the spawn records completion custody with `retainRequester: true` (`subagent-registry-run-launch.ts`), the settle wake delivers inside `runWithRequester`, and `subagent-announce-direct-delivery.ts` passes `readRetainedRequesterToolCaller()`. The sender, channel and account stay on the turn. - Matrix cell (this PR, `subagent-registry.requester-automation-custody.test-support.ts`, run by `subagent-registry.completion-authority.test.ts`): "resumes an asserted channel owner's yielded turn as owner with its channel identity". It goes through the real yield mark, settle wake and `prepareAgentRunUserTurn`, for an iMessage `ownerAllowFrom` owner whose grant owner bit is false. It passes on main and on this head. With the retained caller removed (negative control) it fails: `senderIsOwner: false`, `senderId: undefined`. - The earlier `[INFERENCE]` in this body and in the stop comment ("the settle wake carries no requester origin") was wrong and is retracted. - **Not cut (`message-action-dispatch.ts`):** replacing `policy === "operator" ? true` with the run's bit would narrow operator-authorized scheduled message actions of non-owner operators; left for its own PR. ## User impact - v2 plugin tools give the same owner answer as core tools in every requester continuation turn. - No change to who is owner; only the second producer is gone. ## Evidence - Production (`src` + `scripts`, non-test): +16 / −149. - Deleted tests that asserted the removed plugin-only owner continuation: `agent.followup-owner.test.ts`, `server.sessions-send-owner-continuation.test.ts`, the continuation cases in `tool-factory-context.test.ts` and `requester-cron-authority.test.ts`. `sessions-send-owner-continuation.test.ts` now asserts the channel-owner automation management transfer through each followup outcome. - Pre-push: one `ocx test` call (`OPENCLAW_NODE_TEST_PLAN_CONTINUE_ON_FAILURE=1`) over the touched tests plus importers of the changed sources and test-support (90 files, exit 0, all passed); `pnpm tsgo:core`, `pnpm tsgo:test` clean; oxfmt clean; `pnpm check:changed` did not finish in 15 min under host load; CI runs it. - E2E (one-admission run.sh Q/R/S, isolated Gateway, live model): pass on `448d60b8b405`; later heads add only the session-identity allowlist and the test-only matrix cell (no production change). Co-authored-by: Ayaan Zaidi <[email protected]>
Release adaptation: Use the stable admitted scope ceiling for persisted and runtime ownership, keeping configured requester ownership separate. Companion audit: Requester custody and inherited-model companions are already committed. #205303 and #205451 extend the newer grant contract; not required. (cherry picked from commit 1c83c39) Co-authored-by: RomneyDa <[email protected]>
Problem
OA2 PR 6i (one admission owner, same person same answer).
commands.ownerAllowFromwhose channel identity is also linked to a non-admin profile got that profile's grant, not the owner grant. The same owner over the Control UI (or unlinked in Discord) is the owner. In Discord,/status-class commands said "owner" (command-auth matches the owner list) while the run's owner-only tools were refused (they followgrant.owner).operator.adminscope (talk/client-tool-authority.ts).Fix
host-context-builder.ts:decideChannelOwnerPrincipalruns first. A listed verified sender is the owner principal even when linked; an unlisted linked sender keeps its profile's grant, as before. The owner principal recordschannelOwner, so queued, restart and durable work re-admit it against the current owner list (channel-ownersource, refactor(gateway): wake restored processes and channel-owner work as their requester #205129).resolveTalkAgentConsultAuthority(client)readsreadGatewayRequestAdmission(client).grant.owner(the admitted run's grant, else the connection's scopes grant). The local admin-scope check and the duplicatescopesargument are deleted (8 callers).OWNER_PRODUCER_FILES16 → 15 (Talk leaves).gateway/config-channels/commands.md,automation/cron-jobs/managing-jobs.mdstate the listed-owner rule.Decisions (recorded, not asked)
channelkind) still restore the profile until that work finishes; named, no code.prepareTalkClientToolContextpasses alongresolveCommandAuthorization(...).senderIsOwner, the same answer the person'schat.sendturn gets (a Control UI profile id listed inownerAllowFromis a command owner there too). Removing it from Talk only would make Talk differ from chat. Command-auth'sownerAllowFrommatch stays the producer for asserted-identity owners and pre-turn senders (refactor(auto-reply): reply runs take the owner decision their commands used #205232);client-permission-parity"configured ownership without admin" stays green unchanged.openclaw-plugin-tools,tool-factory-context,bindRequesterOwnerIdentityand itsrequesterOwnerchain through chat-send, cron creator admission and subagent requester custody,scheduled-message-invocation,message-action-dispatch,execution-context-registry,openclaw-tools) is ~15 production files plus tests, over the file cap with this PR. After this PR every verified listed owner carriesgrant.owner; the continuation remains only for asserted-identity owners, which 6j must decide.User impact
commands.ownerAllowFromwho also linked a member profile now gets owner-only tools, automation management and PR actions in the channel, the same as the owner in the Control UI.Evidence
src+scripts, non-test): +16 / −19.operator-admission.table.test.ts"channel: listed-linked-owner" (real Gateway, real Discord identity declaration, real ingress and host context builder): red on base1bf2147f0a75(owner: false, automations: "self", commands: "none"), green on head.ocx testcall over 26 files (touched tests + importers of every changed source and test-support file,OPENCLAW_NODE_TEST_PLAN_CONTINUE_ON_FAILURE=1): all green exceptgateway.sessions-send-provenance.e2e.test.ts(collaborative steering refusal), which fails the same way on base1bf2147f0a75(not this change; noownerAllowFromin that test).pnpm tsgo:core,pnpm tsgo:test, oxlint and oxfmt clean.pnpm check:changed: only the main-owned parallels dead exports (detectParallelsHostIp,listVmNames) fail.users.linkChannelIdentityneeds an existing non-owner profile). The matrix cell above runs the same Discord ingress path against a real Gateway.