Skip to content

docs(agents): make deciding authority once a top-level rule - #206706

Merged
obviyus merged 1 commit into
mainfrom
docs/admission-once-rule
Nov 27, 2026
Merged

obviyus merged 1 commit into
mainfrom
docs/admission-once-rule

Conversation

@obviyus

@obviyus obviyus commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

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 (#203464), for example portal refused 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.

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

- 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.
@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

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

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling size: XS labels Nov 27, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. clawsweeper:intake:docs Preliminary submission classification; full source review pending. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:docs Preliminary submission classification; full source review pending. labels Nov 27, 2026
@clawsweeper

clawsweeper Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

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

  • Before: The authority rule appears within general compromise guidance.
  • After: Top-level guidance explicitly prohibits the duplicate decision, and review guidance identifies it as P1.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused, source-aligned documentation with appropriate reported checks and no identified defects; runtime proof does not apply.
Proof confidence 🐚 platinum hermit (4/6) Instructions, documentation, and a comment change only; shipped-entry-point proof is unnecessary.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Docs · Worth it: Yes · Fix scope: Complete
User problem: Contributors can introduce duplicate authority checks that give the same operator different answers depending on how a turn starts.
Reason: The author has prior merged ownership of this direction, and the clarification connects concrete incidents to existing admission, tool-gating, and refusal owners.

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: a1252f29a5267f4d6e8c9631969a6d4a13552167

Before merge

None.

Findings

None.

Agent review details

How this fits together

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

Technical review

Best 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

  • Root authority rule and simplification guidance keeps the original intent (123f878: Stop speculative in-flight revocation requirements and check authority when work starts; the later wording repair routes queued work through ordinary admission.)
  • Admission and lint documentation keeps the original intent (63e0742: Make a frozen turn grant the single answer to what a turn may do, rather than deriving capabilities again in consumers.)
  • Review-route guidance keeps the original intent (3244d12: Provide one local review route while preserving required independent review, CI, and security requirements.)

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit 3244d12 adds docs/reference/pull-request-review-flow.md:21 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 3244d12e5a4b; files: docs/reference/pull-request-review-flow.md)

PR surface

Docs +24, Other 0. Total +24 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 5 32 8 +24
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 6 33 9 +24

Preflight source

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

Labels

Label changes:

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

Label justifications:

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

Rating scale

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

Workflow

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

Reviewed November 27, 2026, 8:55 AM ET / 13:55 UTC.

@obviyus
obviyus merged commit d6d3bf1 into main Nov 27, 2026
117 checks passed
@obviyus
obviyus deleted the docs/admission-once-rule branch November 27, 2026 14:00
obviyus added a commit that referenced this pull request Nov 27, 2026
…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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 28, 2026
…#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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 28, 2026
…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]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XS 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