Approval gates and scope resolution
HOL Guard turns a reviewable action into bounded policy authority. It creates a request for review, stores the result at an allowed scope, and reuses that result only when the current action and its security context still match. This page expands Guard decision and enforcement and connects approval handling to Runtime hooks, proxies, and shims, Secret-read risk controls, and Evaluation and assurance workflows.
Approval lifecycle
Approval request creation
An approval request is the user-facing record for an action whose current result is review or require-reapproval. Guard normalizes the result and checks that the action fields agree before it records the action identity, artifact context, workspace, risk explanation, and review links. It also preserves the canonical action envelope, decision facts, scanner evidence, and any valid approval-context token that later reuse must match.
The request keeps both a readable explanation and the facts needed for later matching. Sensitive action text is redacted for the review surface. A continuation snapshot can preserve the data needed to resume the paused operation. A request does not permit the action by itself. It pauses the action until a valid resolution becomes policy authority.
Native hook reviews also keep a canonical action envelope and verified native decision evidence for later checks. Guard offers a durable exact-action choice only when it can bind the command, launch identity, policy facts, and relevant file inputs. When it cannot prove the execution owner, it can still bind an approval to the command and its launch context. Other native reviews remain limited to the current retry or another short-lived path.
Guard passes the review link through the native hook response so the operator can reach the local approval center. For loopback links, the live hook copy can add a short-lived dashboard session token. The token is presentation data for the local review surface. It is not approval authority and is not added to non-loopback links. If Guard cannot create a signed local link, it removes the raw link and tells the operator to open the local inbox instead.
The creation path follows this sequence:
flowchart LR
A[Current Guard result] --> B{Reviewable action?}
B -->|no| C[Continue normal enforcement]
B -->|yes| D[Build review context]
D --> E[Create or refresh pending request]
E --> F[Show approval center or harness prompt]
F --> G[Wait for a scoped resolution]
The request can also carry a continuation snapshot. This gives the local service enough context to resume the paused operation after review. Hook clients share a maximum approval wait bound of 600 seconds.
References: src/…/approvals.py• L426-581 src/…/hook_native_review_approval.py• L287-370 src/…/hook_native_saved_approval.py• L92-153 src/…/approval_hook_copy.py• L38-105 src/…/approval_hook_copy.py• L156-180 src/…/approval_wait_limits.py• L1-3 src/…/models.py• L198-240
Pending review guidance
Pending approval views can show advisory context that helps a person understand what would settle the paused action. Extension coverage projects stored evidence onto the current extension catalog. It does not change the decision and has no approval control. Catalog ids that are no longer known are dropped. A step with no known ids is omitted. Delegated permissions that belong to another protection layer are also omitted so the view does not suggest that this review controls them. The delivered view stays bounded and marks a command as compound when other steps still need review or the view is truncated.
The live extension recommendation asks the resident authority to re-check the stored hint, current catalog, and extension-control state. The resident can also return the admitted control view with its catalog digest, revision, health, and control layers so the review surface uses current authority state. If that authority cannot provide a valid answer, Guard omits the recommendation rather than treating the action as safe. A connector setup recommendation applies the same rule to a still-unset connector. It also checks the connector identity, pending requests in its group, current authority, and approval-gate state. If Guard cannot scan the full pending group, it keeps the recommendation but marks it cautionary. The setup action still uses its separate local-CLI proof and apply flow.
References: src/…/approval_extension_coverage.py• L1-15 src/…/approval_extension_coverage.py• L49-63 src/…/approval_extension_coverage.py• L118-142 src/…/approval_extension_recommendation.py• L1-10 src/…/approval_extension_recommendation.py• L145-203 rust/…/approval_extension_recommendation_op.rs• L96-148 rust/…/approval_extension_recommendation_op.rs• L208-235 src/…/approval_connector_recommendation.py• L1-10 src/…/approval_connector_recommendation.py• L60-90 src/…/approval_connector_recommendation.py• L125-209
Approval queue persistence
The approval queue gives an action a durable place to wait across the approval center, command line, and harness flows. Guard keeps a request pending until it is resolved. It retains the resolution as history after the request closes.
Repeated observations of the same pending action refresh one request instead of creating duplicate prompts. A stable action identity and queue group bind the request to its harness, workspace, artifact, and meaningful action facts. Volatile delivery values do not define identity, so a later observation can update the request without changing what it covers.
Native hook requests use a shared tool identity with a per-action binding. Scope resolution must keep that binding when it closes matching pending requests. Otherwise, one accepted tool call could close a different call for the same tool.
Resolution for one request is serialized. This means concurrent callers cannot apply two terminal decisions to the same pending request.
| Queue state | Meaning |
|---|---|
pending | The action still needs a user or native harness decision. |
resolved | Guard recorded an allow or block result with its scope. |
| One-time policy evidence | Short-lived authority for the reviewed action. It is not a remembered rule. |
| Durable policy evidence | Saved authority for later matching actions within its scope. |
| Local-once evidence | Exact, short-lived continuation authority for eligible launches. It is normally consumed when claimed. |
Some approved launches need local-once evidence in addition to the ordinary policy result. Guard uses it for exact package-manager launches, Codex suspended-response continuations, and GitHub workflow approvals. Package requests are excluded from this fallback because their existing replay path has its own reuse behavior. The local-once record does not widen the selected policy scope.
References: src/…/store_approvals.py• L122-189 src/…/store_approvals.py• L225-276 src/…/store_approvals.py• L279-425 src/…/store_approval_facade.py• L41-55 src/…/store_approval_facade.py• L105-222 src/…/store_approval_facade.py• L224-289 src/…/hook_native_review_approval.py• L287-370 src/…/approvals.py• L649-671
Approval resolution
A resolution selects allow or block and a scope. Guard checks the request again before it records the result. This prevents a stale or changed request from accepting a decision that no longer describes the current action.
block and sandbox-required are terminal policy actions. They cannot be changed through the normal approval queue because a user choice must not weaken a policy or execution change. A valid resolution closes the request. It can also close other pending requests that match the same safe scope when the decision is not tied to an exact runtime context.
The resident approval-resolution plan derives the decision identity, persistence mode, expiry, local-once fallback, and sibling-request selector from the narrowed request facts. The plan is pure and has no store access. Guard applies the returned plan to its store, so the caller does not independently rebuild keys, scopes, or expiry values. The plan also restricts package-key decisions to eligible exact artifact allows.
The resolution path first applies the scope contract and then asks the local approval authority for the required gate proof. The resident approval authority owns gate eligibility, proof issue and claim ordering, lockout, cooldown, and policy revalidation. Guard then persists the resident's bounded resolution plan. Artifact decisions normally become short-lived one-time evidence, with a fifteen-minute lifetime, but an eligible exact artifact allow can be saved when the client supplies the required scope contract. A do not remember allow can still create an exact one-shot grant when the paused operation needs one. Native exact-action decisions use the same rule: a stable context token can support a durable exact allow or block, while an action that cannot prove a stable launch identity can use a command-bound approval without receiving an execution proof. Wider scopes become saved rules. Eligible browser MCP and local-tool actions use separate short-lived grants. Local-tool grants cannot become durable policy.
An exact approval-context allow keeps its exact action identity even when the selected scope is wider. The wider scope sets the lookup boundary, but it does not turn the context-bound approval into a broad permission. This also prevents the resolution from closing unrelated pending requests through broad scope matching.
Eligible package-manager launches, Codex suspended-response continuations, and GitHub workflow approvals can also record a separate short-lived local-once record. This record supports the next matching local continuation without changing the durable policy scope. The eligibility check is based on the request type and continuation or launch context. It does not make package requests use the local-once fallback.
Verified native harness acceptance is a separate artifact-scoped allow path. It closes the matching pending request after the native receipt and request identity match. It does not create a wider remembered policy and does not ask for the local approval gate a second time.
Resident transport and lifecycle failures cross the native boundary as a fixed set of safe error codes. Guard does not expose arbitrary resident diagnostics because they may contain paths or other runtime data. A transport or authority failure therefore remains a failure of the resolution path rather than an approval.
References: src/…/approval_resolution.py• L10-35 src/…/approvals.py• L649-825 src/…/approvals.py• L881-976 src/…/approval_scope_support.py• L245-292 src/…/approval_scope_support.py• L302-387 src/…/hook_native_review_approval.py• L97-191 src/…/store_approval_facade.py• L57-103 src/…/approval_once_eligibility.py• L11-23 src/…/github_workflow_runtime.py• L51-126 rust/…/approval_resolution_plan.rs• L1-21 rust/…/approval_resolution_plan_op.rs• L1-8 rust/…/approval_contracts_lifecycle_errors.rs• L1-4
Post-resolution continuation
The local daemon projects a resolved request back to the paused harness. Non-Codex harnesses receive a harness resume payload. Codex requests first try the live hook path. They then use retry or direct continuation when the live hook is not available.
This continuation does not create new authority. It uses the resolved request and returns the resolution response so the harness can continue the original operation or honor the block.
References: src/…/local_approval_continuation.py• L14-61 src/…/local_approval_continuation.py• L64-99 src/…/server.py• L3004-3026
Approval result polling
The CLI wait path reads a request until it is resolved, but it never consumes the approval. An allow result tells the caller to retry the identical action. That retry must pass the normal approval-binding checks again. A block result keeps the action blocked, while a missing request, timeout, or unreadable store returns a distinct status instead of granting authority.
References: src/…/approval_wait.py• L1-51
Scope resolution
Scope contract
The scope contract is the action-aware set of choices that Guard allows for one request. Guard derives it from trusted request facts. The contract gives a recommended choice and states restrictions. Its version and digest let Guard confirm that the client and server resolved the same request facts.
Guard uses five scope levels:
| Scope | Reuse boundary |
|---|---|
artifact | The reviewed artifact or exact action. |
workspace | Matching work in the current project. |
publisher | Matching actions from the same source. This is available for supported block decisions. |
harness | Matching actions from the same AI application. |
global | Matching actions across projects and applications on the machine. |
The available scopes depend on the action. A terminal or protected action exposes no allow scope. A reusable allow stays tied to an action selector. A wider scope changes where that same action may be reused. It does not authorize unrelated actions. The contract also reports whether an exact action can be saved and whether a trusted GitHub workflow record supports an exact task capability.
The current scope contract is version 7. A change to the action facts that affect scope or binding changes its digest. Delivery metadata and risk copy do not make the contract stale when the action itself remains the same.
References: src/…/approval_scope_support.py• L17-19 src/…/approval_scope_support.py• L53-93 src/…/approval_scope_support.py• L174-183 src/…/approval_scope_support.py• L302-372 src/…/models.py• L9-20 rust/…/approval_scope_contract.rs• L43-56 rust/…/approval_scope_contract.rs• L88-183
Scope selection and binding
When a client selects a scope, Guard recomputes the current contract and compares its version and digest with the values used by the client. The resident scope operation derives the contract from the request itself rather than trusting a client-supplied contract. A stale contract is rejected. A current but unsupported scope is also rejected. Older clients without a contract binding may be narrowed to an artifact scope, but they cannot widen a request that has no artifact authority. A contract with only one of its version or digest fields is incomplete and is rejected.
The same scope decision also determines whether the requested persistence choice is allowed. A narrowed legacy selection is not remembered. A client that did not read a contract cannot turn an exact artifact choice into durable policy. If an allow cannot bind to a retry or exact saved action, Guard refuses the allow instead of recording authority that cannot be used safely.
Workspace scope uses the request’s bound workspace. If the request has no stored workspace, Guard derives one from its configuration location. The selected workspace must match that bound value. Package requests receive a portable workspace identity only when their execution context proves that the request can move safely between matching project uses. A non-portable package context receives an exact context-bound identity for lookup, so an older path-only or portable rule cannot match it.
The stored policy selector preserves the binding promised by the selected scope. Exact runtime actions can carry a context-bound key. Workspace, harness, and global runtime approvals can still retain an exact action selector. A broad scope therefore changes the lookup boundary without discarding command, wrapper, permission, browser, or package identity.
References: src/…/approval_scope_support.py• L245-292 src/…/approval_scope_support.py• L295-372 src/…/approval_scope_support.py• L375-388 src/…/approvals.py• L707-742 rust/…/approval_scope_select_op.rs• L1-20 rust/…/approval_scope_select_op.rs• L37-131 rust/…/approval_persist_select_op.rs• L1-17 rust/…/approval_persist_select_op.rs• L105-153
Bounded temporary grants
Some routine browser MCP actions use a separate bounded grant choice. The grant can cover one exact action, one server category, or one server for a short period. Guard exposes it only when the browser intent proves a safe server identity and eligible risk category.
The grant path excludes command execution, file access, secret access, destructive changes, privileged changes, and other hard-risk categories. Its selectors remain artifact-scoped and expire automatically. Local-tool grants follow the same artifact-only and time-bound model. They cannot be saved as remembered policy.
References: src/…/temporary_mcp_approvals.py• L14-38 src/…/temporary_mcp_approvals.py• L42-94 src/…/temporary_mcp_approvals.py• L115-174 src/…/trusted_local_tools.py• L1-40 src/…/approvals.py• L679-706 src/…/approvals.py• L833-879
Approval precedence and reuse
Policy lookup precedence
At runtime, Guard compares the current policy result with saved approval evidence. Lookup checks the narrowest matching scope before wider scopes: artifact, workspace, publisher, harness, then global. Within workspace, harness, and global scopes, an exact artifact selector is preferred over a family or broad selector. Exact context matches are preferred over nullable and legacy matches.
The resident approval-reuse authority composes the candidate with the current action. An unknown current action becomes block, while an unknown saved action rejects reuse. A saved block remains a block. A current sandbox-required or block cannot be lowered by a saved allow. A saved allow can satisfy a current review. It can satisfy require-reapproval only when it is a fresh local approval or a verified durable exact approval for the same context. An integrity failure requires a new decision while preserving any stronger current action. If the resident is unavailable, Guard keeps the current evaluation and does not claim saved authority. A malformed resident answer is an error, not a no-decision.
Local-once evidence is an exact candidate with a short lifetime. A normal claim consumes it, while the package replay path can retain its matching record for its defined reuse behavior. The record cannot replace current policy checks or match a different artifact, harness, workspace, or publisher binding.
The approval-resolution plan and its wire contract keep key derivation and persistence decisions in the resident boundary. The caller applies the plan but does not treat a transport error or an unrecognized lifecycle code as approval evidence.
References: src/…/store_policy.py• L148-189 src/…/store_policy.py• L192-319 src/…/store_policy.py• L1293-1351 src/…/approval_reuse.py• L141-215 src/…/approval_reuse.py• L223-267 src/…/native_approval_reuse.py• L43-177 src/…/store_event_receipts.py• L221-259 rust/…/approval_resolution_plan.rs• L105-145 rust/…/approval_resolution_plan_op.rs• L54-70
Native exact-action reuse
Native hook reuse uses a stable exact-action context token instead of the per-delivery native request digest. The token binds the reviewed command to its launch identity, working context, policy facts, and sandbox state. Guard uses it only for an overridable review and only when the launch and its file inputs can be checked with enough certainty.
Mutable launchers, wrappers, unbound code, and unsafe file-backed inputs do not receive a durable execution token. They can still receive a command-bound approval fallback. That fallback binds the command, directory, workspace, harness, and tool identity, but it does not claim that the launched bytes were proven. A strict execution-owner path requires a new review or uses only the narrowly defined one-time retry path. A saved exact block takes precedence over an exact allow, while an unreadable saved decision fails closed for that action.
References: src/…/hook_native_saved_approval.py• L92-153 src/…/hook_native_saved_approval.py• L156-225 src/…/hook_native_saved_approval.py• L287-372 src/…/hook_native_review_approval.py• L415-447 src/…/native_approval_reuse.py• L43-177 rust/…/approval_fallback_tests.rs• L72-124 rust/…/approval_fallback_tests.rs• L127-153
Context validity
Reusable runtime approval evidence is bound to an opaque context token. The token represents action identity, content, capabilities, policy, and sandbox as separate facts. It also binds the current extension-control state that can affect the reviewed action. Guard compares saved and current tokens without exposing the raw values in the token.
Any changed dimension invalidates reuse. A malformed token or a legacy artifact hash cannot prove that all dimensions stayed the same. Guard treats it as changed content and requires review. If the native digest authority is unavailable or cannot express a component, Guard also fails closed rather than treating degraded data as proof of unchanged context. For runtime launches, incomplete executable or code-entry identity receives the same restrictive treatment.
References: src/…/approval_context.py• L145-300 src/…/approval_context.py• L332-345 src/…/approval_context.py• L564-805 src/…/approval_context.py• L1218-1254
Approval claim and consumption
A lookup does not by itself authorize launch. After current policy and saved evidence agree, the caller claims the selected approval at the launch boundary. The claim checks that the row is still valid, unchanged, unexpired, and covered by the same authority revision observed during evaluation.
Claim behavior depends on the evidence type:
- A short-lived approval-gate row is consumed after use.
- A reusable package local-once record can remain available for its matching replay path.
- Other local-once evidence is consumed after a successful claim.
- A durable exact approval remains available after a successful claim.
- A compound launch claims all selected approvals in one transaction. If one member fails, Guard rolls back the whole claim.
This final claim closes the gap between finding approval and using it. A concurrent resolution, policy update, expiry, or integrity change therefore causes the launch to follow the recomputed safer action.
References: src/…/store_policy.py• L1692-1717 src/…/store_policy.py• L1735-1809 src/…/store_policy.py• L1811-1860 src/…/store_policy.py• L1863-1968 src/…/store_event_receipts.py• L137-259
Approval gate state
Gate factors and state
The local approval gate protects the act of making a sensitive decision or policy change. It is separate from action approval. The action scope says what may run. The gate confirms that the person making the decision passed the required local check.
The native resident owns the verifier, lockout, cooldown, grant table, and gate decision. Guard exposes only a safe public snapshot for settings and dashboard views. That snapshot reports whether the gate is enabled and configured. It also reports cooldown, lockout, strict-decision, TOTP enrollment, and recent-session status. A home that never configured the gate has no local gate to enforce for read-only checks. A configured home whose resident cannot answer fails closed.
The gate can use a password or TOTP authenticator code. Five failed attempts for one factor or across factors cause a temporary lockout. A successful required factor check resets the failure budgets. Password or TOTP changes advance the authentication generation. This invalidates active proofs and other authentication state that could outlive the change.
References: src/…/approval_gate.py• L1-13 src/…/approval_gate.py• L85-163 src/…/approval_gate_state.py• L14-45 src/…/approval_gate_types.py• L10-26 src/…/approval_gate_types.py• L41-72 src/…/approval_gate.py• L459-481
Gate coverage and proof
An enabled gate covers high-risk decisions such as an allow action or a global scope. It can also be configured to cover every decision. Global operations are strict even when the action itself is not allow. Strict work cannot use a weaker cooldown-based proof.
After a successful check, Guard issues a short-lived proof bound to its purpose, action, scope, subject, session, factor set, and authentication generation. A later operation must present a matching proof. TOTP can use a recent proof from the same local OS session for a short period. A flow that requires a fresh TOTP must receive a new authenticator code and a new accepted counter rather than reuse that recent proof.
Gate grants expire after a short interval. Guard checks their stored metadata again at each protected operation. An expired, revoked, changed, or misused grant cannot authorize the operation. Exact extension-control and local CLI trust changes use strict proofs that are consumed atomically for that one mutation.
References: src/…/approval_gate.py• L261-355 src/…/approval_gate.py• L358-456 src/…/approval_gate.py• L459-481 src/…/approval_gate_types.py• L54-72 src/…/approval_gate_state.py• L17-45
Resolution flow
The complete flow shows how a review becomes scoped policy evidence. That evidence must pass scope and gate checks before runtime reuse. After local daemon resolution, the response also carries the data needed to resume the original harness operation.
sequenceDiagram
participant Runtime
participant Guard
participant Queue
participant Person
participant Gate
participant Plan
participant Policy
participant Harness
Runtime->>Guard: Report reviewable action
Guard->>Queue: Create or refresh pending request
Person->>Queue: Select allow or block and scope
Queue->>Guard: Return resolution with contract binding
Guard->>Guard: Recompute scope and reject stale or ineligible choices
Guard->>Gate: Check local approval gate when required
Gate-->>Guard: Return short-lived proof
Guard->>Plan: Derive bounded decision and persistence plan
Plan-->>Guard: Return policy identity, expiry, and local-once data
Guard->>Policy: Persist bounded decision evidence
Runtime->>Policy: Look up current matching evidence
Policy-->>Guard: Return candidates by scope precedence
Guard->>Guard: Recheck context, action, integrity, expiry, and claim
Guard-->>Runtime: Allow, warn, review, contain, or block
Guard-->>Harness: Return continuation or resume result
Change checklist
When these files or sections are changed, remember to consider these:
- Keep request identity, queue grouping, deduplication, and scope-contract digest inputs aligned. A field that changes action meaning but is absent from identity or the digest can reuse the wrong pending request or stale scope choice.
- Keep native request bindings separate from stable exact-action tokens. A per-delivery digest may support one retry but must not become a durable remembered rule.
- Keep the scope contract version, eligibility flags, policy selector normalization, and runtime lookup precedence aligned. A new scope or exact-action rule must preserve the same action binding when it is written and when it is read.
- Keep the resident scope-selection and persistence operations deriving the contract from the request. A client-supplied contract must not widen an eligible scope or make an unsafe exact action persistable.
- Keep the approval-resolution plan as the single source for decision keys, persistence mode, expiry, local-once rows, package decisions, and sibling selectors. Store callers must apply its result without recomputing those values.
- Keep the resolution-plan request and result schemas, request digest, feature flag, and lifecycle error allow-list aligned across the native boundary. Unknown fields, stale schemas, or raw diagnostics must not become approval data.
- Keep legacy scope narrowing separate from explicit contract resolution. A narrowed choice must not be remembered, and a block must not be silently narrowed.
- Keep package execution-context rules aligned between portable approval creation and runtime workspace lookup. A change can silently turn a portable package rule into a path-only match or allow a non-portable context to reuse it.
- Keep context-token dimensions and the extension-control binding aligned with every runtime fact that can change execution authority. A new capability or sandbox input must invalidate old reuse when it changes the reviewed action.
- Keep resident approval-reuse transport and result validation aligned. Unavailable authority must preserve the current action without a claim. Malformed authority output must not become a successful no-decision.
- Keep local-once eligibility aligned with continuation snapshots, workflow approval records, and package-manager launch targets. A newly eligible launch must get exact short-lived authority without changing the durable policy scope.
- Keep one-time, local-once, local-tool, temporary MCP, and durable approval sources distinct in lookup and claim paths. A short-lived grant must not become durable, and a durable exact approval must not be consumed like a one-time grant.
- Keep command-hash fallback separate from proven execution ownership. A fallback may bind the command and launch context, but it must not claim that mutable script bytes were proven.
- Keep gate proof bindings aligned with every protected mutation. Changes to action, scope, purpose, subject, session, factor generation, or recent TOTP binding must reject an old proof.
- Keep native harness acceptance and local queue resolution on the same artifact-scoped contract. A native accept must not create a wider local policy than the queue path allows.
- Keep local daemon resolution responses aligned with continuation and resume contracts. A resolved request must not report success while dropping the harness data needed to continue or stop the original operation.
- Keep explicit persistence choice aligned with the selected scope. An eligible exact artifact allow may be durable only with a current contract, while local-tool grants must remain short-lived and non-durable.
- Keep the approval wait bound aligned between hook clients and the shared limit. A client must not wait beyond the 600-second cap or turn a timed-out review into approval.
- Keep public gate snapshots separate from resident authority. A new gate field must not let callers infer permission from display state or bypass resident proof checks.
- Keep extension coverage and recommendation payloads advisory. Catalog ids, resident answers, and control revisions must be checked again when a pending request is read. Keep delegated permissions out of coverage when another protection layer owns them.
- Keep connector setup recommendations tied to the current connector identity and group scan. An incomplete scan must remain cautious, and setup must continue through the proof-gated apply path.
- Keep CLI approval waits read-only. A reported allow must lead to an identical retry that revalidates the approval binding rather than consume or widen authority in the wait command.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The current request changes after the client receives its scope choices. | The selected scope could authorize a different action. | Compare the scope contract version and digest, then reject stale selections. |
| A client sends only a contract version or only a contract digest. | Guard cannot tell which contract the client used. | Reject the incomplete contract instead of resolving it. |
| A client requests a scope that the action does not support. | A review could become broader authority than its evidence supports. | Reject the selection as ineligible instead of widening it. |
| A legacy client asks for a wider scope and the action has no artifact authority. | An old client could create authority for an unbound action. | Refuse the selection because artifact narrowing is not available. |
A block or sandbox-required result enters the approval queue. | A normal allow choice could weaken terminal enforcement. | Reject it as not resolvable through the approval path. |
| The approval-resolution plan receives the wrong schema, an oversized request, or fields outside its contract. | The caller could apply a plan that does not describe the request. | Reject the plan and bind accepted results to the canonical request digest. |
| A caller recomputes a key or expiry instead of applying the resident plan. | Persistence and lookup can disagree about the authority that was approved. | Keep key, persistence, expiry, and matching-selector derivation in the resident plan. |
| A native exact token cannot bind the launch or file inputs. | A saved allow could cover changed code or a different command. | Keep the action on review or the limited one-time retry path. |
| A command-hash fallback is used as proof of execution ownership. | A saved command approval could be mistaken for proof of the launched bytes. | Treat the fallback as command-bound approval and require strict ownership proof where needed. |
| The resident approval-reuse service is unavailable. | A saved approval could be claimed without the authoritative composition. | Preserve the current evaluation and do not claim saved evidence. |
| The resident returns a malformed decision payload. | Invalid data could be treated as a safe no-decision or grant. | Raise a malformed-result error and do not grant reuse. |
| A resident returns a raw or unlisted lifecycle diagnostic. | Paths or runtime data could cross the native boundary. | Expose only the fixed lifecycle error codes and redact arbitrary diagnostics. |
| A saved allow has a changed identity, content, capability, policy, or sandbox context. | The approval may describe a different runtime action. | Fail reuse with a changed-context result and require review. |
| A package approval is reused outside its proven execution context. | A package rule could match a different install or run context. | Use a portable package identity only for portable contexts and an exact identity otherwise. |
A current action is sandbox-required or block while a saved allow matches. | Saved evidence could lower a stronger current policy result. | Preserve the current terminal action and do not claim the saved allow. |
| Two runtime evaluators claim the same approval or one member of a compound claim changes. | One launch could use stale or partly consumed authority. | Check the authority revision and claim the full group in one transaction. |
| Two callers resolve the same pending request at once. | A second decision could overwrite or misreport the first decision. | Serialize resolution by request and reject a request that is no longer pending. |
| A queue request is cleared while its continuation resume remains. | A later retry could resume an operation that no longer has a review record. | Purge request resumes as part of queue deletion. |
| Five factor failures occur or the gate state cannot be read. | Further protected changes could proceed without a valid local check. | Lock the gate after the failure limit and fail closed on invalid state. |
| A gate proof expires, is revoked, or does not match its purpose or scope. | The person’s prior check cannot authorize the new mutation. | Reject the proof and require a new gate check. |
| A native accept has the wrong harness, artifact, or action binding. | One native prompt could close another pending request. | Verify the native receipt and exact request fields before artifact-scoped closure. |
| A loopback approval link has no valid dashboard session token. | The hook could expose an unusable or unsafe local review link. | Remove the raw link and direct the operator to the local inbox. |
| A hook waits past the shared approval limit. | A stale review response could arrive after the guarded operation has moved on. | Cap the wait at 600 seconds and keep the action under normal enforcement. |
| A catalog id or extension hint is stale when a pending review is read. | The review screen could show advice for an extension that no longer governs the action. | Drop unknown coverage ids and omit unavailable recommendations without changing the decision. |
| A connector group scan stops before all pending rows are read. | The setup card could understate the risk of the connector group. | Mark the recommendation as cautionary and keep setup behind the separate proof-gated flow. |
The CLI wait sees allow but the caller changes the action before retry. | A decision for one action could be applied to another. | Tell the caller to retry the identical action and revalidate its binding. |
Key files
| File | Why to read it |
|---|---|
| src/…/approvals.py | Connects reviewable decisions, queue creation, scope selection, policy persistence, resolution, local-once recording, and continuation inputs. |
| src/…/approval_scope_support.py | Defines action-aware scope eligibility, contract freshness, workspace binding, package context binding, and exact-action persistence eligibility. |
| rust/…/approval_scope_select_op.rs | Shows the resident decision that derives and validates a request’s scope contract before it accepts a selected scope. |
| rust/…/approval_persist_select_op.rs | Shows how the resident applies the same contract to remembered-policy choices and execution binding. |
| rust/…/approval_scope_contract.rs | Defines the shared action facts that determine scope, persistence, and exact-action eligibility. |
| rust/…/approval_resolution_plan.rs | Defines the native contract for turning one resolved request into bounded policy and one-shot persistence instructions. |
| rust/…/approval_resolution_plan_op.rs | Derives decision identity, persistence mode, expiry, local-once data, package decisions, and sibling matching from trusted request facts. |
| rust/…/approval_contracts_lifecycle_errors.rs | Defines the safe error-code boundary for resident approval and lifecycle failures. |
| rust/…/approval_resolution_plan_vectors_tests.rs | Verifies that resolution plans preserve prior behavior while covering one-shot fallback and package-key persistence. |
| src/…/store_approval_facade.py | Shows the public paths for native acceptance, single resolution, grouped resolution, and scope-matching resolution. |
| src/…/approval_gate.py | Connects callers to the resident gate authority and exposes gate checks, short-lived proofs, and protected mutations. |
| src/…/approval_gate_types.py | Defines the public gate purposes, input values, proof shape, and strict wire decoding boundary. |
| src/…/approval_gate_state.py | Defines the public gate snapshot and the state fields shown to settings and dashboard users. |
| src/…/approval_hook_copy.py | Controls how review links and signed loopback dashboard sessions appear in live hook messages. |
| src/…/approval_wait_limits.py | Defines the shared maximum wait for approval responses. |
| src/…/approval_wait.py | Shows the read-only CLI wait contract and the retry requirement after an allow result. |
| src/…/hook_native_review_approval.py | Shows how native hook reviews pause, reuse a verified retry, and enter the local approval queue. |
| src/…/hook_native_saved_approval.py | Defines stable native exact-action identity and the saved allow or block path. |
| rust/…/approval_fallback_tests.rs | Shows the boundary between proven execution tokens and command-bound approval fallback. |
| src/…/native_approval_reuse.py | Defines the resident bridge for authoritative composition of current action and saved approval evidence. |
| src/…/approval_reuse.py | Defines reuse outcomes, transport-failure behavior, and strict validation of resident decisions. |
| src/…/store_policy.py | Defines saved-policy lookup order, integrity checks, and atomic approval claims. |
| src/…/store_event_receipts.py | Defines exact local-once evidence lookup, integrity checks, package replay behavior, and atomic claim. |
| src/…/approval_context.py | Defines opaque context binding and runtime launch identity checks that can invalidate approval reuse. |
| src/…/approval_extension_coverage.py | Projects recorded extension evidence onto current catalog labels for the review screen without changing authority. |
| src/…/approval_extension_recommendation.py | Requests and validates resident-authoritative extension setup advice for pending approvals. |
| rust/…/approval_extension_recommendation_op.rs | Provides the resident catalog and control-authority view used to recheck advisory extension recommendations. |
| src/…/approval_connector_recommendation.py | Rechecks connector setup advice against current connector state, pending group risk, authority, gate state, and scan completeness. |
| src/…/local_approval_continuation.py | Defines how a local daemon resolution returns harness or Codex continuation data. |