Skip to content

refactor(plugins): plugin tools take the turn's owner bit; delete the requester-owner continuation (OA2 PR 6j) - #205483

Merged
obviyus merged 3 commits into
mainfrom
refactor/oa2-plugin-requester-owner
Nov 25, 2026
Merged

obviyus merged 3 commits into
mainfrom
refactor/oa2-plugin-requester-owner

Conversation

@obviyus

@obviyus obviyus commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

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 refactor(admission): listed channel owner wins over a linked profile; Talk reads grant.owner (OA2 PR 6i) #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).

… requester-owner continuation (OA2 PR 6j)

- Delete bindRequesterOwnerIdentity, PluginToolOwnerContinuation, ownerContinuation and the requesterOwner field chain.
- v2 plugin tools see the turn's own senderIsOwner (grant.owner or the agent-run-user-turn ownerAllowFrom match).
- Followup capture keys on the channel-owner management entitlement; automation management transfer unchanged.
- OWNER_PRODUCER_FILES 15 -> 13; scheduled read-backs regrouped.

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 gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling size: XL labels Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

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: 6175b0a9a0c1e67f21be1ce747ee8092d6ac5dae
  • Maintainer: @obviyus
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/cron-creator-authority-context.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/subagents/requester-cron-authority.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/gateway/cron-creator-authority-grant.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/cron-creator-authority-grant.types.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server-methods/cron-creator-authority-admission.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, live model) on exact head 448d60b8b405: verdict pass. Checks: [{"id":"R.running-turn-finishes","pass":true},{"id":"Q.queued-input-refused-visibly","pass":true},{"id":"Q.refusal-sentence-in-transcript","pass":true},{"id":"S.stop-cancels","pass":true}]. Q (queued input refused visibly), R (running turn finishes after revoke), S (Stop cancels) all pass.

@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. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 makes plugin tools consume the turn’s owner decision and removes the separate requester-owner continuation chain.

Example: A resumed parent has senderIsOwner=false and a retained requester-owner binding.

  • Before: Version-2 plugin tools can see senderIsOwner=true and the original requester’s identity while core tools see false.
  • After: Plugin tools receive the same false owner bit and current-turn identity as core tools.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and has no identified blocking code defect, but the supplied live evidence does not exercise the changed continuation path.
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) 2 actionable review findings remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: A continued turn can give core tools and version-2 plugin tools different answers about whether the requester is an owner.
Reason: The maintainer has chosen one admission-owned answer, and the patch removes the competing mechanism with substantially less production code.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR makes a useful, focused ownership simplification, with no blocking code defect found; its continuation documentation and stated impact need correction.

Reviewed head: 448d60b8b4054b665b3ccc8ff6bbac528a9d3e24

Before merge

None.

Findings

  • [P3] Update the SDK continuation contract after removing its owner binding — src/plugins/tool-factory-context.ts:41-42
  • [P3] Correct the asserted-owner yield-resume impact claim — src/agents/openclaw-plugin-tools.ts:349-350

Tests

  • Missing end-to-end proof: Provide redacted output from an isolated Gateway showing core/plugin owner agreement and requester identity after actual sessions_yield and sessions_send returns, including the claimed narrowed case or evidence that ordinary requester re-entry preserves it; the supplied Q/R/S result and reported green tests do not demonstrate this behavior or a base/head regression.
Agent review details

How this fits together

Gateway admission prepares turn authority, agent assembly passes it into plugin factories, and registered plugin tools use that context when executing effects.

flowchart LR
  A[Incoming request or completion] --> B[Gateway turn admission]
  B --> C[Turn owner decision]
  C --> D[Core tools]
  C --> E[Plugin factory context]
  E --> F[Plugin tool effects]
  B --> G[Automation management continuation]
Loading

Technical review

Best possible solution:

Keep the single turn-owned authority path, align the continuation documentation and impact description, and demonstrate the affected plugin flow.

Do we have a high-confidence way to reproduce the issue?

Current main contains the plugin-only owner override, so the split decision is source-reproducible when a valid continuation binding accompanies a false turn bit; the claimed ordinary asserted-owner yield trigger is not established because requester retention already exists.

Is this the best way to solve the issue?

Deleting the parallel producer is the smallest coherent implementation, but the impact analysis must account for merged requester re-entry rather than assuming every yield-settle dispatch lacks a personal caller.

Full review comments:

  • [P3] Update the SDK continuation contract after removing its owner binding — src/plugins/tool-factory-context.ts:41-42
    The public guide still promises that a continuation checks the original owner’s live exact-parent binding, and the factory type still describes version 2 as opting into owner-authorized continuations. This hunk removes that additional binding and identity promotion. Update https://docs.openclaw.ai/plugins/tool-plugins and the type description to explain that version 2 requires invocation authority while owner and requester facts come from the turn.
    Confidence: 0.99
  • [P3] Correct the asserted-owner yield-resume impact claim — src/agents/openclaw-plugin-tools.ts:349-350
    The body attributes the named narrowing to settle delivery having no personal caller. However, merged fix: retain channel requester when child completion resumes parent #199674 already captures retainRequester, calls runWithRequester for a compatible completion batch, and supplies readRetainedRequesterToolCaller to admission; agent-run-user-turn then performs the asserted-owner match. Correct the impact description to identify the actual case where the turn remains non-owner rather than presenting ordinary single-requester yield completion as that case.
    Confidence: 0.97

Overall correctness: patch is correct
Overall confidence: 0.89

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against d251941b6c27.

Provenance checked

  • Plugin-only owner continuation changes intended behavior with a stated reason (861f60e: Preserve guarded owner-only plugin operations when the exact parent resumes after sessions_yield.)
  • Child follow-up owner transfer changes intended behavior with a stated reason (9c5a1c3: Keep the parent able to finish owner-authorized work after successful or failed sessions_send child results.)
  • Started-task authority lifetime keeps the original intent (6889108: Check issuer authority at admission while retaining run-liveness, Stop, and exact continuation custody checks.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit 096214a adds src/agents/cron-creator-authority-context.ts:156 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 096214ac84dc; files: src/agents/cron-creator-authority-context.ts)
  • Vito Cappello: Raw commit 9c5a1c3 adds src/agents/subagents/requester-cron-authority.ts:39 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9c5a1c3c9cf7; files: src/agents/subagents/requester-cron-authority.ts)
  • Peter Steinberger: Raw commit 3ae3e4d adds src/agents/subagents/requester-cron-authority.ts:15 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 3ae3e4dc88ed; files: src/agents/subagents/requester-cron-authority.ts)

PR surface

Source -132, Tests -879, Other -1. Total -1012 across 27 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 12 10 142 -132
Tests 14 27 906 -879
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 6 7 -1
Total 27 43 1055 -1012

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.

Review metrics

Metric Value Why it matters
Production versus test changes Production +16/−149; tests and test support +27/−906 The reduction removes the parallel authority chain and tests dedicated to it while retaining automation-management and invocation-lifecycle coverage.

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: Version-2 plugin contexts lose the separate continued-owner promotion and original-requester identity override; the maintainer explicitly accepts using the turn’s own values instead.
  • 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:

  • merge-risk: 🚨 compatibility: Version-2 plugin contexts lose the separate continued-owner promotion and original-requester identity override; the maintainer explicitly accepts using the turn’s own values instead.
  • 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.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Provide Gateway evidence for the changed plugin continuation behavior.

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, 1:11 PM ET / 18:11 UTC.

@obviyus

obviyus commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

Held, not merging (stop-and-report).

The brief for this PR requires the same owner answer per principal as today; any intended change stops. This head carries one intended change (named in the body): an asserted-identity channel owner (iMessage, SMS, IRC, Tlon, Slack relay, A2A, Feishu) whose sessions_yield resume turn has a false owner bit loses owner in v2 plugin tools there, and those tools lose the original requesterSenderId / messageChannel / agentAccountId.

Differing cell: asserted-identity channel owner (asserted OWN) × yield resume (E12 requester continuation), v2 plugin tools: main = owner ✓ (through the continuation), this head = owner ✗ (the turn's own bit; [INFERENCE] the settle wake carries no requester origin).

Proposed split:

  1. First PR: the yield-resume dispatch carries the requester's channel requesterOrigin as agentToolCaller (as the sessions_send followup return already does), so agent-run-user-turn.ts sets the turn's own owner bit for asserted owners. Include a matrix cell: asserted owner yield resume → turn senderIsOwner true.
  2. Then this deletion (head ce6496c3fb) lands with no owner change: the continuation is only bound when the turn bit is not true.

CI on this head: only checks-fast-baseline-ratchets was ours (session-identity pin shrink, fixed in ce6496c3fb); server.chat-goal is MAIN-ALSO. Local review clean on both heads. E2E Q/R/S pass on 448d60b8b405.

OA2 matrix cell: an asserted-identity channel owner's resume turn after
sessions_yield admits as owner and keeps its channel sender, through the
retained completion requester (no requester-owner continuation needed).

Co-authored-by: obviyus <[email protected]>
@obviyus

obviyus commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

Retraction of the stop comment above: the stop rested on an [INFERENCE] that was wrong. The sessions_yield settle wake does carry the requester's channel origin: 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() as agentToolCaller. So agent-run-user-turn.ts sets the resume turn's owner bit for an asserted-identity ownerAllowFrom owner, and keeps sender, channel and account.

New matrix cell on head 6175b0a9a0c1 (test-only commit, subagent-registry.requester-automation-custody.test-support.ts via subagent-registry.completion-authority.test.ts): "resumes an asserted channel owner's yielded turn as owner with its channel identity". It passes on main and on this head, and fails (senderIsOwner: false, senderId: undefined) with the retained caller removed. This PR changes no owner answer. The split is withdrawn; body updated.

@obviyus

obviyus commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator Author

Maintainer override: the only red on head 6175b0a9a0c1 is not ours.

# PR #205483 head 6175b0a9a0c1; main run 45664630214
checks-node-changed-compact-large-3-1	src/gateway/server.chat-goal.test.ts	MAIN-ALSO

Failing case: server.chat-goal.test.ts > Goal chat admission and continuation > leaves no fresh Goal when creation revoked after admission (expects /cannot create sessions/, gets "I did not start a session with agent …"). The same case is red on main run 45664630214 and on the previous head 448d60b8b405. This PR only drops a pass-through argument in chat-send-handler.ts / chat-send-external-entry.ts; it does not touch Goal creation or its refusal text.

@obviyus
obviyus merged commit 8027293 into main Nov 25, 2026
157 of 161 checks passed
@obviyus
obviyus deleted the refactor/oa2-plugin-requester-owner branch November 25, 2026 19:03
@obviyus

obviyus commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as 8027293. v2 plugin tools now take the turn's own owner bit. The requester-owner continuation and its requesterOwner chain are gone, with production code at +16/−149 and OWNER_PRODUCER_FILES down from 15 to 13. Proof: the asserted-owner sessions_yield resume matrix cell (owner and channel sender kept), E2E Q/R/S pass, local review clean on the exact head. The only CI red was MAIN-ALSO server.chat-goal, overridden.

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
…chiving (#205026)

* fix(sessions): keep inactive chats eligible for cold storage after archiving

* test(sessions): align archive fixtures and identity baseline

* test(sessions): create a private cold backup restore target

(cherry picked from commit 81d69df)

Follow-ups: 7cb8975 fix: keep forked Claude chats separate after a Gateway crash (#208048) [separately ordered lane row]; ece7a74 improve(workboard): apply the Control UI glossary and style to Workboard copy [not selected for this narrow backport]; b616036 refactor(subagents): simplify ACP spawn relay ownership (#207023) [not selected for this narrow backport]; 93ca762 improve: reduce allocations when preparing session rows (#207109) [not selected for this narrow backport]; 9993328 refactor(subagents): simplify kill claim and ownership handling (#207025) [not selected for this narrow backport]; 97815bd refactor(subagents): consolidate registry cleanup and publication guards (#207064) [not selected for this narrow backport]; e94f799 refactor(subagents): centralize requester turn matching (#206584) [not selected for this narrow backport]; ea77ca3 refactor: report update failures from recorded runs (#206700) [not selected for this narrow backport]; 4d7e00b fix: let started participant runs and requests finish after an access change (#206747) [not selected for this narrow backport]; f89ae43 refactor(subagents): use cleanup and terminal owners in sweeps (#206533) [not selected for this narrow backport]; a882e0f fix(agents): preserve task answers when sessions are reused (#126263) [not selected for this narrow backport]; 81fc833 refactor(subagents): own dormant child Stop decisions (#206479) [not selected for this narrow backport]; 91d4912 fix(update): stop using foreign recovery records as admission (#206295) [not selected for this narrow backport]; be3c73e fix(subagents): finish claimed stops after session rotation (#206405) [not selected for this narrow backport]; ed8b883 fix(update): settle after plugins and share one completion summary (#205987) [not selected for this narrow backport]; 1de306e fix: pause interrupted shell turns when their result is unknown (#205859) [separately ordered lane row]; 16a6aa4 fix(memory): keep a child's memory audience after its parent resets (#205887) [not selected for this narrow backport]; 50a7368 feat: let agents snooze a conversation after replying [not selected for this narrow backport]; 40f3903 fix(ci): remove unused role and workflow exports (#205720) [not selected for this narrow backport]; e43debf refactor(state): migrate in place and remove copy-and-swap (#205165) [not selected for this narrow backport]; 8027293 refactor(plugins): plugin tools take the turn's owner bit; delete the requester-owner continuation (OA2 PR 6j) (#205483) [not selected for this narrow backport]; 13e2ec3 feat: let participants publish through the session's shared GitHub account (#204914) [not selected for this narrow backport]; 5434992 fix: use the configured runtime when switching model providers (#203973) [not selected for this narrow backport]; 5271519 fix(feishu): honor the filename override on sent attachments (#205287) [not selected for this narrow backport]; ca087d4 refactor(admission): drop the replay automationAdmin bit and the R7 source re-check (#205268) [not selected for this narrow backport]

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

agents Agent runtime and tooling gateway Gateway runtime impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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: XL 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