Skip to content

fix(gateway): continuation turns keep the admitted owner grant - #206665

Merged
obviyus merged 2 commits into
mainfrom
fix/continuation-turn-owner-grant
Nov 27, 2026
Merged

obviyus merged 2 commits into
mainfrom
fix/continuation-turn-owner-grant

Conversation

@obviyus

@obviyus obviyus commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Problem

In the owner's own Control UI session, a turn the Gateway starts for that session (a background exec completion after a Gateway restart, a scheduler turn, a tool handoff whose sender flag was unset) lost the owner's authority. The model then got portal needs the owner's authority, and this turn was not started by the owner and told the owner to "send any message" to get it back. The same person got a different answer depending on how the turn started.

Root cause: buildSessionEventContext (src/auto-reply/reply/session-event-context.ts) bound the command-owner authority only when the admitted grant said owner and the turn kind was restart, a scheduled run, or the target carried an ownerContinuation flag. Only the live same-session exec notifier and some tool handoffs set that flag. A durable exec wake (captureOwedRequesterTarget, used for a process restored after a restart and for stored owed rows) re-admits the requester through restoreGatewayQueuedOperatorRecovery, gets grant.owner === true, and then lost it at this gate: senderIsOwner became false, owner-only tools were refused.

Observed on main (39b6a89d2984, real isolated Gateway, real model, token-auth Control UI owner session): after gateway.restart.request, the wake for the interrupted command ran with the admitted owner grant but senderIsOwner: false, and its tool surface treated it as a non-owner turn.

Fix

The admitted grant is the only producer of the owner decision for a session-event turn (decideOperatorAdmission → grant.owner). Turn kind no longer narrows it.

  • session-event-context.ts: bind owner authority when operatorAuthority.grant.owner; no turn-kind condition.
  • Delete the ownerContinuation flag and every producer and reader: session-event-target.ts (scope field, option, reader, batch check), bash-tools.exec-notify.ts, session-tool-handoff.ts (and the senderIsOwner pass-through in github-publish-tool.ts, session-project-tool.ts, sessions-send-self-hold.ts), cron-job-turn-target.ts.
  • portal-tool.ts: delete the local senderIsOwner === false refusal. The turn's owner-only tool gate (resolveTurnToolSurface → gateAgentToolExecution, and the HTTP/loopback ownerOnlyDeny) already refuses a non-owner call without a conversation worker.
  • The owner-only gate's refusal comes from the cause table: new owner-only cause in src/gateway/operator-refusal.ts with a next step ("Ask the Gateway owner to do it."). The text no longer says "this turn was not started by the owner", which led the model to ask the owner to send another message.

Production: +14 / −54.

Decisions recorded (standing authority):

  • A completion that a requester's command routed to another chat (cross-session row in bash-tools.exec-notify.owner-continuation.test.ts) now runs with that requester's admitted grant, like every other continuation. Before, it already carried that grant for control-plane tools; only the sender flag differed. Test row updated.
  • A scheduler turn about a job (cron, cron_failure_repair) now takes the owner bit from its restored source's grant (admin scope), not from the extra automationAdmin delegation flag. The automations capability itself is unchanged.
  • No widening beyond the recorded principal's own grant: a member's or guest's continuation still has owner: false and gets the cause-table refusal.

Other tools that still refuse locally on senderIsOwner (outside this PR, OA2 PR 6 sweep): src/agents/tools/conversation-tools.ts:71, session-project-tool.ts:67, sessions-tool.ts:194,387, openclaw-delegate-tool.ts:293, extensions/codex/src/{command-diagnostics.ts:63,native-plugin-tool.ts:46,native-thread-tool.ts:166,supervision-tools.ts:706}, extensions/discord/src/actions/handle-action.guild-admin.ts:64,77, extensions/imessage/src/actions.ts:291, extensions/matrix/src/tool-actions.ts:348,422, extensions/visitor-access/src/tools.ts:84, extensions/whatsapp/src/agent-tools-login.ts:41.

User impact

After a Gateway restart, the owner's session can open portals and use other owner-only tools again from the automatic completion turn. A real non-owner continuation is refused with "I did not run portal. It needs the Gateway owner's authority, and this turn does not run with it. Ask the Gateway owner to do it."

Evidence

  • Regression: src/gateway/owed-exec-requester.test.ts reads the woken turn's own owner decision (the context the session event builds, as commands and owner tools read it) for exec, restart and tool_handoff on the same admitted target. Red on the merge base (admin and configured channel owner cells: owner: { exec: false, restart: true, tool_handoff: false }), green on head. Member cell stays owner: false.
  • Matrix note in src/gateway/operator-admission.table.test.ts points at those continuation cells.
  • E2E: see the comment below (real isolated Gateway, real model, owner Control UI session, gateway.restart.request; plus the one-admission Q/R/S run).

A session-event turn (durable exec wake after a restart, scheduler turn,
tool handoff) bound owner authority only when its turn kind matched, so
an owner's own Control UI session lost owner-only tools (portal) after a
Gateway restart. The admitted grant now decides for every entry kind;
the ownerContinuation flag and the portal tool's local owner refusal are
gone. The owner-only gate's refusal comes from the cause table.

Co-authored-by: obviyus <[email protected]>
@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 channel: discord Channel integration: discord gateway Gateway runtime agents Agent runtime and tooling extensions: qa-lab size: S labels Nov 27, 2026
@obviyus

obviyus commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

Continuation E2E: real isolated Gateway from source, real model (openai/gpt-5.5), token-auth Control UI owner session (agent:main:dashboard:<uuid>), restarts through gateway.restart.request with skipDeferral.

Durable exec wake after a Gateway restart (the owner starts sleep 30 in the background, the Gateway restarts, the command's wake turn is asked to call portal open):

Tree Portal tool result in the wake turn
merge base 39b6a89d2984 portal needs the owner's authority, and this turn was not started by the owner. Do not retry portal. (the reported text)
head 8a1c27da5f33 owner path: portal.open reached the Gateway (Portal environment is not attached to this conversation, because the model passes an invented environmentId; no owner refusal)

Head, same harness, other entry kinds (all reach the owner path, none refused): typed owner turn, live exec-completion wake, restart-resume of an interrupted turn.

Limit: the model keeps filling the optional environmentId, so the run proves the owner gate passes and portal.open runs as the owner, not that a route is allocated. Unit proof of the decision itself: src/gateway/owed-exec-requester.test.ts (red on the base, green on head).

@github-actions

github-actions Bot commented Nov 27, 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: 4d6c6250a42117b24bf91f09300100d069bea7d4
  • Maintainer: @obviyus
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/agent-tools.turn-authority.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

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 27, 2026
@obviyus

obviyus commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

One-admission E2E on head 8a1c27da5f33 (real isolated Gateway, real model): R.running-turn-finishes PASS, Q.queued-input-refused-visibly PASS, Q.refusal-sentence-in-transcript PASS, S.stop-cancels PASS. Evidence kept as verdict.json + results.jsonl from the run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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-environment 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: needs changes before merge.

What this changes

Continuation turns inherit their requester's admitted owner grant, and non-owner tool refusals use the shared refusal table.

Example: A Control UI owner backgrounds sleep 30, restarts the Gateway, and requests portal.open from the completion turn.

  • Before: The completion loses owner authority and portal refuses execution.
  • After: The completion reaches the Gateway's portal.open handler with owner authority.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The production fix is focused and has relevant Gateway proof, but a directly affected regression remains inconsistent and fails CI.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied exact-head comparison uses a real isolated Gateway, real model, token-authenticated owner session, background command, and gateway.restart.request; the restored exec wake changes from an owner refusal to reaching portal.open, with route allocation explicitly unproven.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: After a Gateway restart, an owner's automatic completion turn refuses owner-only tools and asks the owner to send another message.
Reason: The source and Gateway comparison establish a real failure, and the maintainer-authored direction explicitly chooses grant-based ownership across continuation kinds.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this maintainer-authored PR fixes a real continuation-authority failure, but leaves a reload-handoff test expecting the superseded ownership rule.

Reviewed head: 8a1c27da5f336d79d4761781f64b32b490f03da1

Before merge

  • Align the reload-handoff regression with admitted owner grants (P2) - The new owner binding changes the existing non-owner reload-handoff scenario: its client is created with operator.admin at lines 447–450, so admission gives it grant.owner=true, but isOwner remains false and line 535 expects owner_probe to be absent. The resumed model fixture consequently fails, matching the exact-head CI failure at line 643 in checks-node-changed-compact-large-44. Update this admin scenario to expect admitted owner access and retain genuine non-owner denial coverage with a non-owner grant at the appropriate boundary.

Findings

  • [P2] Align the reload-handoff regression with admitted owner grants — src/agents/tools/plugins-reload-handoff.test.ts:465
Agent review details

How this fits together

Gateway admission turns authenticated requester facts into a grant; session events carry that grant into command authorization and the agent's tool execution gate.

flowchart TD
  A[Requester identity] --> B[Operator admission]
  B --> C[Admitted grant]
  C --> D[Continuation event context]
  D --> E[Tool execution gate]
  E --> F[Gateway operation]
  E --> G[Non-owner refusal]
Loading

Technical review

Best possible solution:

Every continuation should consume its requester's admitted grant through the existing execution gate.

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

Current main visibly drops an admitted owner's authority when an exec wake lacks ownerContinuation; the supplied isolated Gateway comparison exercises that refusal before the fix and passes the owner gate afterward.

Is this the best way to solve the issue?

Using admission as the single owner decision removes redundant state and preserves requester identity; the remaining repair is to align the reload-handoff regression with that contract.

Full review comments:

  • [P2] Align the reload-handoff regression with admitted owner grants — src/agents/tools/plugins-reload-handoff.test.ts:465
    The new owner binding changes the existing non-owner reload-handoff scenario: its client is created with operator.admin at lines 447–450, so admission gives it grant.owner=true, but isOwner remains false and line 535 expects owner_probe to be absent. The resumed model fixture consequently fails, matching the exact-head CI failure at line 643 in checks-node-changed-compact-large-44. Update this admin scenario to expect admitted owner access and retain genuine non-owner denial coverage with a non-owner grant at the appropriate boundary.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit 86d835e adds src/auto-reply/reply/session-event-context.ts:315 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 86d835ec3a33; files: src/auto-reply/reply/session-event-context.ts)
  • Enes Kartal: Raw commit 21a85ac adds src/agents/bash-tools.exec-notify.owner-continuation.test.ts:97 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 21a85accdc07; files: src/agents/bash-tools.exec-notify.owner-continuation.test.ts)
  • Peter Steinberger: Raw commit 3d2f7ca adds src/auto-reply/reply/session-event-context.ts:115 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 3d2f7ca06b26; files: src/auto-reply/reply/session-event-context.ts)

PR surface

Source -40, Tests +30, Other 0. Total -10 across 26 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 11 14 54 -40
Tests 14 54 24 +30
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 26 69 79 -10

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 proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit 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:

  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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, 7:44 AM ET / 12:44 UTC.

An admin-scoped operator source is the owner on a resumed turn; the sender
flag alone no longer narrows or grants it.

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

obviyus commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

One-admission E2E on head 4d6c6250a421 (test-only change since 8a1c27da5f33): R.running-turn-finishes PASS, Q.queued-input-refused-visibly PASS, Q.refusal-sentence-in-transcript PASS, S.stop-cancels PASS.

CI round 1 had one red, ours: src/agents/tools/plugins-reload-handoff.test.ts scenario non-owner asserted that a resumed turn whose operator source has operator.admin stays non-owner because the yielding sender flag was false. That is the turn-kind narrowing this PR removes; the scenario is deleted (the operator-owner and system scenarios keep the owner and no-principal cases).

@obviyus
obviyus merged commit 6ef7508 into main Nov 27, 2026
135 checks passed
@obviyus
obviyus deleted the fix/continuation-turn-owner-grant branch November 27, 2026 13:11
@obviyus

obviyus commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as 6ef7508. Bug: continuation turns in the owner's own session (durable exec wake after a restart, tool handoff, scheduler turn) dropped the admitted owner grant at a turn-kind gate, so portal and other owner-only tools were refused. Fix: the admitted grant alone decides; ownerContinuation and the portal tool's local refusal are gone; refusals come from the cause table. Proof: owed-exec-requester.test.ts red on base, green on head; real-Gateway restart E2E (base refused with the reported text, head reaches portal.open as owner); one-admission Q/R/S pass.

obviyus added a commit that referenced this pull request Nov 27, 2026
## 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.

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

## Problem

In the owner's own Control UI session, a turn the Gateway starts for that session (a background `exec` completion after a Gateway restart, a scheduler turn, a tool handoff whose sender flag was unset) lost the owner's authority. The model then got `portal needs the owner's authority, and this turn was not started by the owner` and told the owner to "send any message" to get it back. The same person got a different answer depending on how the turn started.

Root cause: `buildSessionEventContext` (`src/auto-reply/reply/session-event-context.ts`) bound the command-owner authority only when the admitted grant said owner **and** the turn kind was `restart`, a scheduled run, or the target carried an `ownerContinuation` flag. Only the live same-session exec notifier and some tool handoffs set that flag. A durable exec wake (`captureOwedRequesterTarget`, used for a process restored after a restart and for stored owed rows) re-admits the requester through `restoreGatewayQueuedOperatorRecovery`, gets `grant.owner === true`, and then lost it at this gate: `senderIsOwner` became `false`, owner-only tools were refused.

Observed on main (`46674419098b`, real isolated Gateway, real model, token-auth Control UI owner session): after `gateway.restart.request`, the wake for the interrupted command ran with the admitted owner grant but `senderIsOwner: false`, and its tool surface treated it as a non-owner turn.

## Fix

The admitted grant is the only producer of the owner decision for a session-event turn (`decideOperatorAdmission` → `grant.owner`). Turn kind no longer narrows it.

- `session-event-context.ts`: bind owner authority when `operatorAuthority.grant.owner`; no turn-kind condition.
- Delete the `ownerContinuation` flag and every producer and reader: `session-event-target.ts` (scope field, option, reader, batch check), `bash-tools.exec-notify.ts`, `session-tool-handoff.ts` (and the `senderIsOwner` pass-through in `github-publish-tool.ts`, `session-project-tool.ts`, `sessions-send-self-hold.ts`), `cron-job-turn-target.ts`.
- `portal-tool.ts`: delete the local `senderIsOwner === false` refusal. The turn's owner-only tool gate (`resolveTurnToolSurface` → `gateAgentToolExecution`, and the HTTP/loopback `ownerOnlyDeny`) already refuses a non-owner call without a conversation worker.
- The owner-only gate's refusal comes from the cause table: new `owner-only` cause in `src/gateway/operator-refusal.ts` with a next step ("Ask the Gateway owner to do it."). The text no longer says "this turn was not started by the owner", which led the model to ask the owner to send another message.

Production: +14 / −54.

Decisions recorded (standing authority):
- A completion that a requester's command routed to another chat (`cross-session` row in `bash-tools.exec-notify.owner-continuation.test.ts`) now runs with that requester's admitted grant, like every other continuation. Before, it already carried that grant for control-plane tools; only the sender flag differed. Test row updated.
- A scheduler turn about a job (`cron`, `cron_failure_repair`) now takes the owner bit from its restored source's grant (admin scope), not from the extra `automationAdmin` delegation flag. The `automations` capability itself is unchanged.
- No widening beyond the recorded principal's own grant: a member's or guest's continuation still has `owner: false` and gets the cause-table refusal.

Other tools that still refuse locally on `senderIsOwner` (outside this PR, OA2 PR 6 sweep): `src/agents/tools/conversation-tools.ts:71`, `session-project-tool.ts:67`, `sessions-tool.ts:194,387`, `openclaw-delegate-tool.ts:293`, `extensions/codex/src/{command-diagnostics.ts:63,native-plugin-tool.ts:46,native-thread-tool.ts:166,supervision-tools.ts:706}`, `extensions/discord/src/actions/handle-action.guild-admin.ts:64,77`, `extensions/imessage/src/actions.ts:291`, `extensions/matrix/src/tool-actions.ts:348,422`, `extensions/visitor-access/src/tools.ts:84`, `extensions/whatsapp/src/agent-tools-login.ts:41`.

## User impact

After a Gateway restart, the owner's session can open portals and use other owner-only tools again from the automatic completion turn. A real non-owner continuation is refused with "I did not run portal. It needs the Gateway owner's authority, and this turn does not run with it. Ask the Gateway owner to do it."

## Evidence

- Regression: `src/gateway/owed-exec-requester.test.ts` reads the woken turn's own owner decision (the context the session event builds, as commands and owner tools read it) for `exec`, `restart` and `tool_handoff` on the same admitted target. Red on the merge base (admin and configured channel owner cells: `owner: { exec: false, restart: true, tool_handoff: false }`), green on head. Member cell stays `owner: false`.
- Matrix note in `src/gateway/operator-admission.table.test.ts` points at those continuation cells.
- E2E: see the comment below (real isolated Gateway, real model, owner Control UI session, `gateway.restart.request`; plus the one-admission Q/R/S run).

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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: discord Channel integration: discord extensions: qa-lab gateway Gateway runtime impact:auth-provider Auth, provider routing, model choice, or SecretRef resolution may break. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. security-sensitive-changed size: S 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