Skip to content

refactor(admission): listed channel owner wins over a linked profile; Talk reads grant.owner (OA2 PR 6i) - #205451

Merged
obviyus merged 1 commit into
mainfrom
refactor/oa2-owner-sweep-final
Nov 25, 2026
Merged

obviyus merged 1 commit into
mainfrom
refactor/oa2-owner-sweep-final

Conversation

@obviyus

@obviyus obviyus commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

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, refactor(gateway): wake restored processes and channel-owner work as their requester #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, refactor(auto-reply): reply runs take the owner decision their commands used #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 (refactor(auto-reply): reply runs take the owner decision their commands used #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.

… 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]>
@clawsweeper

clawsweeper Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts size: S labels Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

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

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

These security sensitive changes were made:

  • src/gateway/talk/client-tool-authority.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. labels Nov 25, 2026
@obviyus

obviyus commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

E2E (one-admission run.sh, isolated Gateway, real gpt-5.5) on head bebc765c49f8: pass. Q queued input refused visibly (refusal sentence in transcript, 0 provider requests with the queued marker), R running turn finishes after revoke (3 tool ends after revoke), S Stop cancels. verdict.json + results.jsonl kept in the task proof directory.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 25, 2026
@clawsweeper

clawsweeper Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: Commands recognize the sender as owner, but operator tools receive the linked profile's restricted grant.
  • After: The channel turn receives the owner grant, including automation management and owner-only tools.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused patch appears correct and includes a relevant reported regression, but supplied real-setup evidence does not exercise the user-visible fix.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A configured channel owner loses operator capabilities after linking a personal profile, despite owner commands continuing to recognize them.
Reason: The maintainer-authored direction resolves inconsistent permissions using the established admission owner and preserves the documented distinction between verified and asserted identities.

Regression provenance

Possible 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: bebc765c49f8c0687a5b33bef01b7c89908b6256

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Provide redacted live output or a recording showing a verified Discord or Telegram sender linked to a non-admin profile successfully exercising an owner-only operation on this head; redact credentials, personal identifiers, IPs, and non-public endpoints.
Agent review details

How this fits together

Channel 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]
Loading

Technical review

Best 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

  • Channel owner versus linked-profile precedence changes intended behavior with a stated reason (e2a9a6d: The earlier channel admission change retained linked profiles and their recoverable source; this PR explicitly supersedes that exception now that channel-owner recovery exists.)
  • Talk consult authority keeps the original intent (fix(talk): keep voice-only agent consults read-only #125392: Preserve authenticated caller tool limits across browser, relay, and legacy consult paths; the logic later moved unchanged into client-tool-authority.ts in 99caa18.)
  • Owner-producer guard and documentation keeps the original intent (refactor(auto-reply): reply runs take the owner decision their commands used #205232: Shrink independent owner producers while retaining command authorization for asserted identities and pre-turn senders; the patch removes only Talk's independent calculation and documents the new verified-owner precedence.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit e2a9a6d adds src/channels/inbound-event/host-context-builder.ts:179 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e2a9a6d6f3e8; files: src/channels/inbound-event/host-context-builder.ts)
  • Vincent Koc: Raw commit 99caa18 adds src/gateway/talk/client-tool-authority.ts:29 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 99caa18ecd28; files: src/gateway/talk/client-tool-authority.ts)

PR surface

Source -2, Tests +6, Docs 0, Other -1. Total +3 across 16 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 16 18 -2
Tests 8 16 10 +6
Docs 2 2 2 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 16 34 31 +3

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 25, 2026, 12:11 PM ET / 17:11 UTC.

@obviyus
obviyus merged commit 8712b18 into main Nov 25, 2026
155 checks passed
@obviyus
obviyus deleted the refactor/oa2-owner-sweep-final branch November 25, 2026 17:15
@obviyus

obviyus commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as 8712b18. A verified channel sender listed in commands.ownerAllowFrom is now the owner principal even when linked to a non-admin profile (matrix cell red on base, green on head), and Talk's consult owner bit reads the admitted grant. Proof: CI green on the exact head, clean local review, E2E Q/R/S pass. The plugin requester-owner continuation follows as a separate PR.

obviyus added a commit that referenced this pull request Nov 25, 2026
… 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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 26, 2026
… 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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 26, 2026
… 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]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts security-sensitive-changed size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant