Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/capability-parity-audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ given instead of line numbers so the references stay valid.
| PA-33 | A configured verification command needs a Bash timeout of at least 600 s, and the toolkit sets `BASH_MAX_TIMEOUT_MS` to the same 600 s, so a longer check cannot finish | `stage_permissions.CLAUDE_VERIFICATION_TIMEOUT_MS`; `executors.py` dispatch environment | Avoids a check timing out early | #416: `basedpyright` needs 12 min 25 s | toolkit veto | #377 |
| PA-34 | A stage report that differs only in representation is normalized before strict validation: receipt aliases `plan_revision` / `plan_digest` become `revision` / `digest`; a single `evidence` object becomes a one-item list; unknown top-level keys in a closed result move to `normalization.original`; lexical `check.level` variants are lower-cased and trimmed. Original values remain beside normalized values. Outcome, execution and integrity fields are never coerced or inferred | `scripts/review_contract.py` (`PLAN_RECEIPT_ALIASES`), `scripts/issue_review.py` (`normalize_result`), `scripts/verification_plan.py` (`normalize_tests`, `CHECK_LEVELS`) | Machine-readable results | #433, #412, #435 | toolkit veto | #433 (converted by #453 for `attempts`), #459; a `tests` block the runtime cannot read no longer stops the cycle `BLOCKED` and a reported frozen check without `command` takes it from the frozen check (#450) |
| PA-35 | A grant for a configured verification command does not cover its variants (an environment prefix, `rtk`, a redirection into `$TMPDIR`), so the stage asks again | `grants.py` exact matching; `stage_permissions.operation` | Exact consent | #439 | toolkit veto | #439 |
| PA-36 | A publishing stage that reported `BLOCKED` after a verified publication stopped the cycle as `stage_not_completed`. Since #464 a stage that reports `BLOCKED` without `completed_status` is judged on its structured result (`inferred_completion`), and a stop that remains names the real cause apart from the incidental refusals | `scripts/command_permissions.py` `reconcile_result`, `inferred_completion`; `scripts/cycle_dispatch.py` `blocked_cause` | Completion evidence | #364, #446, #397 | toolkit veto | #364 (converted by #449 and #464) |
| PA-36 | A publishing stage that reported `BLOCKED` after a verified publication stopped the cycle as `stage_not_completed`. Since #464 a stage that reports `BLOCKED` without `completed_status` is judged on its structured result (`inferred_completion`), and a stop that remains names the real cause apart from the incidental refusals | `scripts/command_permissions.py` `reconcile_result`, `inferred_completion`; `scripts/cycle_dispatch.py` `blocked_cause` | Completion evidence | #364, #446, #397 | toolkit veto | #364 (converted by #449 and #464); #550: a hook refusal is no longer recorded a second time as `claude_permission`, whose duplicate record lacked the hook's intent and kept a published stage `BLOCKED` |
| PA-37 | A review or rereview publication the runtime did not observe was treated as missing and retried without confirming the remote state. Since #446 it is re-read three times with backoff before it is called absent, and a persistent read failure stops the cycle as `BLOCKED` with `publication_unverified`, which is a real limit of the provider and never triggers another publication | `scripts/cycle_publication.py` (`settle_publication`), `scripts/cycle_history.py` (`REREAD_BACKOFF`) | Completion evidence | #446 | toolkit veto | #446 (converted by #446) |
| PA-38 | Docker access needs the `docker_host` grant | `stage_permissions._check_docker` (`_DockerDenied`); `--grant docker_host=…` | Docker access is root on the host | #345, #398 | toolkit veto | #289 (converted to a cycle or persistent grant) |
| PA-39 | An issue review is not dispatched when the runtime's snapshot of its GitHub work item is not complete, and a `READY` that leaves an unreadable referenced item of the snapshot unnamed is not confirmed | `cycle_dispatch.review_issue`; `issue_review.assess` (`unreadable_links`); `scripts/issue_snapshot.py` | A readiness judgement on complete, disclosed input | #397 | role contract | — |
Expand All @@ -192,7 +192,8 @@ given instead of line numbers so the references stay valid.
| PA-49 | Writing path/domain grants never reach review roles | `grants.ConsentBroker.granted`; `executors.dispatch` | Owner-defined stage scope | #509 | role contract | — |
| PA-50 | The local-socket spike cannot be repeated inside a nested Codex boundary | `grants.LOCAL_SOCKETS`; `docs/research/local-sockets-509.md` | The executor masks its daemon socket directory; the host-reported measurement is retained separately from local verification | #509 | real limit | — |
| PA-51 | Command-output targets require an explicit confirmed definition before permission; reviews request a separate cycle-only grant | `grants.ConsentBroker.request_definition`, `request` | User-defined source and role boundaries; output is an untrusted suggestion and a definition never authorizes access | #509 | role contract | #509 (converted to canonical consent and separate review scopes) |
| PA-52 | MCP tools a stage inherits from the user's configuration are neither hidden nor pre-approved by the toolkit; a `claude -p` denial of one is recorded as a `claude_permission` refusal (host limit), never invalidates evidence already obtained, and never becomes the stop cause of a review recovered from its receipt | `scripts/cycle_dispatch.py` (receipt recovery), `scripts/cycle_review_gate.py` (`recover_review`), `docs/host-permissions.md#inherited-mcp-tools-486` | The user's configuration decides which inherited tools run; a code-executing MCP tool runs outside the command hook and is not presented as supervised | #486: an MCP tool denial was mixed into a receipt-recovery stop | real limit | #486 |
| PA-52 | MCP tools a stage inherits from the user's configuration are neither hidden nor pre-approved by the toolkit; a `claude -p` denial of one is recorded as a `claude_permission` refusal (host limit), never invalidates evidence already obtained, and never becomes the stop cause of a review recovered from its receipt | `scripts/cycle_dispatch.py` (receipt recovery), `scripts/cycle_review_gate.py` (`recover_review`), `docs/host-permissions.md#inherited-mcp-tools-486` | The user's configuration decides which inherited tools run; a code-executing MCP tool runs outside the command hook and is not presented as supervised | #486: an MCP tool denial was mixed into a receipt-recovery stop | real limit | #486; since #550 a published implement or resolve stage that reported `BLOCKED` is reconciled with the denial counted as an auxiliary host limit, still never a question, including no `unattended_denial` decision in a run without a human channel |
| PA-53 | Before the cycle records its change request, `gh pr edit` and `gh pr comment` in implement may target only the current branch's pull request. Naming that pull request by number was refused, which refused the stage's own receipt publication after it opened the PR. Since #550 the number is allowed when GitHub reports it, at the moment of the call, as the open pull request of this repository whose head is the checkout's branch; any other number, or any doubt, keeps the refusal | `stage_permissions._check_gh`, `_branch_pull_request` | Publication only on the cycle's own change request (PA-11) | #486: `gh pr edit 549 --body-file $TMPDIR/report.md`; #503: `gh pr comment 554 --body-file $TMPDIR/pr-comment.md` | toolkit veto | #550 |

## Kept restrictions

Expand Down Expand Up @@ -275,6 +276,7 @@ the real repository.
| PA-37 | #446 re-reads the change request a bounded number of times before retrying | `claude -p` posts the review comment, which then exists on the change request | `codex exec` posts the same comment |
| PA-38 | Done in #289: `--grant docker_host=cycle\|persistent` or `docker.host_socket_access: true` | `claude -p` with the user's Docker access runs `docker compose ps` | `codex exec -s workspace-write` with socket access runs `docker compose ps` |
| PA-40 | Done in #464: `sed -n`, `sed -E` and `sed -e` read-only scripts, `date` without a clock change and `ps` with fields that show no command line are in the table of every stage; the other forms stay the PA-18 consent question | `claude -p` runs `sed -n 1,5p fixture.txt`, `date +%s` and `ps -eo pid,comm`, then `sed -i s/a/b/ fixture.txt` and `ps -eo pid,args` | `codex exec -s workspace-write` runs the same commands; a Codex stage has no command table, so the test pins that it stays equal |
| PA-53 | Done in #550: the branch's own pull request may be named by number once GitHub confirms it. The boundary is pinned by unit tests only (`test_the_branch_pull_request_can_be_named`, `test_any_doubt_keeps_the_refusal`, with the GitHub lookup mocked). The #550 native procedure in `docs/native-parity-runs.md` does not run `gh pr edit <n>` or `gh pr comment <n>`: it would need an open pull request whose head is the fixture's branch, and it would publish on it | `claude -p` runs `gh pr comment <n> --body-file $TMPDIR/pr-comment.md` on the pull request it opened | `codex exec -s workspace-write` runs the same; a Codex stage has no command table |

## Sensitive operations

Expand Down
20 changes: 18 additions & 2 deletions docs/host-permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ filesystem and credential isolation; no command table is added to Codex.
An executor refusal is attributed to `claude_permission`, with
`--allowedTools` and `permissions.allow/deny` (including managed settings) in
the reason and journal. A toolkit grant cannot override those settings.
A refusal by the stage hook is attributed to `toolkit_hook` and journaled by
the hook as `hook_bash` or `hook_edit`. Claude also lists a hook's `deny` in
its final `permission_denials`; an entry whose call the hook answered is the
same refusal, so it is not recorded again as `claude_permission` (#550). Only
the hook's record carries the rule, the operation and, for `gh pr edit`, the
intent that the runtime needs to judge a stage that published and then
reported `BLOCKED`. [Native parity runs](native-parity-runs.md#550-which-layer-refuses-a-dispatched-claude-stage)
shows which layer refuses each reported form.
Auxiliary refusals after completed stages and observed successful retries stay
in the refusal log but do not create unanswered decisions. Required checks and
unresolved essential operations keep their existing decision path.
Expand All @@ -244,7 +252,7 @@ fall back to `git grep` or `grep`. See [project choices and preparation](depende
| every stage | `git status`, `diff`, `log`, `rev-parse`, `show`, `branch --show-current`; `gh issue view`, `pr view`, `pr checks`, `auth status`, `repo view`; `gh api user --jq .login`; `ls`, `cat`, `head`, `tail`, `wc`, `grep`, `find`, `jq` | — |
| `issue_review` | `gh issue list`, `gh pr list`, `gh search issues\|prs`; `git merge-base`, `ls-files`, `grep`, `blame` | none |
| `review`, `rereview` | `gh pr diff`, `git merge-base`, `ls-files`, `grep`, `blame`; `git fetch origin` only when the workspace has an `origin` remote (Claude's review clones have none) | `gh pr comment` and `gh pr review --comment` on the cycle's change request |
| `implement` | as review, plus `git worktree list`, `gh pr list`, `gh run view\|list` | `git add`, `commit`, `push`, `fetch`, `checkout`, `switch`, `pull`, `rm`, `mv`; `gh pr create`, `gh pr edit` and `gh pr comment` on the branch's change request; `gh issue comment` on the work item |
| `implement` | as review, plus `git worktree list`, `gh pr list`, `gh run view\|list` | `git add`, `commit`, `push`, `fetch`, `checkout`, `switch`, `pull`, `rm`, `mv`; `gh pr create`, `gh pr edit` and `gh pr comment` on the branch's change request, named by no argument or, before the cycle records it, by the number GitHub reports as this repository's open pull request for the checkout's branch (#550); `gh issue comment` on the work item |
| `resolve` | as implement; literal `gh api repos/<configured-owner>/<configured-repo>/check-runs/<numeric-id>/annotations` with only `--jq` and `--paginate` | as implement without `gh pr create`/`edit`; and exactly three `gh api graphql` calls for review threads |

In resolve, `gh run view` requires a numeric run ID. Every `--job`/`-j`
Expand Down Expand Up @@ -809,6 +817,12 @@ prevents an indispensable operation with no valid alternative, and then it is
reported as that host limit. A review that already published a valid receipt
for the current head is recovered from it and continues to the CI gate
([Review verdicts recovered from a receipt](review-cycle.md#review-verdicts-recovered-from-a-receipt-486)).
An implement or resolve stage that published and then reported `BLOCKED` is
judged with the denial among its other refusals, as an auxiliary host limit:
the published state the runtime verifies decides whether it completes (#550).
The denial is never a consent question, in any stage or status: an unattended
run journals no `unattended_denial` decision for it, because the toolkit can
neither grant nor deny an inherited tool.

### Own stage artefacts and dispatch-unique paths (#486)

Expand Down Expand Up @@ -1042,7 +1056,9 @@ refusal in such a run, not only `--detach` (#464):
reason and runtime class (`denial_classification`), and as a pending
decision (`decision_asked`, component `unattended_denial`, status
`unanswered`). The decisions record of the cycle lists it afterwards, and
`--grant command_<sha256>=…` answers it on the next run.
`--grant command_<sha256>=…` answers it on the next run. A denial of an
inherited MCP tool is classified but never pending: it is a host limit
([Inherited MCP tools](#inherited-mcp-tools-486)).
3. **An incidental denial continues.** A stage whose work is done, whose
publication is verified and whose refusals were only inspection or
redundant keeps its status. The checks it could not run stay `not_verified`.
Expand Down
42 changes: 42 additions & 0 deletions docs/native-parity-runs.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,48 @@ and any actual permission or infrastructure limit.
Keep #455 open until both native comparisons are recorded; `not_verified`
does not demonstrate parity. PA-19 needs no Docker cleanup.

### #550: which layer refuses a dispatched Claude stage

`dispatch` starts `claude -p` the way the runtime dispatches an implement stage:
the stage's `PreToolUse` hook in `--settings` and the `--allowedTools` patterns
of its table. It asks for each command refused in the #486 and #503 cycles,
made independent of their repository, and records:

```text
python3 docs/native-parity/run.py setup
python3 docs/native-parity/run.py dispatch
```

| Field | Meaning |
|---|---|
| `layer` | `ran`, `toolkit_hook` (the hook refused it with a consent question), `claude_permission` (Claude's own layer refused it with no hook answer) or `not_run` |
| `consent_offered` | the hook's refusal carries the exact operation the runtime asks about |
| `claude_listed_denials` | how many entries Claude's final `permission_denials` holds |
| `recorded_claude_permission` | how many of them the toolkit records as `claude_permission` |

A row passes when its `layer` is `ran`, or `toolkit_hook` with
`consent_offered`, and `recorded_claude_permission` is 0 for a `toolkit_hook`
row. `claude_listed_denials` greater than 0 on a `toolkit_hook` row is the
native evidence that Claude lists a hook's `deny` among its own denials, which
the toolkit recorded twice before #550. A `claude_permission` row on a command
the hook allowed is a gap in the dispatch's `--allowedTools`: file it with the
output. The quoted, `-e`, `$TMPDIR` and compound forms stay `toolkit_hook`
under #524; `git grep -n -A3` runs.

`dispatch` does not cover PA-53, the stage's own pull request named by number
(`gh pr edit <n>`, `gh pr comment <n>`). Allowing it needs an open pull request
whose head is the fixture's branch, and running it would publish on that pull
request. PA-53 is pinned by `OwnChangeRequestTests` in
`tests/test_claude_stage_refusals.py`, with the GitHub lookup mocked.

## What each side does

| Side | What it runs |
|---|---|
| `toolkit` | For each command and each executor, with the real consent machinery and no mocks: the table refuses it, a consent question is offered, an exact grant allows it, the same command plus an extra flag is still refused, and the subprocess hook allows it. |
| `native claude` | `claude -p --allowedTools Bash` is asked to run the audit's baseline command in the fixture and to report its exit code and output. |
| `native codex` | `codex exec -s workspace-write` does the same, with `sandbox_workspace_write.network_access=true` for PA-21 and PA-22. |
| `dispatch` | `claude -p` with the implement stage's hook and `--allowedTools` runs the #550 commands; the result names the refusing layer. |

The commands per row are the ones in the audit: a pipe to `head` and a heredoc
into `$TMPDIR` (PA-19), `git ls-tree HEAD` and
Expand Down Expand Up @@ -122,3 +157,10 @@ Limits of this comparison:
execution with execution after the real shared hook accepts each executor's
grant metadata; they do not launch either native executor, so this run is
the native evidence.
- 2026-11-30, #550 (PR #555, commit `3862376`): `dispatch` with this
branch's `scripts/`, outside any cycle. All nine `DISPATCH_COMMANDS` rows
pass. `git grep -n -A3 fixture -- .` ran; the other eight were refused by
`toolkit_hook` with a consent question. Claude listed each hook `deny` among
its own `permission_denials` (one entry, two for `git --version` and
`printenv CODE_CYCLE_STAGE_ROLE`), and none was recorded as
`claude_permission`. PA-53 was not part of the run (see the #550 section).
Loading
Loading