Skip to content

feat(resolve): stage verification and native review scratch space - #240

Merged
datacas merged 2 commits into
mainfrom
task-182
Oct 15, 2026
Merged

datacas merged 2 commits into
mainfrom
task-182

Conversation

@datacas

@datacas datacas commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Under parallel, resolution now verifies locally, reviews the fix delta from the latest trusted review or rereview receipt, publishes, and reports checks once without waiting or starting CI fix rounds. Missing, malformed, or non-ancestor review boundaries fall back to the accumulated diff. strict keeps its existing CI wait and accumulated review; initial review, rereview, and the SHA-scoped approval gate keep their existing requirements.

Native Codex and Claude read-only dispatches receive a unique writable TMPDIR outside the repository and clean it up on success, failure, timeout, and cancellation. Codex grants write access to that directory through a profile extending :read-only. Orca's asynchronous review behavior is unchanged and documented.

Work item: #182.

Diagnosis

This is the remaining feature work after #228 / PR #230. The runtime had a parallel implementation directive but no equivalent resolve directive; the orchestrators explicitly retained resolve's CI wait. Native review dispatches also lacked writable temporary space. No defect reproduction is claimed for this feature request. Code inspection confirmed the remaining gaps described by the issue.

The invariant is that parallel resolution performs local verification and delta review while only the existing CI gate waits for remote checks; approval still requires a full review and passing required checks on the same SHA. Temporary test files must remain outside the reviewed repository and disappear when a native dispatch ends. The fix updates the runtime, resolver and delegated review contracts, matching orchestrator policies, validation, and their owning documentation.

Related search was widened across resolve/CI and TMPDIR/delta issues and merged work: #177, #228, #230, #145, #231, and #237. #177 and #230 are already delivered. CI-failure classification and selective verification remain in their separate work items.

Work units

Unit Behaviour Files Tests Verification Rollback
WU-1 Parallel resolution uses a trusted reviewed-head delta and reads checks once, with unchanged strict behavior scripts/run_cycle.py, scripts/validate-package.py, resolver/code-review/orchestrator skills, review documentation, policy/validator tests Policy modes, trusted receipt selection and scope, malformed/missing/non-ancestor fallback, real Git rewritten history, delegated scope, shared policy drift 41 focused policy tests and 67 package-validation tests passed; package validator passed Independent: revert c5bff838a549b7a4771060307cbca16fed051baa
WU-2 Native read-only reviews have bounded writable scratch space with dispatch-lifetime cleanup scripts/executors.py, executor/failure/sandbox tests, workspace/routing documentation Actual temporary-file subprocesses, success/non-zero exit, timeout/cancellation, unchanged checkout, nested checkout, scoped permissions and publication preservation 203 focused executor/failure/sandbox-profile tests passed; explicit subprocess boundary checks passed Independent: revert 481dfbe4244b76b6db4c87e280c5b656feaccfa2

Verification

Agent-reported; conclusion verified, boundary verification required.

Level Command Exit Executed
static python3 scripts/validate-package.py 0 n/a
test python3 -m unittest discover -s tests -v 0 1,403 tests
boundary env PYTHONPATH=tests python3 -m unittest test_executors.ReadOnlyVerificationTests.test_native_reviews_can_create_temporary_files_without_changing_checkout test_executors.ReadOnlyVerificationTests.test_native_review_scratch_is_removed_on_timeout_and_cancellation test_ci_policy.ResolveDeltaTests.test_delta_boundary_uses_real_git_ancestry_and_rejects_rewritten_history 0 3 tests

The boundary run exercises native subprocess temporary-file creation, non-zero exit, cleanup, timeout/cancellation, and real Git ancestry/fallback. The full suite completed in 430.315 seconds. The accumulated diff was checked for scope and unintended artifacts; git diff --check main...HEAD passed.

Local verification uses Linux and Python 3.10.12. Git fixtures set their own identity; process-boundary tests use fake agent binaries and real Git, without requiring model credentials. Windows and the live agent services are left to their applicable CI/integration coverage.

CI policy for this stage is parallel. The implementation summary will report one snapshot for the pushed head; pending checks remain pending and the cycle's CI gate owns the wait.

Closes #182

@datacas

datacas commented Oct 15, 2026

Copy link
Copy Markdown
Owner Author

Implementation complete for #182 in task-182.

Parallel resolution now reviews the trusted reviewed-head delta, verifies locally, and reads checks once without waiting. Native read-only Codex and Claude dispatches receive temporary scratch space with cleanup. Strict CI behavior and full rereview remain in place.

Agent-reported verification: package validator passed, all 1,403 unittest tests passed, and all 3 explicit boundary tests passed. Full commands and independent rollback commits are in the PR description.

Routing: profile deep_coder, requested model openai/gpt-6.1-sol, resolved model ?, effort medium.

One CI snapshot for pushed head 481dfbe4244b76b6db4c87e280c5b656feaccfa2, under the parallel policy:

Check State
Skills, manifests, and Bash installer pending
Skills, manifests, and Bash installer pending
PowerShell installer pending
PowerShell installer pending

0 passed, 0 failed, 4 pending. No CI wait or polling was performed; the cycle's CI gate handles these pending checks. This implementation stage does not approve or merge the PR.

@datacas

datacas commented Oct 15, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20261015-001] · reviewer · anthropic/claude-sonnet-5-5→? · high · schema:2

Initial review: PR #240 (work item #182)

Status: REVIEW_PASSED_AWAITING_CI. Head 481dfbe4244b76b6db4c87e280c5b656feaccfa2 was fully reviewed. No open finding blocks approval. This is not an approval: the CI gate waits for the checks (policy parallel).

Scope

Accumulated diff fcdb255…481dfbe (1141 lines, SHA-256 946e9355…a8560, read in full): docs, scripts/executors.py, scripts/run_cycle.py, scripts/validate-package.py, five skills, and tests. Repository conventions applied: AGENTS.md (routing only) and .code-cycle.yml; no security_review.always_when rule is declared, so the default triage list applied.

Findings

[REV-001] · medium · open · - · blocks:no — Codex read-only reviews now need permission-profile support, with no version gate

Path: scripts/executors.py:155-168 (with publication_access, scripts/executors.py:1358)

Before this change a non-publishing Codex read-only stage ran with -s read-only, which any CLI accepts. Now every such stage (review, rereview, issue_review, security) replaces -s with default_permissions and permissions.<profile>.extends=":read-only". docs/role-workspace-policy.md says this "requires a compatible Codex CLI". The only version check, CodexAdapter.publication_access (needs ≥ 0.138.0), runs only when publishes is true (scripts/executors.py:2557). On an older CLI a plain review now fails at dispatch with a CLI config error instead of a clear BLOCKED publication_access-style capability report. The local Codex here is 0.162.1, so this was not reproduced. Consider gating the profile on the same version check and falling back to -s read-only (no scratch) below it.

Security triage

Not triggered by a configured rule or labels (none). Triggered by my own reading: the change alters sandbox permission profiles, filesystem write grants, and the dispatch environment. I audited it inline; the cc-security-review skill was not run as a separate delegate.

  • The scratch directory is created by tempfile.TemporaryDirectory (mode 0700, unique). It is checked to be disjoint from the checkout, and removed on success, failure, timeout and cancellation.
  • The Codex write grant is limited to that one path. It is JSON-quoted into the -c value, and the path comes from mkdtemp, so it carries no injection input. Network and publication profiles are preserved.
  • TMPDIR is set only in the child environment; the parent's is unchanged.
  • Read-only fingerprint verification of the checkout is unchanged.
  • The delta base is read only from trusted_authors receipts, is ancestry-checked, and falls back to the accumulated diff; it never narrows rereview or the SHA-scoped approval gate.

No confirmed vulnerabilities. Residual (unverified): I did not run Claude Code to confirm that its permission prompts allow writes to the out-of-checkout TMPDIR; the Claude path gets no explicit grant.

Verification executed (read-only clone)

  • python3 scripts/validate-package.py → exit 0 (VALID: 15 skills…).
  • PYTHONPATH=tests python3 -m unittest test_executors.ReadOnlyVerificationTests test_ci_policy.ResolveDeltaTests test_codex_git_sandbox test_dispatch_failures → 72 tests, OK. This covers real temporary-file subprocesses, timeout/cancellation cleanup, nested checkout, Codex scratch grant with and without publication, and real-Git ancestry fallback.
  • Not run: the full suite (1,403 tests, reported 430 s by the author) and Windows or live-agent coverage. Those stay unverified by this review.

CI (read once, not waited on)

Head 481dfbe: 4 pending (two runs each of Skills, manifests, and Bash installer and PowerShell installer), 0 passed, 0 failed. Not a finding; the CI gate owns the wait.

Residual risks

REV-001; the Claude scratch grant and Codex profile semantics were not exercised against live agent services.

Verdict

No blocking findings on 481dfbe. Review complete for this head; awaiting CI.

@datacas

datacas commented Oct 15, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20261015-002] · reviewer · anthropic/claude-sonnet-5-5→? · high · schema:2

Initial review (recovered-attempt verification): PR #240 (work item #182)

Status: REVIEW_PASSED_AWAITING_CI. Head 481dfbe4244b76b6db4c87e280c5b656feaccfa2 was fully reviewed. No open finding blocks approval. This is not an approval: the CI gate waits for the checks (policy parallel).

Scope

Accumulated diff fcdb255…481dfbe (1141 lines, SHA-256 946e9355…a8560, confirmed and read in full). I independently re-verified recovered attempt attempt-4079a4ec403e4e95a90a28dc413d2e95 (comment CCR-20261015-001). It claimed no finding resolutions, so there were no claimed IDs to verify. Repository conventions applied: AGENTS.md (routing only) and .code-cycle.yml.

Findings

[REV-001] · medium · open · - · blocks:no — Codex read-only reviews now need permission-profile support, with no version gate

Path: scripts/executors.py:155-168 (with publication_access, scripts/executors.py:1358)

Reconfirmed, ID preserved from CCR-20261015-001. A non-publishing Codex read-only stage used to run with -s read-only. It now drops -s and sets default_permissions plus permissions.<profile>.extends=":read-only". The only version gate (≥ 0.138.0, scripts/executors.py:1360) runs only for publishes=true (scripts/executors.py:2557). A Codex CLI older than 0.138.0 would fail plain review, rereview, issue_review, and security dispatches on a config error instead of a clear capability report. Not reproduced: the local CLI is 0.162.1. Suggested fix: gate the profile on the same version check, or fall back to -s read-only with no scratch below it.

Security triage

No security_review.always_when rule is declared and there are no labels. Triggered by my own reading: the change alters sandbox permission profiles, filesystem write grants, and the dispatch environment. I audited it inline; cc-security-review was not run as a separate delegate. The scratch directory is unique, mode 0700, checked disjoint from the checkout, and removed on success, failure, timeout, and cancellation. The Codex write grant covers only that path, which comes from mkdtemp, so it carries no injection input. TMPDIR is set only in the child environment. The checkout fingerprint check is unchanged. The delta base comes only from trusted_authors receipts, is ancestry-checked, and falls back to the accumulated diff. It never narrows rereview or the approval gate. No confirmed vulnerabilities. Residual (unverified): the Claude path gets no explicit write grant and I did not run it live.

Verification executed (read-only clone)

  • python3 scripts/validate-package.py → exit 0 (VALID: 15 skills…).
  • PYTHONPATH=tests python3 -m unittest test_executors.ReadOnlyVerificationTests test_ci_policy test_codex_git_sandbox test_dispatch_failures test_validate_package → 175 tests, OK.
  • git diff --check fcdb255 HEAD → exit 0.
  • Not run: the full suite (1,403 tests, author-reported) and Windows or live-agent coverage. Those stay unverified.

CI (read once, not waited on)

Head 481dfbe: 1 passed (Skills, manifests, and Bash installer, run 38753417414), 3 pending (Skills, manifests, and Bash installer run 38753387853; PowerShell installer runs 38753387853 and 38753417414), 0 failed. Not a finding; the CI gate owns the wait.

Residual risks

REV-001; the Claude scratch grant and Codex profile semantics were not exercised against live agent services.

Verdict

No blocking findings on 481dfbe. Review complete for this head; awaiting CI.

@datacas
datacas merged commit 53da497 into main Oct 15, 2026
4 checks passed
datacas added a commit that referenced this pull request Oct 15, 2026
…rant

The native review scratch space from #240 appended its own
permissions.code_cycle_publish_read.filesystem override after the Docker
socket grant, so the later override replaced the earlier one and a
publishing review lost either grant. Merge both paths into one table and
make the scratch-only test independent of the runner's Docker socket.
datacas added a commit that referenced this pull request Oct 15, 2026
…ocker (#239)

* fix(runtime): grant Codex access to host Docker socket

* fix(codex): make Docker socket access configurable

* test(codex): verify Docker socket opt-out at process boundary

* docs(config): document code_cycle.docker.host_socket_access

Add the Docker socket opt-out to the configuration example and the
.code-cycle.yml reference table, which run_cycle.py treats as the list of
accepted keys.

* fix(codex): keep review scratch and Docker socket in one filesystem grant

The native review scratch space from #240 appended its own
permissions.code_cycle_publish_read.filesystem override after the Docker
socket grant, so the later override replaced the earlier one and a
publishing review lost either grant. Merge both paths into one table and
make the scratch-only test independent of the runner's Docker socket.

* test(run-cycle): keep AllowedCommandsConfigTests in one class

DockerConfigTests was inserted inside AllowedCommandsConfigTests, moving
four of its tests into the new class. Place it after them instead.

* test(codex): match the JSON-escaped Docker socket path

The socket path reaches the Codex argv through json.dumps, which doubles
the backslashes of a Windows path, so a raw substring check failed on the
Windows runner. Compare against the serialized form.

* feat(runtime): ask before granting sensitive sandbox access

Fixes REV-003. The Docker socket grant this branch added does not work:
Codex's Linux helper refuses to start when a filesystem rule names the
socket file, and no filesystem rule can enable connect() anyway, because
the sandbox blocks new AF_UNIX sockets unless all of them are allowed
through its network proxy. Verified with Codex CLI 0.162.1 and
`codex sandbox`.

Replace it with a general consent mechanism (scripts/grants.py). A stage
that reports a sandbox restriction on a registered resource, starting with
the host Docker daemon (docker_host), is never widened on its own word:

- the question states what the grant really opens on this executor and
  platform, which for Linux Codex is every local Unix socket, not only
  Docker's, and the risks;
- the answers are this cycle (in memory only, offered only where the
  grant stays isolated to the dispatch), persistent (stored per user
  outside the checkout, keyed by repository and scope fingerprint), or
  deny (this run only; the stage reruns without the grant and reports
  what it could not verify);
- a configured fallback that recovers without a wider sandbox is tried
  first; a terminal is asked once; an unattended run stops with
  permission_required and is answered with --grant;
- the grant applies only to Codex on Linux, keeps the publication domain
  allowlist and read-only reviews, and gives a writer no internet.

code_cycle.docker.host_socket_access now defaults to false and, when
true, authorizes docker_host in advance. Telemetry schema 20.

* fix(runtime): ask for a grant after a fallback hits the same sandbox wall

When a stage's fallback reports the same restriction as its primary, the
consent question now goes back to the primary, which reruns with the
answer after the fallback's effects are reconciled. Answers given in
advance (--grant, stored, host_socket_access) now apply on this path, and
an unattended run stops with permission_required instead of retry_exhausted
(REV-004).

The consent question and the granted context now say the grant reaches
every later Codex stage, including reviews of untrusted pull requests
(REV-005).
@datacas
datacas deleted the task-182 branch October 16, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(F1): staged verification in resolve, full CI gate in rereview

1 participant