Repository navigation
refactor(auto-reply): reply runs take the owner decision their commands used - #205232
Conversation
…ds used A provided reply operation re-read the bound channel owner binding instead of the command authorization the same turn already computed, so commands and the run could disagree. The run now passes command.senderIsOwner through. Owner-producer allowlist 33 -> 32. message-action-dispatch is regrouped under scheduled continuations (it carries the job operator, not a channel command 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 journeys, isolated Gateway, live model
Live Discord QA bot run not used: this PR changes only the owner bit on a provided reply operation whose ingress binding has ended. Normal Discord owner verdict.json{
"pass": true,
"prefix": "HEAD",
"sessionKey": "agent:main:one-admission-13b60549",
"models": [
"gpt-5.5-2026-04-23"
],
"relayStatuses": [
200
],
"checks": [
{
"id": "R.running-turn-finishes",
"pass": true,
"detail": {
"state": "final",
"toolEnds": 3,
"toolEndsAfterRevoke": 3
}
},
{
"id": "Q.queued-input-refused-visibly",
"pass": true,
"detail": {
"accepted": true,
"providerRequestsWithQueuedMarker": 0,
"visibleRefusalInTranscript": true
}
},
{
"id": "S.stop-cancels",
"pass": true,
"detail": {
"abort": {
"ok": true,
"aborted": true,
"runIds": [
"a6686711-ce5d-4e80-a858-b74df24fae55"
]
},
"state": "aborted",
"requestsWithStopMarker": 1
}
}
],
"elapsedMs": 55531
}results.jsonl: 28 records, kept with the task proof. |
|
Codex review: needs maintainer review before merge. What this changesThis PR makes reply runs reuse the owner decision already computed for their commands. Example: A configured channel owner has command.senderIsOwner=true and a provided reply operation whose ingress binding returns false.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it repairs a source-confirmed owner-decision mismatch still present on current main, and review found no introduced correctness defect. Reviewed head: Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherChannel command authorization computes sender ownership; reply preparation carries that decision into the agent runner, while queued starts retain their separate admission owner. flowchart TD
A[Channel sender] --> B[Command authorization]
B --> C[Prepared reply]
C --> D[Agent runner]
D --> E[Owner tools]
C --> F[Queued start admission]
F --> D
Technical reviewBest possible solution: Keep command authorization as the single owner decision for provided reply operations and preserve fresh admission for queued starts. Do we have a high-confidence way to reproduce the issue? Source establishes the mismatch when command ownership is true, a provided reply operation exists, and its bound owner check returns false; the author reports the focused regression fails on base and passes on head. Is this the best way to solve the issue? The patch is the smallest complete repair: it deletes the competing decision, reuses the existing command result, and tightens the existing lint guard without adding runtime machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1ea3d5f4941d. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
PR surfaceSource -3, Tests +40, Other 0. Total +37 across 4 files. Added test files: 1. 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, 3:59 AM ET / 08:59 UTC. |
|
Landed as d7127cd. The run on a provided reply operation now uses the owner decision that the same turn's commands used. Before, it re-read the bound channel owner binding, so commands and tools could disagree. Proof: the new cell |
…5263) ## Problem The `agent` RPC turn decided its own owner bit before admission ran (OA2 PR 6f, follow-up (ii) of #205232). - `prepareAgentRunDispatch` recorded the user turn first and ran admission (`retainAgentTurnOperatorRun`) afterwards. Only private completions were admitted first. - So `agent-run-user-turn.ts` had no admitted grant and decided owner locally: `hasGatewayAdminScope(client)` plus four requester-origin shape rules. That is a second owner producer next to `decideTurnGrant`. - Result: any client that carried `operator.admin` was owner on `agent` turns, admitted or not. Example: a subagent spawned from an unadmitted System turn with a model override carries `[operator.admin]` only to allow the override, and its child turn became owner. ## Fix - `agent-run-admission-phase.ts`: every `agent` turn is admitted before its input is recorded (the private-completion path, generalized). The System-turn source choice reads the request's input provenance. The second admission block after input recording is deleted. - `prepareAgentRunUserTurn` takes `senderIsOwner` = the admitted grant's `owner`. The transcript stamp and the run use it. - Deleted `resolveRuntimeSenderIsOwner` (the admin-scope and origin-shape rules). ## Decisions (recorded, not asked) - **Cut less (Fable 5.2):** the `commands.ownerAllowFrom` match for a requester origin from a channel (`prepareCommandOwnerAuthority`, `:449-465` on base) stays. Asserted-identity channel owners (iMessage, SMS, IRC, Tlon, Slack relay, A2A, Feishu) have no admitted grant. Their own channel turn keeps owner through `command-auth.ts` (DESIGN §10 fork 2A). Without this match, their subagent and completion turns would silently lose owner-only tools. It is the same decision `command-auth.ts` makes for the channel turn, not a second implementation. Because of it, `agent-run-user-turn.ts` stays in `OWNER_PRODUCER_FILES`, and the allowlist does not shrink in this PR. - **Accepted behavior change (unadmitted turns only):** a synthetic System client that holds `operator.admin` without an admitted operator authority is no longer owner on `agent` turns. Its admin scope authorizes the model override only. This matches MATRIX (SYS → owner ✗). Real socket clients (shared-token CLI, paired admin device, authenticated admin profile), inherited admitted callers and verified-channel owners get the same answer as before: the grant's owner bit. - An admission refusal now happens before the input is recorded. The RPC caller gets the same error (`INVALID_REQUEST`). A returned result still records its "could not start under your current access" notice. ## User impact - `openclaw agent` (Gateway mode) and the Control UI give the same owner answer for the same credential, from the same grant. - No change for admitted turns. Unadmitted System `agent` turns lose owner-only tools. ## Evidence - Production (`src`, non-test): +40 / −64 (3 files). - Owner cells in `agent.owner-policy.test-support.ts` (run by `agent.test.ts`): admitted admin CLI → owner; admitted write CLI → not owner; authenticated admin/write profile; admitted operator continuation; configured asserted channel owner → owner; **unadmitted admin-scoped CLI and unadmitted System admin → not owner (red on base: base answered owner from the scope)**. - Pre-push: one `ocx test` call over the touched tests and importers of the changed files; `pnpm tsgo:core`, `pnpm tsgo:test`; oxfmt/oxlint 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]>
…ant (#205303) ## Problem OA2 PR 6d (one admission owner). Four request entries decided "the sender is the owner" for themselves, from the connection's `operator.admin` scope: - `conversations.send` / `conversations.turn` (`server-methods/conversations.ts`) - `tools.invoke` RPC (`server-methods/tools-invoke.ts`) - session resource tool policy (`session-resource-tool-policy.ts`, MCP App and session resource methods) - OpenAI-compatible HTTP pre-run owner bit (`openai-compatible-http.ts`) That gave the same person two answers. An agent's `conversations_send` / `conversations_turn` tool (owner-only) and plugin `tools.invoke` calls dispatch in process with least-privilege scopes (`operator.write`) and the run's admitted authority. The handler ignored the admitted grant and saw "not owner", so the owner's own agent ran the conversation turn without owner tools, while the same owner calling the same method from the Control UI was owner. ## Fix - `operator-admission.ts` exports `readGatewayRequestAdmission(client)`: the request's grant is its admitted run's grant (`client.internal.operatorRunAuthority.grant`), else the grant `decideTurnGrant` decides from the connection scopes. - `conversations`, `tools.invoke` and the session resource tool policy read `….grant.owner` from it. - OpenAI-compatible HTTP: `prepareOpenAiCompatibleHttpRequest` returns `grant = decideTurnGrant(operatorScopes)` (the same request scopes the run is admitted with); `/v1/chat/completions` and `/v1/responses` session checks read `grant.owner`. - Lint: `OWNER_PRODUCER_FILES` 28 → 24 (four request files leave; ceiling lowered). ## Decisions (recorded, not asked) - **The admitted run's grant wins over the in-process client's least-privilege scopes.** The synthetic scopes narrow which Gateway method may run, not who the requester is. Owner-only conversation tools already require an owner run, so the owner now keeps owner status in the conversation turn they started. A member run stays non-owner (cell below). - **No full `decideOperatorAdmission` per RPC request.** Request admission (method authorization) is OA3; this PR only removes the second owner producers. A bare socket still gets the grant its connect scopes decide, through `decideTurnGrant`. - **Talk not moved (split).** `talk/client-tool-authority.ts` stays listed. The Talk tool overlay takes the owner from `resolveCommandAuthorization`, which includes the `commands.ownerAllowFrom` match for a Talk caller without admin (`client-permission-parity` "uses configured ownership without admin"). Moving only the consult bit would leave consult and tools able to disagree and would make the file look migrated. Talk moves when admission represents configured owners (#205232 follow-up (i)). - **Production lines (recorded):** `src` non-test +21 / −16 (net +5), counting the lint allowlist net 0. The +7 is the one request-grant read in the admission owner. The cause is missing code: request entries never read the admitted grant. No flag, hook or state was added. - **Kept:** `resolveOpenAiCompatibleHttpSenderIsOwner` for the model-override and managed-image checks (pre-run request checks, not owner producers; OA3 seam, same as #205091). ## User impact - An owner's agent that uses `conversations_turn` / `conversations_send`, or a plugin that calls `tools.invoke` in process, now runs with the owner's tools, the same as the owner calling the method directly. - Non-owners see no change. Control UI, Talk and HTTP owners see no change. ## Evidence - Cells (red on base `71b629c5f86e`, green on head): `conversations.test.ts` and new `tools-invoke.test.ts`, each owner socket / write socket / owner run (write scopes + admitted owner authority) / member run. Base: only `owner run` fails (`senderIsOwner: false`); head: 8/8. - Pre-push and E2E: see comments. - Pre-push: one `ocx test` call over 55 files (touched tests + direct importers of every changed source/test-support, `OPENCLAW_NODE_TEST_PLAN_CONTINUE_ON_FAILURE=1`). 1 OURS (`client-permission-parity` configured owner): Talk cut from this PR, green. 42 Talk handler failures (`client-create-authority`, `talk/handlers/client`, `talk/handlers/index`) fail identically on base `71b629c5f86e` (`Cannot read properties of undefined (reading 'role')`): not this change. One `openai-http` SSE case timed out at load 74; green on rerun (112/112). After rebase: `pnpm tsgo:core`, `pnpm tsgo:test` clean; cells + lint guard green; oxfmt/oxlint clean. Co-authored-by: Ayaan Zaidi <[email protected]>
… Talk reads grant.owner (OA2 PR 6i) (#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, #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, #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 (#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 `1bf2147f0a75`** (`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 `1bf2147f0a75` (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]>
…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]>
…nclaw#205263) ## Problem The `agent` RPC turn decided its own owner bit before admission ran (OA2 PR 6f, follow-up (ii) of openclaw#205232). - `prepareAgentRunDispatch` recorded the user turn first and ran admission (`retainAgentTurnOperatorRun`) afterwards. Only private completions were admitted first. - So `agent-run-user-turn.ts` had no admitted grant and decided owner locally: `hasGatewayAdminScope(client)` plus four requester-origin shape rules. That is a second owner producer next to `decideTurnGrant`. - Result: any client that carried `operator.admin` was owner on `agent` turns, admitted or not. Example: a subagent spawned from an unadmitted System turn with a model override carries `[operator.admin]` only to allow the override, and its child turn became owner. ## Fix - `agent-run-admission-phase.ts`: every `agent` turn is admitted before its input is recorded (the private-completion path, generalized). The System-turn source choice reads the request's input provenance. The second admission block after input recording is deleted. - `prepareAgentRunUserTurn` takes `senderIsOwner` = the admitted grant's `owner`. The transcript stamp and the run use it. - Deleted `resolveRuntimeSenderIsOwner` (the admin-scope and origin-shape rules). ## Decisions (recorded, not asked) - **Cut less (Fable 5.2):** the `commands.ownerAllowFrom` match for a requester origin from a channel (`prepareCommandOwnerAuthority`, `:449-465` on base) stays. Asserted-identity channel owners (iMessage, SMS, IRC, Tlon, Slack relay, A2A, Feishu) have no admitted grant. Their own channel turn keeps owner through `command-auth.ts` (DESIGN §10 fork 2A). Without this match, their subagent and completion turns would silently lose owner-only tools. It is the same decision `command-auth.ts` makes for the channel turn, not a second implementation. Because of it, `agent-run-user-turn.ts` stays in `OWNER_PRODUCER_FILES`, and the allowlist does not shrink in this PR. - **Accepted behavior change (unadmitted turns only):** a synthetic System client that holds `operator.admin` without an admitted operator authority is no longer owner on `agent` turns. Its admin scope authorizes the model override only. This matches MATRIX (SYS → owner ✗). Real socket clients (shared-token CLI, paired admin device, authenticated admin profile), inherited admitted callers and verified-channel owners get the same answer as before: the grant's owner bit. - An admission refusal now happens before the input is recorded. The RPC caller gets the same error (`INVALID_REQUEST`). A returned result still records its "could not start under your current access" notice. ## User impact - `openclaw agent` (Gateway mode) and the Control UI give the same owner answer for the same credential, from the same grant. - No change for admitted turns. Unadmitted System `agent` turns lose owner-only tools. ## Evidence - Production (`src`, non-test): +40 / −64 (3 files). - Owner cells in `agent.owner-policy.test-support.ts` (run by `agent.test.ts`): admitted admin CLI → owner; admitted write CLI → not owner; authenticated admin/write profile; admitted operator continuation; configured asserted channel owner → owner; **unadmitted admin-scoped CLI and unadmitted System admin → not owner (red on base: base answered owner from the scope)**. - Pre-push: one `ocx test` call over the touched tests and importers of the changed files; `pnpm tsgo:core`, `pnpm tsgo:test`; oxfmt/oxlint 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]>
…ant (openclaw#205303) ## Problem OA2 PR 6d (one admission owner). Four request entries decided "the sender is the owner" for themselves, from the connection's `operator.admin` scope: - `conversations.send` / `conversations.turn` (`server-methods/conversations.ts`) - `tools.invoke` RPC (`server-methods/tools-invoke.ts`) - session resource tool policy (`session-resource-tool-policy.ts`, MCP App and session resource methods) - OpenAI-compatible HTTP pre-run owner bit (`openai-compatible-http.ts`) That gave the same person two answers. An agent's `conversations_send` / `conversations_turn` tool (owner-only) and plugin `tools.invoke` calls dispatch in process with least-privilege scopes (`operator.write`) and the run's admitted authority. The handler ignored the admitted grant and saw "not owner", so the owner's own agent ran the conversation turn without owner tools, while the same owner calling the same method from the Control UI was owner. ## Fix - `operator-admission.ts` exports `readGatewayRequestAdmission(client)`: the request's grant is its admitted run's grant (`client.internal.operatorRunAuthority.grant`), else the grant `decideTurnGrant` decides from the connection scopes. - `conversations`, `tools.invoke` and the session resource tool policy read `….grant.owner` from it. - OpenAI-compatible HTTP: `prepareOpenAiCompatibleHttpRequest` returns `grant = decideTurnGrant(operatorScopes)` (the same request scopes the run is admitted with); `/v1/chat/completions` and `/v1/responses` session checks read `grant.owner`. - Lint: `OWNER_PRODUCER_FILES` 28 → 24 (four request files leave; ceiling lowered). ## Decisions (recorded, not asked) - **The admitted run's grant wins over the in-process client's least-privilege scopes.** The synthetic scopes narrow which Gateway method may run, not who the requester is. Owner-only conversation tools already require an owner run, so the owner now keeps owner status in the conversation turn they started. A member run stays non-owner (cell below). - **No full `decideOperatorAdmission` per RPC request.** Request admission (method authorization) is OA3; this PR only removes the second owner producers. A bare socket still gets the grant its connect scopes decide, through `decideTurnGrant`. - **Talk not moved (split).** `talk/client-tool-authority.ts` stays listed. The Talk tool overlay takes the owner from `resolveCommandAuthorization`, which includes the `commands.ownerAllowFrom` match for a Talk caller without admin (`client-permission-parity` "uses configured ownership without admin"). Moving only the consult bit would leave consult and tools able to disagree and would make the file look migrated. Talk moves when admission represents configured owners (openclaw#205232 follow-up (i)). - **Production lines (recorded):** `src` non-test +21 / −16 (net +5), counting the lint allowlist net 0. The +7 is the one request-grant read in the admission owner. The cause is missing code: request entries never read the admitted grant. No flag, hook or state was added. - **Kept:** `resolveOpenAiCompatibleHttpSenderIsOwner` for the model-override and managed-image checks (pre-run request checks, not owner producers; OA3 seam, same as openclaw#205091). ## User impact - An owner's agent that uses `conversations_turn` / `conversations_send`, or a plugin that calls `tools.invoke` in process, now runs with the owner's tools, the same as the owner calling the method directly. - Non-owners see no change. Control UI, Talk and HTTP owners see no change. ## Evidence - Cells (red on base `1a4f4a41098c`, green on head): `conversations.test.ts` and new `tools-invoke.test.ts`, each owner socket / write socket / owner run (write scopes + admitted owner authority) / member run. Base: only `owner run` fails (`senderIsOwner: false`); head: 8/8. - Pre-push and E2E: see comments. - Pre-push: one `ocx test` call over 55 files (touched tests + direct importers of every changed source/test-support, `OPENCLAW_NODE_TEST_PLAN_CONTINUE_ON_FAILURE=1`). 1 OURS (`client-permission-parity` configured owner): Talk cut from this PR, green. 42 Talk handler failures (`client-create-authority`, `talk/handlers/client`, `talk/handlers/index`) fail identically on base `1a4f4a41098c` (`Cannot read properties of undefined (reading 'role')`): not this change. One `openai-http` SSE case timed out at load 74; green on rerun (112/112). After rebase: `pnpm tsgo:core`, `pnpm tsgo:test` clean; cells + lint guard green; oxfmt/oxlint clean. 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]>
Release adaptation: Select the existing turn authority as the requester source; retain stable invocation, workflow, and data fences. Companions: #205082 and #205173 affect automations, #205155 and #205184 affect channel trust, and #205232 affects reply dispatch; none is a prerequisite to selecting the already-admitted requester. (cherry picked from commit ddc8340) Co-authored-by: RomneyDa <[email protected]>
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-auth.ts) decidessenderIsOwneronce for the turn's commands.get-reply-run-execute.tsthen 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 takescommand.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_FILES): 33 → 32.message-action-dispatch.tsmoves under the "scheduled and requester-owner continuations" group in the allowlist. Itspolicy === "operator" ? trueis 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.tskeeps thecommands.ownerAllowFromconfig match. Asserted-identity channel owners (iMessage, SMS, IRC, Slack relay) and pre-turn senders (native slash commands, plugin SDKresolveCommandAuthorization[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 incommands.ownerAllowFrom, the grant follows the linked profile (refactor(channels): admit channel senders through the turn grant #204904), so a switch togrant.ownerwould remove owner commands from a listed owner.agent-run-user-turn.ts:agentRPC clients with admin scope do not hold an admitted authority when the owner bit is computed. A switch would remove owner from them.resolveDiscordOwnerAccessmatches 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
Evidence
src+extensions, non-test): +1 / −4.get-reply-run.owner-decision.test.ts: red on baseda3479a658bf(run not owner while its commands were owner), green on head.ocx testcall over 15 files (touched tests, importers ofget-reply-run-execute.tsandget-reply-run.ts,test/scripts/oxlint-boundary-guards.test.ts): all passed.pnpm tsgo:coreandpnpm tsgo:testclean. oxfmt/oxlint clean on changed files.