Skip to content

test(lint): fail turn-kind reads and owner production outside admission - #204823

Merged
obviyus merged 3 commits into
mainfrom
refactor/oa2-lint-tooling
Nov 24, 2026
Merged

obviyus merged 3 commits into
mainfrom
refactor/oa2-lint-tooling

Conversation

@obviyus

@obviyus obviyus commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Every bug this week was the same person getting a different answer depending on how the turn started: a reconnect resume, an internal client, provenance, or a second owner decider. Nothing stops new code from adding another turn-kind branch or another senderIsOwner producer outside admission.

Fix

This is tooling only (OA2 PR 1a). It changes no runtime code.

  • New lint rule openclaw-boundaries/no-turn-authority-derivation (scripts/lib/no-turn-authority-derivation.mjs), registered in config/oxlint/boundary-guards.json. It fails three things outside their allowlists:
    1. Turn-kind flag reads: reconnectResumeRequested, isLinkedOwnerDevice, isAuthenticatedOwner, recordedOperatorAuthority, senderIsOwnerByScope, isHumanTurn, canPrepareSkillAuthoring, prepareCommandOwnerAuthority or isConfiguredCommandOwner, read outside TURN_FLAG_FILES.
    2. Owner production: a senderIsOwner/requesterOwner property, assignment or declaration whose value is not a pass-through of the same name, ….grant.owner, false or undefined, outside OWNER_PRODUCER_FILES.
    3. Capability modules that read how the turn started: systemInputProvenance, inputProvenance, turnKind, trigger, syntheticClient or clientInfo, read in a capability module (skill authoring, question replacement, cron creator admission, session event context, turn authority, dangerous tools, automations scope, github-publication-*) outside CAPABILITY_PROVENANCE_FILES.
  • The allowlists equal today's readers on main (24, 53 and 5 files).
  • no-operator-permission-read exports ADMISSION_FILES (63) and accepts the same ignoreAllowlists option. The stale-entry test needs that option to re-run the rule with the allowlists off.
  • test/scripts/oxlint-boundary-guards.test.ts:
    • pins a ceiling for each of the four lists;
    • re-runs both rules with ignoreAllowlists: true over every listed file, and fails any entry that no longer trips its check. A list can only shrink, and it must shrink as code moves.
    • A planted-divergence fixture (turn-authority-derivation-violation.ts) must report 5 findings: two turn-kind reads, two owner values produced by destructuring defaults (one through the source property, one through an aliased destination binding), and one owner value produced from scopes. Pass-throughs report nothing.

User impact

None at runtime. Contributors get a lint error when they add a turn-kind branch or an owner producer outside admission.

Evidence

  • node scripts/run-oxlint.mjs --openclaw-focused-config --config config/oxlint/boundary-guards.json src extensions packages reports 0 findings.
  • ocx test test/scripts/oxlint-boundary-guards.test.ts: 35 passed. That includes the ceilings, the stale-entry check over all four lists, and the fixture.
  • oxlint on the changed files reports 0 findings.

Adds openclaw-boundaries/no-turn-authority-derivation. It fails turn-kind flag
reads, senderIsOwner/requesterOwner values that are not a pass-through or
grant.owner, and provenance reads in capability modules, outside allowlists
that equal today's readers. The boundary-guards test pins a ceiling per list
(and for ADMISSION_FILES) and fails any entry that no longer trips its check.

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

clawsweeper Bot commented Nov 24, 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 scripts Repository scripts size: M labels Nov 24, 2026
obviyus and others added 2 commits November 24, 2026 23:34
`{ senderIsOwner = true } = input` produced owner status without a diagnostic.
AssignmentPattern defaults for senderIsOwner/requesterOwner now go through the
same pass-through check; the fixture covers a producing default and a plain
destructured pass-through. Allowlists on main are unchanged.

Co-authored-by: obviyus <[email protected]>
`{ isAdmin: requesterOwner = true } = input` named the owner field only in the
destination binding; the default check now matches the source property or the
destination binding.

Co-authored-by: obviyus <[email protected]>
@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. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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 24, 2026
@clawsweeper

clawsweeper Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR adds lint checks and shrinking allowlist tests for turn-kind reads, owner-status production, and capability provenance reads.

Example: A contributor adds const senderIsOwner = scopes.includes("operator.admin") in src/example.ts.

  • Before: The existing permission-reader guard accepts the separate owner decision.
  • After: The new rule reports owner status produced outside admission.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Reported lint and fixture validation supports the tooling change, but two concrete syntax gaps leave its enforcement incomplete.
Proof confidence 🦐 gold shrimp (3/6) This tooling-only change requires no shipped-product demonstration; supplied evidence reports production-tree lint and boundary-fixture checks.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Maintenance · Worth it: Yes · Fix scope: Complete
User problem: Contributors can introduce separate owner decisions or turn-kind capability branches without the existing lint boundary detecting them.
Reason: The maintainer-authored direction extends an established admission invariant through the existing lint owner; the added ignoreAllowlists rule option supports exception maintenance.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep open: this maintainer-authored PR adds useful admission-boundary enforcement, but two ordinary TypeScript forms bypass its new checks.

Priority: P2
Reviewed head: aed04647b6b6fbcb5bb47d858e29ec4180306b99

Before merge

  • Check owner bindings introduced by aliased destructuring (P2) - In an unlisted production file, const { isAdmin: requesterOwner } = input; return { requesterOwner }; produces owner status from input.isAdmin without a diagnostic. VariableDeclarator ignores ObjectPattern bindings, Property excludes ObjectPattern parents, and there is no AssignmentPattern without a default; the returned shorthand then passes the same-name check. Handle renamed destructuring bindings, including assignment forms, while retaining legitimate same-name and grant.owner pass-throughs, and extend the existing fixture.
  • Detect prohibited reads through static string-literal keys (P2) - The Identifier-only check accepts request["reconnectResumeRequested"] in an unlisted production file and request["turnKind"] in a guarded capability module such as src/security/dangerous-tools.ts. These read exactly the fields the rule promises to reject, but their property nodes are literals and no other visitor checks these reads. Recognize statically named member and destructuring reads without requiring dynamic expression analysis, and cover them in the existing fixture.

Findings

  • [P2] Check owner bindings introduced by aliased destructuring — scripts/lib/no-turn-authority-derivation.mjs:254-256
  • [P2] Detect prohibited reads through static string-literal keys — scripts/lib/no-turn-authority-derivation.mjs:218-224
Agent review details

How this fits together

The focused Oxlint boundary lane parses repository source and applies registered rules, producing diagnostics that gate contributor changes without changing Gateway runtime behavior.

flowchart LR
  A[Repository source] --> B[Focused Oxlint runner]
  B --> C[Boundary plugin]
  C --> D[Authority derivation rule]
  D --> E[Allowlist exceptions]
  D --> F[Lint diagnostics]
Loading

Technical review

Best possible solution:

Extend the existing rule and fixture to reject aliased owner bindings and static string-literal reads while preserving documented pass-throughs.

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

Source inspection establishes both visitor gaps with concrete inputs; no target code or tests were executed under the read-only review constraint.

Is this the best way to solve the issue?

The existing boundary plugin is the appropriate owner, and focused syntax coverage repairs complete the proposed guard without another runtime authority layer.

Full review comments:

  • [P2] Check owner bindings introduced by aliased destructuring — scripts/lib/no-turn-authority-derivation.mjs:254-256
    In an unlisted production file, const { isAdmin: requesterOwner } = input; return { requesterOwner }; produces owner status from input.isAdmin without a diagnostic. VariableDeclarator ignores ObjectPattern bindings, Property excludes ObjectPattern parents, and there is no AssignmentPattern without a default; the returned shorthand then passes the same-name check. Handle renamed destructuring bindings, including assignment forms, while retaining legitimate same-name and grant.owner pass-throughs, and extend the existing fixture.
    Confidence: 0.99
  • [P2] Detect prohibited reads through static string-literal keys — scripts/lib/no-turn-authority-derivation.mjs:218-224
    The Identifier-only check accepts request["reconnectResumeRequested"] in an unlisted production file and request["turnKind"] in a guarded capability module such as src/security/dangerous-tools.ts. These read exactly the fields the rule promises to reject, but their property nodes are literals and no other visitor checks these reads. Recognize statically named member and destructuring reads without requiring dynamic expression analysis, and cover them in the existing fixture.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Permission-reader allowlist and boundary registration keeps the original intent (75cab7d: Prevent new live permission readers outside existing admission owners after removing mid-run authority rechecks.)
  • Boundary fixture integration keeps the original intent (ff95d0c: Use focused Oxlint rules and the existing wrapper for repository syntax boundaries.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test test/scripts/oxlint-boundary-guards.test.ts --maxWorkers=1
  • node scripts/run-oxlint.mjs --openclaw-focused-config --config config/oxlint/boundary-guards.json src extensions packages
  • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.test.root.tooling.json --incremental

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 80fd867 adds scripts/oxlint-boundary-guards.mjs:21 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 80fd8670e37b; files: scripts/oxlint-boundary-guards.mjs)

PR surface

Tests +99, Other +285. Total +384 across 6 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 100 1 +99
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 4 287 2 +285
Total 6 387 3 +384

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 P2: The new development guard misses ordinary syntax covered by its stated contract, with no direct runtime regression.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: The new development guard misses ordinary syntax covered by its stated contract, with no direct runtime regression.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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

@obviyus
obviyus merged commit 3358612 into main Nov 24, 2026
123 checks passed
@obviyus
obviyus deleted the refactor/oa2-lint-tooling branch November 24, 2026 18:34
@obviyus

obviyus commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as 3358612. Tooling only: no-turn-authority-derivation fails turn-kind flag reads, owner production outside grant.owner pass-throughs, and provenance reads in capability modules, against allowlists equal to main's readers. Ceilings and the stale-entry check keep every list shrink-only. Proof: boundary-guards test 35/35, the repo-wide boundary lint is clean, and the local review is clean on the head. #204756 (the turn grant) rebases onto it and lowers the ceilings.

obviyus added a commit that referenced this pull request Nov 24, 2026
…204756)

## Problem

The same person got a different answer depending on how the turn started:

- A Control UI steer from a native app, or one sent with system provenance, could not replace a pending question.
- An `operator.admin` client outside `commands.allowFrom` was refused slash commands (#198259).
- Skill authoring read `isHumanTurn` on chat.send and a list of internal start kinds on the agent RPC. Same-person internal turns got the false refusal "Skill authoring needs a fresh message".
- Workspace skill authoring re-read the live role in the middle of a turn.

## Fix

This is OA2 PR 1b. It builds on the lint guard from #204823. Admission now decides what a turn may do, and the Control UI entry kinds read that decision.

- **`TurnGrant`** (`owner`, `skillAuthoring`, `questionReplace`, `commands`) is a frozen field on `AdmittedRunOperatorAuthority`. Only `decideTurnGrant(scopes)` in `src/gateway/operator-admission.ts` produces it.
  - Every authority constructor calls it: replay `decide`, fresh Gateway admission, channel capture and continuation narrowing.
  - It is in memory only, so no schema changes. A replay admits again from its recorded source.
- **Owner tools** (`dangerous-tools.ts`) and the **transcript owner stamp** (`chat-user-turn-recorder.ts`) read `grant.owner`, which is `operator.admin` in the admitted scopes.
- **Commands:** chat.send puts the grant on the command context as `TurnGrant`.
  - `grant.commands === "all"` (`operator.admin`) passes `commands.allowFrom`, per Ayaan's decision. Non-admins keep the list and its visible refusal.
  - `TurnGrant` is trusted only on the internal provider, like `GatewayClientScopes`.
  - Docs are updated (`tools/slash-commands`, `gateway/config-channels/commands`).
- **Skill authoring:** deleted `isHumanTurn`, `canPrepareSkillAuthoring` and the agent RPC internal-start list. `grant.skillAuthoring` decides.
  - The client checks stay: in-process runtime callers carry no attributed person.
  - Workspace authoring reads `grant.owner` instead of re-reading the role mid-turn.
  - Also deleted the mid-preparation "requester changed" scope re-check.
  - `skill-library-authoring.ts` leaves `ADMISSION_FILES`.
- **Question replacement:** deleted the Control UI client-id, `turnKind`, provenance and internal re-entry gates. `grant.questionReplace` plus the request shape (steer, non-command, pending question) decide.
- **Lint allowlists shrink:**
  - `ADMISSION_FILES` 63 → 62;
  - turn-kind flags 24 → 21 (`chat-send-input-dispatch`, `chat-send-agent-dispatch.types`, `skill-library-authoring`);
  - owner producers 53 → 52 (`chat-user-turn-recorder`);
  - capability provenance 5 → 4 (`chat-send-question-replacement`).
- **Matrix:** the admission table's real-Gateway `after-start` rows now also check the grant at fresh admission and at saved-source replay. Cells: Control UI token, password, OpenClaw ID owner, Tailscale, Tailscale device and trusted proxy; CLI via Gateway; Discord linked identity.
  - `KNOWN_DIVERGENT` is shrink-only, with a ceiling. Its one entry: a linked Discord sender gets its role's scopes while the same person over Tailscale gets `identityScopes`. PR 2 fixes it.

## Decisions (recorded, not asked)

- **Owner:** `grant.owner` is `operator.admin` in the admitted scopes. Saved channel and parent-bound command ownership stays in `requesterOwner`, read only by scheduled occurrences, until PR 2 (verified configured channel owner) and PR 4 (parent-bound sources). The round-2 review of the earlier head found that putting that fact in the grant would give owner-only tools to a read/write channel command owner.
- **Internal starts:** same-person internal starts (agent RPC internal events, approval follow-ups, re-entries with handler options) now get the grant their admission produced. The skill tool shape is already stable per session, so the provider request does not change. The client checks still exclude in-process runtime callers.
- **Read-only steer:** a read-only client no longer replaces a pending question (`questionReplace` needs `operator.sessions.write`).
- **Narrowing:** a continuation that narrows scopes re-derives its grant from the narrowed scopes.
- **Deferred:** `grant.automations` (the cron-creator classifier) and moving the fresh-turn decision out of `operator-run-authority.ts` go in a later PR. `prActions` comes with PR 3.

## User impact

- An admin on Control UI or WebChat can run slash commands even when `commands.allowFrom` does not list it.
- A steer from any client with session write (native app, system-provenance turn, reconnect) can replace an ordinary pending question.
- Same-person internal turns no longer get the false "Skill authoring needs a fresh message" refusal.
- Owner tools, the transcript owner stamp and workspace skill authoring follow one admission decision.

## Evidence

- **Production lines:** `src` (non-test) +109 / −110.
- **Red on base `23e252373e9b`** (head tests run against base code): question replacement from a native app, a system-input turn, and the read-only case; `/status` for an admitted admin outside `commands.allowFrom`. All four fail on base and pass on head.
- **Matrix:** on the earlier head, all 8 cells passed and the one `KNOWN_DIVERGENT` cell still diverged. The admission table also passed.
- **E2E `one-admission-e2e/run.sh`:** Q, R and S all pass. Q: queued input refused visibly. R: a running turn finishes. S: Stop cancels.
- **Z5 reconnect skill case:** turns A, B and C each list `skill_library`.
- **Z1 #167867 case:** turns A, B and C each see `scope=gateway total=3`.
- **Failing on base too (not ours):** `subagent-registry.requester-wake.e2e` (6 receipt cases time out) and `reef-shutdown.gateway`.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 25, 2026
…on (openclaw#204823)

## Problem

Every bug this week was the same person getting a different answer depending on how the turn started: a reconnect resume, an internal client, provenance, or a second owner decider. Nothing stops new code from adding another turn-kind branch or another `senderIsOwner` producer outside admission.

## Fix

This is tooling only (OA2 PR 1a). It changes no runtime code.

- New lint rule `openclaw-boundaries/no-turn-authority-derivation` (`scripts/lib/no-turn-authority-derivation.mjs`), registered in `config/oxlint/boundary-guards.json`. It fails three things outside their allowlists:
  1. **Turn-kind flag reads:** `reconnectResumeRequested`, `isLinkedOwnerDevice`, `isAuthenticatedOwner`, `recordedOperatorAuthority`, `senderIsOwnerByScope`, `isHumanTurn`, `canPrepareSkillAuthoring`, `prepareCommandOwnerAuthority` or `isConfiguredCommandOwner`, read outside `TURN_FLAG_FILES`.
  2. **Owner production:** a `senderIsOwner`/`requesterOwner` property, assignment or declaration whose value is not a pass-through of the same name, `….grant.owner`, `false` or `undefined`, outside `OWNER_PRODUCER_FILES`.
  3. **Capability modules that read how the turn started:** `systemInputProvenance`, `inputProvenance`, `turnKind`, `trigger`, `syntheticClient` or `clientInfo`, read in a capability module (skill authoring, question replacement, cron creator admission, session event context, turn authority, dangerous tools, automations scope, `github-publication-*`) outside `CAPABILITY_PROVENANCE_FILES`.
- The allowlists equal today's readers on `main` (24, 53 and 5 files).
- `no-operator-permission-read` exports `ADMISSION_FILES` (63) and accepts the same `ignoreAllowlists` option. The stale-entry test needs that option to re-run the rule with the allowlists off.
- `test/scripts/oxlint-boundary-guards.test.ts`:
  - pins a ceiling for each of the four lists;
  - re-runs both rules with `ignoreAllowlists: true` over every listed file, and fails any entry that no longer trips its check. A list can only shrink, and it must shrink as code moves.
  - A planted-divergence fixture (`turn-authority-derivation-violation.ts`) must report 5 findings: two turn-kind reads, two owner values produced by destructuring defaults (one through the source property, one through an aliased destination binding), and one owner value produced from scopes. Pass-throughs report nothing.

## User impact

None at runtime. Contributors get a lint error when they add a turn-kind branch or an owner producer outside admission.

## Evidence

- `node scripts/run-oxlint.mjs --openclaw-focused-config --config config/oxlint/boundary-guards.json src extensions packages` reports 0 findings.
- `ocx test test/scripts/oxlint-boundary-guards.test.ts`: 35 passed. That includes the ceilings, the stale-entry check over all four lists, and the fixture.
- oxlint on the changed files reports 0 findings.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 25, 2026
…penclaw#204756)

## Problem

The same person got a different answer depending on how the turn started:

- A Control UI steer from a native app, or one sent with system provenance, could not replace a pending question.
- An `operator.admin` client outside `commands.allowFrom` was refused slash commands (openclaw#198259).
- Skill authoring read `isHumanTurn` on chat.send and a list of internal start kinds on the agent RPC. Same-person internal turns got the false refusal "Skill authoring needs a fresh message".
- Workspace skill authoring re-read the live role in the middle of a turn.

## Fix

This is OA2 PR 1b. It builds on the lint guard from openclaw#204823. Admission now decides what a turn may do, and the Control UI entry kinds read that decision.

- **`TurnGrant`** (`owner`, `skillAuthoring`, `questionReplace`, `commands`) is a frozen field on `AdmittedRunOperatorAuthority`. Only `decideTurnGrant(scopes)` in `src/gateway/operator-admission.ts` produces it.
  - Every authority constructor calls it: replay `decide`, fresh Gateway admission, channel capture and continuation narrowing.
  - It is in memory only, so no schema changes. A replay admits again from its recorded source.
- **Owner tools** (`dangerous-tools.ts`) and the **transcript owner stamp** (`chat-user-turn-recorder.ts`) read `grant.owner`, which is `operator.admin` in the admitted scopes.
- **Commands:** chat.send puts the grant on the command context as `TurnGrant`.
  - `grant.commands === "all"` (`operator.admin`) passes `commands.allowFrom`, per Ayaan's decision. Non-admins keep the list and its visible refusal.
  - `TurnGrant` is trusted only on the internal provider, like `GatewayClientScopes`.
  - Docs are updated (`tools/slash-commands`, `gateway/config-channels/commands`).
- **Skill authoring:** deleted `isHumanTurn`, `canPrepareSkillAuthoring` and the agent RPC internal-start list. `grant.skillAuthoring` decides.
  - The client checks stay: in-process runtime callers carry no attributed person.
  - Workspace authoring reads `grant.owner` instead of re-reading the role mid-turn.
  - Also deleted the mid-preparation "requester changed" scope re-check.
  - `skill-library-authoring.ts` leaves `ADMISSION_FILES`.
- **Question replacement:** deleted the Control UI client-id, `turnKind`, provenance and internal re-entry gates. `grant.questionReplace` plus the request shape (steer, non-command, pending question) decide.
- **Lint allowlists shrink:**
  - `ADMISSION_FILES` 63 → 62;
  - turn-kind flags 24 → 21 (`chat-send-input-dispatch`, `chat-send-agent-dispatch.types`, `skill-library-authoring`);
  - owner producers 53 → 52 (`chat-user-turn-recorder`);
  - capability provenance 5 → 4 (`chat-send-question-replacement`).
- **Matrix:** the admission table's real-Gateway `after-start` rows now also check the grant at fresh admission and at saved-source replay. Cells: Control UI token, password, OpenClaw ID owner, Tailscale, Tailscale device and trusted proxy; CLI via Gateway; Discord linked identity.
  - `KNOWN_DIVERGENT` is shrink-only, with a ceiling. Its one entry: a linked Discord sender gets its role's scopes while the same person over Tailscale gets `identityScopes`. PR 2 fixes it.

## Decisions (recorded, not asked)

- **Owner:** `grant.owner` is `operator.admin` in the admitted scopes. Saved channel and parent-bound command ownership stays in `requesterOwner`, read only by scheduled occurrences, until PR 2 (verified configured channel owner) and PR 4 (parent-bound sources). The round-2 review of the earlier head found that putting that fact in the grant would give owner-only tools to a read/write channel command owner.
- **Internal starts:** same-person internal starts (agent RPC internal events, approval follow-ups, re-entries with handler options) now get the grant their admission produced. The skill tool shape is already stable per session, so the provider request does not change. The client checks still exclude in-process runtime callers.
- **Read-only steer:** a read-only client no longer replaces a pending question (`questionReplace` needs `operator.sessions.write`).
- **Narrowing:** a continuation that narrows scopes re-derives its grant from the narrowed scopes.
- **Deferred:** `grant.automations` (the cron-creator classifier) and moving the fresh-turn decision out of `operator-run-authority.ts` go in a later PR. `prActions` comes with PR 3.

## User impact

- An admin on Control UI or WebChat can run slash commands even when `commands.allowFrom` does not list it.
- A steer from any client with session write (native app, system-provenance turn, reconnect) can replace an ordinary pending question.
- Same-person internal turns no longer get the false "Skill authoring needs a fresh message" refusal.
- Owner tools, the transcript owner stamp and workspace skill authoring follow one admission decision.

## Evidence

- **Production lines:** `src` (non-test) +109 / −110.
- **Red on base `d96b6e90fee5`** (head tests run against base code): question replacement from a native app, a system-input turn, and the read-only case; `/status` for an admitted admin outside `commands.allowFrom`. All four fail on base and pass on head.
- **Matrix:** on the earlier head, all 8 cells passed and the one `KNOWN_DIVERGENT` cell still diverged. The admission table also passed.
- **E2E `one-admission-e2e/run.sh`:** Q, R and S all pass. Q: queued input refused visibly. R: a running turn finishes. S: Stop cancels.
- **Z5 reconnect skill case:** turns A, B and C each list `skill_library`.
- **Z1 openclaw#167867 case:** turns A, B and C each see `scope=gateway total=3`.
- **Failing on base too (not ours):** `subagent-registry.requester-wake.e2e` (6 receipt cases time out) and `reef-shutdown.gateway`.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Nov 27, 2026
…y minting (#206725)

## Problem

`openclaw-boundaries/no-operator-permission-read` (#204823) blocks new live permission reads in files outside its allowlist. Since then, post-start authority re-checks landed through three paths the rule cannot see:

- A started run's authority rebuilt with a separate revocation signal: `createAdmittedRunOperatorAuthority({ ...authority, signal })` in new files (`session-sharing-authorization-async.ts`, `operator-run-invocation.ts`).
- `client.internal?.operatorAccessAuthority?.assertCurrent()` after a request was admitted (`question-session-access.ts`, `session-communication-approval.ts`).
- New reader calls in files that were already allowlisted. The allowlist was per file, so any number of new reads passed.

Each one gives one person different answers depending on timing, which the root `AGENTS.md` rule "Decide authority once" forbids.

## Change

Tooling only. No runtime code changes.

`scripts/lib/no-operator-permission-read.mjs`:
- Every list now maps a file to its reference count today. A file in a list fails on the reference after its count, so a new read in a listed file fails too.
- New check: `createAdmittedRunOperatorAuthority` outside its definition and the 7 current callers (`MINT_FILES`).
- New check: `….operatorAccessAuthority.assertCurrent` outside the 2 current files (`ACCESS_RECHECK_FILES`).
- Messages start with `Permission read:`, `Run authority minted:` or `Access re-check:`.

`test/scripts/oxlint-boundary-guards.test.ts`:
- The stale-entry test now requires each listed count to equal the references found. When a reference is removed, its count must be lowered in the same change.
- New fixture `run-authority-mint-violation.ts`: 4 findings (one access re-check, three minter references).

The lists start at today's callers and can only shrink. Some of those call sites are post-start re-checks that a separate change removes; that change lowers these counts.

`src/gateway/AGENTS.md`: the Lint bullet names the new checks and per-file counts.

## Evidence

- `test/scripts/oxlint-boundary-guards.test.ts`: 40/40 pass. The new fixture reports lines 1, 4, 8, 9, and the counts match all 58 + 7 + 2 listed files exactly.
- `node scripts/run-oxlint.mjs --openclaw-focused-config --config config/oxlint/boundary-guards.json src extensions packages`: 0 errors.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 28, 2026
…y minting (openclaw#206725)

## Problem

`openclaw-boundaries/no-operator-permission-read` (openclaw#204823) blocks new live permission reads in files outside its allowlist. Since then, post-start authority re-checks landed through three paths the rule cannot see:

- A started run's authority rebuilt with a separate revocation signal: `createAdmittedRunOperatorAuthority({ ...authority, signal })` in new files (`session-sharing-authorization-async.ts`, `operator-run-invocation.ts`).
- `client.internal?.operatorAccessAuthority?.assertCurrent()` after a request was admitted (`question-session-access.ts`, `session-communication-approval.ts`).
- New reader calls in files that were already allowlisted. The allowlist was per file, so any number of new reads passed.

Each one gives one person different answers depending on timing, which the root `AGENTS.md` rule "Decide authority once" forbids.

## Change

Tooling only. No runtime code changes.

`scripts/lib/no-operator-permission-read.mjs`:
- Every list now maps a file to its reference count today. A file in a list fails on the reference after its count, so a new read in a listed file fails too.
- New check: `createAdmittedRunOperatorAuthority` outside its definition and the 7 current callers (`MINT_FILES`).
- New check: `….operatorAccessAuthority.assertCurrent` outside the 2 current files (`ACCESS_RECHECK_FILES`).
- Messages start with `Permission read:`, `Run authority minted:` or `Access re-check:`.

`test/scripts/oxlint-boundary-guards.test.ts`:
- The stale-entry test now requires each listed count to equal the references found. When a reference is removed, its count must be lowered in the same change.
- New fixture `run-authority-mint-violation.ts`: 4 findings (one access re-check, three minter references).

The lists start at today's callers and can only shrink. Some of those call sites are post-start re-checks that a separate change removes; that change lowers these counts.

`src/gateway/AGENTS.md`: the Lint bullet names the new checks and per-file counts.

## Evidence

- `test/scripts/oxlint-boundary-guards.test.ts`: 40/40 pass. The new fixture reports lines 1, 4, 8, 9, and the counts match all 58 + 7 + 2 listed files exactly.
- `node scripts/run-oxlint.mjs --openclaw-focused-config --config config/oxlint/boundary-guards.json src extensions packages`: 0 errors.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant