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
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ All notable changes to this project are documented here. This project follows

### Added

- **Durable recovery checkpoints for writing stages (#503, absorbs #525).**
An `implement` or `resolve` stage in a Git worktree records the exact staged,
unstaged and eligible untracked state as Git objects behind a private
`refs/code-cycle/recovery/<id>` ref, before it edits and again when it is
interrupted or runs out of quota. A quota stop now hands the same worktree to
the configured fallback once, in the same stage, from a complete checkpoint,
including local commits, instead of stopping `dirty_workspace` or
`workspace_changed`; both executors exhausted ends `BLOCKED` naming both
reset times. Secret paths, credential content and ignored files are never
captured (`code_cycle.recovery.secret_paths` adds patterns), a toolkit
writer lock refuses a second toolkit writer on the same worktree, and
`scripts/recovery_checkpoints.py` offers `inspect`, `restore`, explicit
`adopt` (`operator_adopted`), `discard`, lifecycle-based `prune` and
`unlock`. Recovery approves nothing and skips no check. See
`docs/recovery-checkpoints.md`.
- **Bounded re-read of review and rereview publications (#446).** A `review`
or `rereview` publication that is not seen at the first read is re-read after
1 s, 2 s and 4 s, correlated by the receipt's `attempt_id`, before it is
Expand Down
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Guides are listed in reading order. Each one has one main topic and links to the
|---|---|
| [CodeCycleToolkit 2.0 roadmap](ROADMAP_V2.md) | Approved strategy, execution modes, decisions, issue dependencies and milestones; planned capabilities are not implementation claims |
| [Role workspace policy](role-workspace-policy.md) | The write permission each dispatched role has, and which executors can enforce it |
| [Recovery checkpoints](recovery-checkpoints.md) | How an interrupted or quota-stopped writing stage keeps its exact worktree: capture, integrity, secrets, retention, writer lock, adoption and the operator commands |
| [Host permissions](host-permissions.md) | The agent capability parity rule, each stage's closed command table, how Claude and Codex enforce it, their limits, and the opt-in global set |
| [Capability parity audit](capability-parity-audit.md) | Every toolkit-owned restriction classified as a real limit, a role contract or a toolkit veto, with the issue that converts each veto and its parity baseline per executor |
| [Native parity runs](native-parity-runs.md) | The manual procedure that runs the audit's baselines with the real `claude -p` and `codex exec` and compares them with the toolkit's consent decision |
Expand Down
15 changes: 14 additions & 1 deletion docs/capability-parity-audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,22 @@ a contract breach. This inventory adds no new permission or veto.
| `run_cycle._main_worktree_root` | 1 | safe-to-swallow: optional root discovery returns absent |
| `cycle.CycleRecorder.__init__` | 1 | safe-to-swallow: quota persistence is optional |
| `cycle.CycleRecorder._check_codex_effort` | 1 | safe-to-swallow: unavailable optional model catalog |
| `cycle.CycleRecorder._match_handoff` | 1 | report-with-cause: handoff cannot be claimed on storage failure |
| `cycle.CycleRecorder._match_handoff` | 2 | report-with-cause: a failed optional adoption lookup is journaled and treated as no adoption, never a veto (#503); a handoff that cannot be claimed on storage failure blocks the dirty resume |
| `cycle.CycleRecorder._effect_snapshot` | 1 | degrade-to-not_verified: absent snapshot supplies no effect evidence |
| `cycle.CycleRecorder._claim_handoff` | 1 | report-with-cause: storage error propagated |
| `cycle.CycleRecorder._find_blocker` | 2 | safe-to-swallow: optional publication evidence unavailable, no success inferred; report-with-cause: pre-stage ancestry probe failures remain unverified and stop reconciliation |
| `cycle.CycleRecorder._record_quota_exhaustion` | 1 | safe-to-swallow: optional quota persistence |
| `cycle.CycleRecorder._clear_quota` | 1 | safe-to-swallow: optional quota persistence |
| `cycle.CycleRecorder._observe_shadow` | 1 | safe-to-swallow: shadow experiment cannot decide routing |
| `cycle.CycleRecorder._recovery_root` | 1 | safe-to-swallow: no resolvable Git worktree means no checkpoint, never a veto (#503) |
| `cycle.CycleRecorder._acquire_writer` | 1 | report-with-cause: an unwritable writer lock is journaled and the stage still runs (#503) |
| `cycle.CycleRecorder._release_writer` | 1 | report-with-cause: a failed lock release is journaled and never replaces the stage's outcome (#503) |
| `cycle.CycleRecorder._checkpoint` | 1 | report-with-cause: a failed checkpoint is journaled and never stops the stage (#503) |
| `cycle.CycleRecorder._check_checkpoint_handoff` | 1 | degrade-to-not_verified: an unreadable checkpoint cannot prove the worktree, so the automatic fallback stops and the checkpoint is named (#503) |
| `cycle.CycleRecorder._hand_over` | 1 | safe-to-swallow: the local commit count is telemetry only |
| `cycle.CycleRecorder._consume_checkpoints` | 1 | safe-to-swallow: optional lifecycle bookkeeping; consumed or not, nothing is deleted |
| `cycle.CycleRecorder._claim_adoption` | 1 | report-with-cause: storage error or changed worktree propagated before dispatch |
| `cycle.CycleRecorder.close` | 1 | safe-to-swallow: optional retention bookkeeping |
| `cycle_dispatch.StageDispatch._question_evidence` | 1 | safe-to-swallow: optional question diagnostics |
| `cycle_dispatch.StageDispatch.run` | 1 | safe-to-swallow: optional snapshot file, original snapshot preserved in memory |
| `cycle_dispatch.StageDispatch.record_resume_point` | 1 | safe-to-swallow: optional resume point, manual resume remains |
Expand Down Expand Up @@ -194,6 +203,8 @@ given instead of line numbers so the references stay valid.
| 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; 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 |
| PA-54 | A second toolkit writer on a worktree whose writer lock a live toolkit process holds is refused before it dispatches; contention while another process updates the lock record is also refused. Record changes serialize on a persistent OS guard, including reclaim, release and operator unlock. A lock of a dead process on this host is reclaimed with its record kept, an unreadable lock is held until `recovery_checkpoints.py unlock`, and a lock the toolkit cannot write never stops the stage | `recovery_checkpoints.WriterLock`, `cycle.CycleRecorder._acquire_writer` | Two toolkit writers on one worktree would make every recovery checkpoint ambiguous | #503 | role contract | — |
| PA-55 | The automatic quota handoff of a writing stage stops when the toolkit cannot prove what it would hand over: an incomplete checkpoint (`checkpoint_incomplete`), HEAD not descending from the stage's start, a changed remote or publication, an unknown starting state, or a worktree that changed between the checkpoint and the fallback | `cycle.CycleRecorder._checkpoint_gate`, `cycle.CycleRecorder._check_checkpoint_handoff` | An automatic reroute continues only work whose state is recorded exactly | #525 | role contract | — |

## Kept restrictions

Expand Down Expand Up @@ -232,6 +243,8 @@ Why each real limit and role contract stays.
| PA-50 | The current Codex stage masks its own daemon directory with mode 000. Nested Codex execution is unavailable here; the host-reported spike and suite are preserved separately from current-head local verification in `research/local-sockets-509.md`. |
| PA-51 | The owner's canonical-parameter and trusted-source requirement is enforced before consent. Missing definitions ask for an exact path or domain; review roles accept cycle or deny only and never inherit writer grants. |
| PA-52 | The host's permission layer, not the toolkit, decides an inherited MCP tool. The same agent run directly in `-p` mode meets the same denial. The toolkit adds no veto: it records the denial, keeps the evidence obtained and recovers a review from its valid receipt, so the denial stops progress only when an indispensable operation has no permitted alternative. |
| PA-54 | The lock coordinates the toolkit's own writers only and refuses no direct operation: a user or an agent working on the worktree directly is unaffected, and `unlock` lets the user clear a stale lock. It is disclosed that no lock can attribute edits made outside the toolkit. |
| PA-55 | Only the automatic path stops, and it names the checkpoint that keeps the worktree. The user can still inspect, restore or explicitly adopt the worktree and resume with `--from`, or run any operation directly (#450); automatic-recovery ambiguity is never a toolkit-wide veto. |

## Vetoes: conversion and parity baseline

Expand Down
4 changes: 4 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ All keys live under `code_cycle`. `run_cycle.py` **refuses any key not in this t
| `security_review.always_when.labels` | label terms, matched by meaning | built-in defaults | same |
| `orchestration.mode` | `auto` · `single_agent` · `claude_codex` | `auto` | `cc-orchestrator` |
| `calibration.profiles.<alias>.provider` / `.model` / `.effort` | strings | — | `cc-orca-orchestrator` with `paired_review=true` |
| `recovery.secret_paths` | glob list, added to the versioned defaults (never removes one) | none | recovery checkpoints (`scripts/recovery_checkpoints.py`); see [Recovery checkpoints](recovery-checkpoints.md#secrets) |

A configuration file that exists but can't be read (bad YAML, PyYAML missing, wrong shape) **stops** `run_cycle.py`. It never falls back to the defaults. Use `--no-config` to run on the defaults deliberately.

Expand Down Expand Up @@ -471,6 +472,9 @@ Nothing below is written into your repository, except a project-scope installati
| `~/.config/code-cycle-toolkit/calibration/` | Paired-review campaign store |
| `~/.code-cycle/runtime/` | Global runtime installation |
| `<repo>/.code-cycle/runtime/` + `.code-cycle/.gitignore` | Project runtime installation |
| `refs/code-cycle/recovery/<id>` and their objects, in the repository's Git object store | Private recovery checkpoints of writing stages; never branches or tags, never pushed. See [Recovery checkpoints](recovery-checkpoints.md). |
| `<git dir>/code-cycle-writer.lock` | The toolkit writer lock of a worktree during a writing stage |
| `<git dir>/code-cycle-writer.lock.guard` | Empty, persistent OS lock file serializing writer-lock record changes; never removed during normal operation |

On Windows, the `~/.config/code-cycle-toolkit` directory is `%APPDATA%\code-cycle-toolkit`.

Expand Down
6 changes: 5 additions & 1 deletion docs/instrumentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,11 @@ completion is unverified; generic CI success cannot clear it), `worktree_dirty`,
`worktree_diverged`. The last two stop before changing files when a dirty tree
or non-fast-forward prevents syncing an open pull request head. A closing row from an earlier version has none, and
`cc-stats` reads it as unknown. A stage row's `reroute_reason` may then be
`permission_required` or `permission_answered`.
`permission_required` or `permission_answered`, or, for a quota stop of a
writing stage (#503), `checkpoint_handoff` (handed to the fallback from a
complete recovery checkpoint) or `checkpoint_incomplete` (the checkpoint had
to exclude or could not represent relevant content, so the stage stopped); see
[recovery checkpoints](recovery-checkpoints.md).

Each dispatch row that reached an executor carries `duration_ms`, the executor
call's wall time from a monotonic clock. An attempt refused before an executor
Expand Down
Loading
Loading