Repository navigation
docs(agents): make deciding authority once a top-level rule - #206706
Conversation
- Root AGENTS.md: new 'Decide authority once' section naming decideOperatorAdmission/TurnGrant, the banned post-start re-checks, allowed fences, and incidents. - src/gateway/AGENTS.md: Operator Admission section with grant fields, cause table, new-permission matrix, lint. - src/agents/AGENTS.md, pr-simplify, review flow: point tools and reviewers at the rule; review reports re-checks as P1.
|
🦞👀 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. |
|
Codex review: passed. What this changesThis PR promotes the single-admission authority rule and aligns scoped instructions, review guidance, and a lint comment with it. Example: A contributor adds a senderIsOwner refusal inside portal after turn admission.
Review scores
ProductKind: Docs · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it makes an established admission contract easier to follow, is supported by concrete incidents, and introduces no identified defects. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherRepository instructions guide contributors and reviewers around Gateway admission, which turns prepared principal facts into a frozen grant consumed by tool execution. flowchart TD
A[Root instructions] --> B[Gateway admission guide]
A --> C[Agent tool guide]
B --> D[Contributor changes]
C --> D
D --> E[Review and simplification]
Technical reviewBest possible solution: Land the focused clarification through the normal required checks. Do we have a high-confidence way to reproduce the issue? No runtime reproduction applies to this instruction-only change; the linked continuation repair establishes the concrete failure motivating it. Is this the best way to solve the issue? The change uses existing instruction owners, removes superseded root bullets, and points tools and reviewers at the established admission contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 89425fd75d4e. Provenance checked
SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceDocs +24, Other 0. Total +24 across 6 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 27, 2026, 8:55 AM ET / 13:55 UTC. |
…06792) ## Problem `retainSessionScopedRead()` (session file, diff, branch, subscription, MCP app and canvas reads) decided visibility at admission and then re-decided it in `assertCurrent()` after every awaited step: it re-read the role actor, the sharing identity, the connect scopes, the startable-main rule from the live config and the invited membership. A read that was admitted could then fail with "Session … was not found" when the creator removed the invited person, or the role changed, while the read was running. Repo rule (AGENTS.md "Decide authority once", #206706): a started request finishes; only data fences may stop it. #206747 removed the newer membership re-read in `isInvitedWorkspaceTarget` and named this older guard as a follow-up. ## Fix - Visibility, narrow-reader identity/scope and the startable-main rule are decided once, at admission, from the admission config and the membership captured then. - `assertCurrent()` keeps only data fences: request lifetime (abort signal, commit guard), session routing, and the retained row (`isCurrentAtResponse`: incarnation, lifecycle revision, access-relevant row fields, physical store). - No new hook, flag, state or refusal text. Production: `session-scoped-read.ts` +7/−14 against main. ## User impact - An invited reader whose access is removed while a file/diff read is running gets that read's result; the next read is refused (same answer as admission at start, no widening). - Row changes during a read (reset, archive, workspace move, visibility change on the row) still refuse it, unchanged. ## Tests - New `finishes an admitted invited read after membership removal` (`server-methods.session-scoped-reads.test.ts`): red on base `4d7e00b86313` (`Session "agent:main:scoped-read" was not found`), green on head; the follow-up read after removal is refused. - Deleted the `changed` case of `separates a trusted solo operator from its sharing exemption`: it asserted that swapping the operator actor mid-read refuses the read, i.e. the removed mid-request re-check. - `sessions-read-invited.test.ts` `progressCard.get`: it asserted that revoking the invitation during a card read refuses that read (CI round 1 red, the removed re-check). Now the in-flight read returns the card and the next read is hidden. - Pre-push: one `ocx test` run of the touched test plus every test that imports `session-scoped-read.ts` and the direct callers' tests; oxfmt, oxlint, `pnpm check:changed`. - `no-operator-permission-read` counts: unchanged (the file is not on any list; no listed site removed). ## E2E (one-admission Q/R/S, real Gateway + real model) - Head `b40d1bf3f5d3`: Q pass, Q sentence pass, S pass. R fails identically on base `4d7e00b86313` (`state: final`, 3 tool ends after revoke): the shared proof's R check was changed on 11-27 to expect the not-yet-landed "stop on access loss" feature (`stopReason: access-reduced`, not present on `main`). This PR touches only session-scoped RPC reads, not chat runs, so R does not measure it. Same verdict on base and head. - That approved rule ("a writer that removes a named person's access stops the work that person started; all other changes apply to the next request") covers runs, subagents, exec and queued/owed work, not a read RPC. This PR is consistent with it: the read decides once; the next read sees the removal. Co-authored-by: Ayaan Zaidi <[email protected]>
…#206706) ## Problem The rule "check authority one time, when work starts" was one bullet inside root `AGENTS.md` "Choose good compromises". New changes still add post-start authority re-checks (`assertCurrent()`-style re-reads, tool-time `senderIsOwner` refusals, refusal text outside the cause table). These give one person different answers depending on how or when a turn started (openclaw#203464), for example `portal` refused in an owner's turn after a Gateway restart (openclaw#206665). The one-admission work found 242 such refusal strings in 186 files. ## Change Docs and agent instructions only. No runtime code. - Root `AGENTS.md`: new top section **Decide authority once**. It names the owner (`decideOperatorAdmission` in `src/gateway/operator-admission.ts`, frozen `TurnGrant`), the post-start checks that need explicit maintainer buy-in, the allowed fences (revision, `expectedHead`, `requestId`, compare-and-swap, abort signal), the accepted trade-off (a revoked person's started turn finishes) and the incidents. The old bullet, the duplicate "Security boundaries" authority bullet and a duplicate review pointer are removed. The file stays under 20,000 characters (19,961). - `src/gateway/AGENTS.md`: new **Operator Admission** section: grant fields, continuation re-admission, tool gate, refusal cause table, how to add a permission (admission fact + `decideTurnGrant` field + matrix cell in `operator-admission.table.test.ts`), and the two boundary lints whose allowlists only shrink. The "live-authority checks" line under Run Authority now says liveness fences, which never re-read authority. - `src/agents/AGENTS.md`: tools consume the turn's `TurnGrant` and add no owner, scope or authority check of their own. - Review route: `docs/reference/pull-request-review-flow.md` tells every review route to report a post-start authority re-check as P1; `pr-simplify` applies the new root section. - `scripts/lib/no-operator-permission-read.mjs`: comment points at the new section name. ## Impact Contributors and agents see the rule first in root `AGENTS.md`, with the owner and file pointers. Reviews flag new mid-run authority re-checks as P1. ## Evidence - `pnpm check:agents-md-size`: 29 files within 20,000 chars. - `pnpm docs:check-links`: 0 broken. - `oxfmt --check` on the 6 changed files: clean. - `git diff --check`: clean. Co-authored-by: Ayaan Zaidi <[email protected]>
…enclaw#206792) ## Problem `retainSessionScopedRead()` (session file, diff, branch, subscription, MCP app and canvas reads) decided visibility at admission and then re-decided it in `assertCurrent()` after every awaited step: it re-read the role actor, the sharing identity, the connect scopes, the startable-main rule from the live config and the invited membership. A read that was admitted could then fail with "Session … was not found" when the creator removed the invited person, or the role changed, while the read was running. Repo rule (AGENTS.md "Decide authority once", openclaw#206706): a started request finishes; only data fences may stop it. openclaw#206747 removed the newer membership re-read in `isInvitedWorkspaceTarget` and named this older guard as a follow-up. ## Fix - Visibility, narrow-reader identity/scope and the startable-main rule are decided once, at admission, from the admission config and the membership captured then. - `assertCurrent()` keeps only data fences: request lifetime (abort signal, commit guard), session routing, and the retained row (`isCurrentAtResponse`: incarnation, lifecycle revision, access-relevant row fields, physical store). - No new hook, flag, state or refusal text. Production: `session-scoped-read.ts` +7/−14 against main. ## User impact - An invited reader whose access is removed while a file/diff read is running gets that read's result; the next read is refused (same answer as admission at start, no widening). - Row changes during a read (reset, archive, workspace move, visibility change on the row) still refuse it, unchanged. ## Tests - New `finishes an admitted invited read after membership removal` (`server-methods.session-scoped-reads.test.ts`): red on base `2626bc1ae892` (`Session "agent:main:scoped-read" was not found`), green on head; the follow-up read after removal is refused. - Deleted the `changed` case of `separates a trusted solo operator from its sharing exemption`: it asserted that swapping the operator actor mid-read refuses the read, i.e. the removed mid-request re-check. - `sessions-read-invited.test.ts` `progressCard.get`: it asserted that revoking the invitation during a card read refuses that read (CI round 1 red, the removed re-check). Now the in-flight read returns the card and the next read is hidden. - Pre-push: one `ocx test` run of the touched test plus every test that imports `session-scoped-read.ts` and the direct callers' tests; oxfmt, oxlint, `pnpm check:changed`. - `no-operator-permission-read` counts: unchanged (the file is not on any list; no listed site removed). ## E2E (one-admission Q/R/S, real Gateway + real model) - Head `b40d1bf3f5d3`: Q pass, Q sentence pass, S pass. R fails identically on base `2626bc1ae892` (`state: final`, 3 tool ends after revoke): the shared proof's R check was changed on 11-27 to expect the not-yet-landed "stop on access loss" feature (`stopReason: access-reduced`, not present on `main`). This PR touches only session-scoped RPC reads, not chat runs, so R does not measure it. Same verdict on base and head. - That approved rule ("a writer that removes a named person's access stops the work that person started; all other changes apply to the next request") covers runs, subagents, exec and queued/owed work, not a read RPC. This PR is consistent with it: the read decides once; the next read sees the removal. Co-authored-by: Ayaan Zaidi <[email protected]>
Release adaptation: Use the stable admitted scope ceiling for exec wakes, restart and tool handoffs. Remove the duplicate yielding-turn marker from those producers. Preserve independent cron delegation and plugin admission, and keep event text unauthorized. Companion audit: No companion. #206706 documents admission policy; #206721 changes CLI execution; associated scheduler, plugin and refusal infrastructure changes are outside this stable owner fix. (cherry picked from commit 6ef7508) Co-authored-by: RomneyDa <[email protected]>
Problem
The rule "check authority one time, when work starts" was one bullet inside root
AGENTS.md"Choose good compromises". New changes still add post-start authority re-checks (assertCurrent()-style re-reads, tool-timesenderIsOwnerrefusals, refusal text outside the cause table). These give one person different answers depending on how or when a turn started (#203464), for exampleportalrefused in an owner's turn after a Gateway restart (#206665). The one-admission work found 242 such refusal strings in 186 files.Change
Docs and agent instructions only. No runtime code.
AGENTS.md: new top section Decide authority once. It names the owner (decideOperatorAdmissioninsrc/gateway/operator-admission.ts, frozenTurnGrant), the post-start checks that need explicit maintainer buy-in, the allowed fences (revision,expectedHead,requestId, compare-and-swap, abort signal), the accepted trade-off (a revoked person's started turn finishes) and the incidents. The old bullet, the duplicate "Security boundaries" authority bullet and a duplicate review pointer are removed. The file stays under 20,000 characters (19,961).src/gateway/AGENTS.md: new Operator Admission section: grant fields, continuation re-admission, tool gate, refusal cause table, how to add a permission (admission fact +decideTurnGrantfield + matrix cell inoperator-admission.table.test.ts), and the two boundary lints whose allowlists only shrink. The "live-authority checks" line under Run Authority now says liveness fences, which never re-read authority.src/agents/AGENTS.md: tools consume the turn'sTurnGrantand add no owner, scope or authority check of their own.docs/reference/pull-request-review-flow.mdtells every review route to report a post-start authority re-check as P1;pr-simplifyapplies the new root section.scripts/lib/no-operator-permission-read.mjs: comment points at the new section name.Impact
Contributors and agents see the rule first in root
AGENTS.md, with the owner and file pointers. Reviews flag new mid-run authority re-checks as P1.Evidence
pnpm check:agents-md-size: 29 files within 20,000 chars.pnpm docs:check-links: 0 broken.oxfmt --checkon the 6 changed files: clean.git diff --check: clean.