Repository navigation
refactor(admission): command owner comes from admission (OA2 PR 7) - #205772
Conversation
- command-auth reads the owner bit from readCommandSenderAdmission in operator-admission; its ownerAllowFrom match, scope fallback and capability read are gone. - The owner list match and command-owner preparation move to command-owner-authority.ts (breaks the command-auth <-> operator-admission import cycle). - OWNER_PRODUCER_FILES 13 -> 12. 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 verdict.json{
"pass": true,
"prefix": "HEAD",
"sessionKey": "agent:main:one-admission-7e299e56",
"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": "Q.refusal-sentence-in-transcript",
"pass": true,
"detail": {
"sentenceInTranscript": true
}
},
{
"id": "S.stop-cancels",
"pass": true,
"detail": {
"abort": {
"ok": true,
"aborted": true,
"runIds": [
"e94b429e-c9f2-4d1b-83f4-fa4b31bf01e1"
]
},
"state": "aborted",
"requestsWithStopMarker": 1
}
}
],
"elapsedMs": 57313
}```
</details>
<details><summary>results.jsonl</summary>
{"t":"2026-11-26T05:24:14.616Z","step":"admin#1.hello","data":{"scopes":["operator.admin","operator.approvals","operator.pairing","operator.read","operator.write"],"role":"operator"}} |
|
Codex review: stale review; fresh review needed. Summary Next step Review history (1 earlier review cycle)
|
…odule - The ownerAllowFrom match and command-owner preparation live in command-owner-facts.ts; in command-owner-authority.ts they closed a madge cycle through channel-operator-authority. - Update requester names its resolvers so the dead-export scan sees their readers. - Drop TURN_FLAGS names with no reader left. Co-authored-by: obviyus <[email protected]>
|
E2E on exact head verdict.json{
"pass": true,
"prefix": "HEAD",
"sessionKey": "agent:main:one-admission-9a71f0f7",
"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": "Q.refusal-sentence-in-transcript",
"pass": true,
"detail": {
"sentenceInTranscript": true
}
},
{
"id": "S.stop-cancels",
"pass": true,
"detail": {
"abort": {
"ok": true,
"aborted": true,
"runIds": [
"fa3243e9-722b-4e92-9146-e3fe06ea32e7"
]
},
"state": "aborted",
"requestsWithStopMarker": 1
}
}
],
"elapsedMs": 57510
}```
</details>
<details><summary>results.jsonl</summary>
{"t":"2026-11-26T05:56:56.078Z","step":"admin#1.hello","data":{"scopes":["operator.admin","operator.approvals","operator.pairing","operator.read","operator.write"],"role":"operator"}} |
|
ClawSweeper status: applying reviewed decision. I am applying the reviewed decision for this pull request: refactor(admission): command owner comes from admission (OA2 PR 7) This is item 1/1 in the current shard. Shard 1/1. This transient lease prevents a newer review from overlapping label, comment, or close mutations. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
Co-authored-by: obviyus <[email protected]>
|
E2E on exact head verdict.json{
"pass": true,
"prefix": "HEAD",
"sessionKey": "agent:main:one-admission-54213e1d",
"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": "Q.refusal-sentence-in-transcript",
"pass": true,
"detail": {
"sentenceInTranscript": true
}
},
{
"id": "S.stop-cancels",
"pass": true,
"detail": {
"abort": {
"ok": true,
"aborted": true,
"runIds": [
"6928c7d1-3ffd-41d8-8242-24301ded8c79"
]
},
"state": "aborted",
"requestsWithStopMarker": 1
}
}
],
"elapsedMs": 57314
}```
</details>
<details><summary>results.jsonl</summary>
{"t":"2026-11-26T06:36:12.083Z","step":"admin#1.hello","data":{"scopes":["operator.admin","operator.approvals","operator.pairing","operator.read","operator.write"],"role":"operator"}} |
|
Landed as 7ce6c02. Command owner ( |
Ports the typed-owner match to src/auto-reply/command-owner-facts.ts, where #205772 moved it. Co-authored-by: RomneyDa <[email protected]>
…205666) * fix(update): preserve typed Discord owners during plugin migration Co-authored-by: RomneyDa <[email protected]> * fix(update): preserve typed Discord owners during plugin migration Worked on by: - @RomneyDa Co-authored-by: RomneyDa <[email protected]> OpenClaw-Publication: a3a077a6-6af8-4854-a490-4ae036753b01 * fix(update): match typed owners for any migration-deferred channel The delegated requester check now accepts the exact typed user target for whichever channel plugin Doctor is holding back for its state migration, not only Discord. Mattermost, Slack and Teams share the user-prefixed direct target style. Co-authored-by: RomneyDa <[email protected]> --------- Co-authored-by: RomneyDa <[email protected]> Release adaptation: Keep the matcher in this release’s command-auth owner rather than importing the later #205772 owner extraction. Keep #205669 and #205850 separate. (cherry picked from commit 777b439) Co-authored-by: vincentkoc <[email protected]> Co-authored-by: RomneyDa <[email protected]>
…penclaw#205772) ## Problem OA2 PR 7 (one admission owner, same person same answer). `/status`-class commands got their owner bit from `resolveCommandAuthorization` itself: it matched the sender against `commands.ownerAllowFrom`, read `operator.admin` from the socket scopes, and OR-ed in the command-owner capability bound at ingress. That match was the last owner decision outside the admission module (`OWNER_PRODUCER_FILES`), and it is the only owner source for asserted-identity channels (iMessage, SMS, IRC, Tlon, Slack relay, A2A, Feishu) and pre-turn senders (native commands). ## Fix - `operator-admission.ts`: new `readCommandSenderAdmission(ctx, owners, senderIds)`. It returns the owner principal's grant when the internal turn's grant (or a bare connection's scopes) is owner, when ingress admitted a command owner for this context, or when one of the sender's identifiers is a configured owner. `command-auth.ts` reads `.grant.owner` from it and no longer decides: the identity match, the scope fallback and the capability read are deleted there. - The `ownerAllowFrom` match and the command-owner preparation (`resolveOwnerAllowFromList`, `resolveConfiguredCommandOwners`, `isConfiguredCommandOwner`, `prepareCommandOwnerAuthority`, `captureCommandOwnerIdentity`) move unchanged from `command-auth.ts` to a new `src/auto-reply/command-owner-facts.ts`. This breaks the `command-auth` ↔ `operator-admission` import cycle; `operator-admission.ts` is at its `max-lines` limit, and putting them in `command-owner-authority.ts` closes a madge cycle through `channel-operator-authority`. Importers point at the new file; no re-exports. - Deleted while moving: the two thin wrappers `resolveCommandOwnerAuthority` / `resolveUpdateRequesterIdentityAuthority` (the update requester passes its resolver to `captureCommandOwnerIdentity`), the unread `operatorProfile` field on `PreparedCommandOwnerAuthority`, a redundant dynamic import in `session-event-target.ts`, and four `TURN_FLAGS` names with no reader left (`senderIsOwnerByScope`, `recordedOperatorAuthority`, `isHumanTurn`, `canPrepareSkillAuthoring`). - Lint: `OWNER_PRODUCER_FILES` 13 → 12 (`command-auth.ts` leaves). `TURN_FLAG_FILES` stays at 18: `command-auth.ts` leaves, `command-owner-facts.ts` (where the owner list match now lives) joins. ## Decisions (recorded, not asked) - Asserted-identity owners keep owner-only commands but get no operator scopes (DESIGN §10): the returned grant is used only for the owner bit. `commands: "all"` (passing `commands.allowFrom`) still comes only from the internal turn grant, so no listed channel owner gains `commands.allowFrom` bypass in this PR. - Command owner is answered by `readCommandSenderAdmission` in the admission module, not by `decideOperatorAdmission`. Asserted-identity owners and pre-turn senders have no operator principal; `decideOperatorAdmission` needs prepared facts (async) and refuses empty scopes, and `resolveCommandAuthorization` is a synchronous public SDK API. Routing them through it would need a new command-only facts kind or grant field. Its inputs are all admission outputs: the admitted turn grant, the owner capability bound at ingress, and the same configured-owner match `decideChannelOwnerPrincipal` uses. - A Control UI sender whose id is listed in `commands.ownerAllowFrom` is still a command owner (6i decision; `client-permission-parity` unchanged). ## User impact None intended. Every principal gets the same owner answer as before on every channel; only the producer moved. ## Evidence - Production (`src` + `scripts`, non-test): +270 / −273. - Matrix cells (`command-auth.owner-default.test.ts`, "command owner comes from admission"): asserted iMessage owner (ingress-admitted and pre-turn), asserted non-owner, verified Discord owner, pre-turn Telegram native sender, Control UI listed id, Control UI owner grant; plus "/status from an asserted iMessage owner still says owner" through `buildCommandContext`. - Pre-push: `ocx test` over the touched tests plus every test importing a changed source (`OPENCLAW_NODE_TEST_PLAN_CONTINUE_ON_FAILURE=1`): 133 files green on the final head (first head: 145 files; 22 shards hit a source-changed-mid-run error from my own edit, rerun green). `madge` + runtime import-cycle checks clean. `pnpm tsgo:core`, `pnpm tsgo:test`, oxlint, oxfmt, `check-import-cycles` clean. - E2E (one-admission run.sh Q/R/S) on the exact head: see comment. Co-authored-by: Ayaan Zaidi <[email protected]>
Problem
OA2 PR 7 (one admission owner, same person same answer).
/status-class commands got their owner bit fromresolveCommandAuthorizationitself: it matched the sender againstcommands.ownerAllowFrom, readoperator.adminfrom the socket scopes, and OR-ed in the command-owner capability bound at ingress. That match was the last owner decision outside the admission module (OWNER_PRODUCER_FILES), and it is the only owner source for asserted-identity channels (iMessage, SMS, IRC, Tlon, Slack relay, A2A, Feishu) and pre-turn senders (native commands).Fix
operator-admission.ts: newreadCommandSenderAdmission(ctx, owners, senderIds). It returns the owner principal's grant when the internal turn's grant (or a bare connection's scopes) is owner, when ingress admitted a command owner for this context, or when one of the sender's identifiers is a configured owner.command-auth.tsreads.grant.ownerfrom it and no longer decides: the identity match, the scope fallback and the capability read are deleted there.ownerAllowFrommatch and the command-owner preparation (resolveOwnerAllowFromList,resolveConfiguredCommandOwners,isConfiguredCommandOwner,prepareCommandOwnerAuthority,captureCommandOwnerIdentity) move unchanged fromcommand-auth.tsto a newsrc/auto-reply/command-owner-facts.ts. This breaks thecommand-auth↔operator-admissionimport cycle;operator-admission.tsis at itsmax-lineslimit, and putting them incommand-owner-authority.tscloses a madge cycle throughchannel-operator-authority. Importers point at the new file; no re-exports.resolveCommandOwnerAuthority/resolveUpdateRequesterIdentityAuthority(the update requester passes its resolver tocaptureCommandOwnerIdentity), the unreadoperatorProfilefield onPreparedCommandOwnerAuthority, a redundant dynamic import insession-event-target.ts, and fourTURN_FLAGSnames with no reader left (senderIsOwnerByScope,recordedOperatorAuthority,isHumanTurn,canPrepareSkillAuthoring).OWNER_PRODUCER_FILES13 → 12 (command-auth.tsleaves).TURN_FLAG_FILESstays at 18:command-auth.tsleaves,command-owner-facts.ts(where the owner list match now lives) joins.Decisions (recorded, not asked)
commands: "all"(passingcommands.allowFrom) still comes only from the internal turn grant, so no listed channel owner gainscommands.allowFrombypass in this PR.readCommandSenderAdmissionin the admission module, not bydecideOperatorAdmission. Asserted-identity owners and pre-turn senders have no operator principal;decideOperatorAdmissionneeds prepared facts (async) and refuses empty scopes, andresolveCommandAuthorizationis a synchronous public SDK API. Routing them through it would need a new command-only facts kind or grant field. Its inputs are all admission outputs: the admitted turn grant, the owner capability bound at ingress, and the same configured-owner matchdecideChannelOwnerPrincipaluses.commands.ownerAllowFromis still a command owner (6i decision;client-permission-parityunchanged).User impact
None intended. Every principal gets the same owner answer as before on every channel; only the producer moved.
Evidence
src+scripts, non-test): +270 / −273.command-auth.owner-default.test.ts, "command owner comes from admission"): asserted iMessage owner (ingress-admitted and pre-turn), asserted non-owner, verified Discord owner, pre-turn Telegram native sender, Control UI listed id, Control UI owner grant; plus "/status from an asserted iMessage owner still says owner" throughbuildCommandContext.ocx testover the touched tests plus every test importing a changed source (OPENCLAW_NODE_TEST_PLAN_CONTINUE_ON_FAILURE=1): 133 files green on the final head (first head: 145 files; 22 shards hit a source-changed-mid-run error from my own edit, rerun green).madge+ runtime import-cycle checks clean.pnpm tsgo:core,pnpm tsgo:test, oxlint, oxfmt,check-import-cyclesclean.