Repository navigation
Conversation
Add an opt-in `parallel` CI policy (`code_cycle.ci.policy`, `--ci-policy`; `strict` stays the default and the original flow). Under `parallel` the implementation and the reviews are told not to wait for checks, a review requesting changes goes to resolution at once, and a clean review may report REVIEW_PASSED_AWAITING_CI, which is never an approval. scripts/ci_gate.py is the one deterministic wait on a change request's checks, with a command line both orchestrators can run. Required checks come from classic protection and active rulesets, or every reported check when none is declared, deduplicated to their latest run by name and app. Only `success` passes; failed, skipped, neutral, missing, unreadable or moved-head results never do, and every read confirms the SHA is still the PR head. run_cycle.py validates a clean review (full reviewed_head_sha equal to head_sha, empty blocking_findings, readable findings) and its trusted schema-2 receipt, waits once, and approves only on CI_PASSED with the receipt still the latest publication. A CI failure opens one resolution told the SHA and count, a moved head gets one fresh rereview, and a timeout stops as BLOCKED keeping the clean review, which `--from rereview` reuses without another review. Before a resolution after CHANGES_REQUESTED, one read of the reviewed head passes an already failed check to it. Telemetry schema 19 records reviewed_head_sha and checks_head_sha on verdicts, a `ci` row per gate read or wait, and the cycle's ci_policy, CI wait time, polls, final CI status, redundant reviews and review reuse; first pass and final approval under `parallel` count a clean review only with a CI pass of its SHA. The status file shows the gate apart from any stage. Refs #228
cc-implement-issue reads its pushed head's checks once and returns under `parallel` instead of waiting. cc-initial-review and cc-rereview define REVIEW_PASSED_AWAITING_CI: a complete clean review whose checks have not all passed, never an approval, reported with reviewed_head_sha equal to head_sha and an empty blocking_findings list, and never turning a check's state into a finding. cc-resolve-comments diagnoses failed checks the cycle names by SHA and count beside the findings; its own wait for the head it pushes is unchanged (#182 owns that). Both orchestrators share one byte-identical `## CI policy` section with the same transitions as run_cycle.py: the ci_policy input, the one `ci_gate.py` call per clean review, the action for every gate result, the single read before a resolution, and resume reuse of a clean receipt. The validator keeps the section identical, requires every gate status the runtime can return after a wait, and checks the review skills define the awaiting status and the implementation does not wait. Configuration, review lifecycle, workflows, telemetry and instrumentation pages document the policy with CLI and YAML examples, the awaiting state, the gate's results, resume, schema 19, and how to compare the policies. Refs #228
Implementation summary —
|
| Check | Run | State |
|---|---|---|
| Skills, manifests, and Bash installer | 38445615857 | pass |
| Skills, manifests, and Bash installer | 38445933716 | pass |
| PowerShell installer | 38445615857 | pass |
| PowerShell installer | 38445933716 | pass |
gh pr checks 230 exited 0 with every check passed: 4 passed, 0 failed, 0 pending on that SHA. The new gate read the same head as it will under parallel: python3 scripts/ci_gate.py --repo datacas/code-cycle-toolkit --pr 230 --sha dec9262c06952785a649fc57f8314f5cc9885e88 --timeout 60 returned CI_PASSED (exit 0), with the 2 ruleset-declared checks passed after it deduplicated the 4 runs to their latest per name and app.
This stage ran under the default strict policy: it waited for these checks before reporting. The change request has not been reviewed yet.
[CCR-20261014-001] · reviewer · anthropic/claude-sonnet-5-5→? · high · schema:2Initial review —
|
| Command | Result |
|---|---|
python3 scripts/validate-package.py |
exit 0, VALID: 15 skills … shared sections in sync |
python3 -m unittest discover -s tests |
exit 0, 1375 tests OK (404 s) |
python3 scripts/ci_gate.py --repo datacas/code-cycle-toolkit --pr 230 --sha dec9262c… --once (read-only, live) |
exit 0, CI_PASSED, required_source: declared, 2 passed (Skills, manifests, and Bash installer, PowerShell installer) |
Probe of parallel + local_only (throwaway test outside the repo) |
stops HUMAN_INTERVENTION / local_only before any review, so no approval-telemetry gap; not a finding |
Unverified
- A full
--ci-policy parallelcycle dispatching real Codex/Claude stages against a live PR (the author states this too); covered by the fake-CI tests intests/test_ci_policy.py, which passed here. - Orchestrator prose is enforced by the validator, not executed by an agent.
- Windows, beyond the PowerShell installer check.
CI
gh pr checks 230: 4 passed, 0 failed, 0 pending, 0 skipped. Both ruleset-required checks (Skills, manifests, and Bash installer, PowerShell installer) are among them and passed on this head. PR is not a draft.
Residual risks
- Without declared required checks, every reported check is required, so an always-skipped optional job yields
CI_SKIPPEDand a human stop; this is documented behaviour, not a defect. - Checks that GitHub creates after the gate's last read (for example a chained workflow) are only reported as
late, not waited for.
Verdict
APPROVED for head dec9262c06952785a649fc57f8314f5cc9885e88. Merge stays manual. The structured result of this run is returned to the runtime in its response.
Closes #228
Work item: #228 — feat(runtime): overlap review with CI and gate approval by SHA
Summary
An opt-in
parallelCI policy lets the review start while the code host's checks run, and moves the CI wait to one deterministic, runtime-owned gate after a clean review.strictstays the default and the original serial flow: identical prompts, and the runtime never reads checks.code_cycle.ci.policy: strict|parallelandci.timeout(default 900 s);run_cycle.py --ci-policy / --ci-timeout; orchestratorci_policy=. The command-line value wins. GitHub only: anothercode_hostis refused and keepsstrict.parallelreportsREVIEW_PASSED_AWAITING_CI, never an approval, withreviewed_head_sha == head_sha, an emptyblocking_findingslist, readable findings, and its schema-2 receipt. The runtime validates the result and the trusted receipt (the record of the state) before it waits; it never writes to GitHub.scripts/ci_gate.pyreads required checks from classic protection and active rulesets (every reported check when none is declared), dedupes repeated runs by name and app to their latest, passes only onsuccess, and confirms the PR head on every read. Results:CI_PASSED,CI_FAILED,CI_SKIPPED,CI_TIMEOUT,NO_CI_CHECKS_FOUND,CI_UNREADABLE,CI_HEAD_MOVED(plusCI_PENDINGfor a single read).run_cycle.pyimports it; both orchestrators run its command line instead of polling.CHANGES_REQUESTED→ resolution at once (one non-waiting read hands an already failed check to it); clean +CI_PASSEDwith the receipt still the latest publication →READY_FOR_MANUAL_MERGE;CI_FAILED→ one resolution told the SHA and count, never check names (an unchanged head then stops asno_progress);CI_HEAD_MOVED→ one fresh rereview, a second move stops (head_moved); skipped/neutral or no checks →HUMAN_INTERVENTION(ci_not_passing); timeout/unreadable →BLOCKED(ci_timeoutkeeps the clean review).--from rereview --pr N --ci-policy parallelreuses the latest trusted clean receipt of the current head and only runs the gate; a moved head, a later receipt, a malformed receipt or a blocking finding reviews the head; unreadable state stops asBLOCKED.--from reviewalways reviews.reviewed_head_sha/checks_head_shaon verdicts, acirow per gate read or wait with its SHA, and cycle-levelci_policy,ci_wait_ms,ci_polls,final_ci_status,redundant_reviews,review_reused. Underparallel,first_pass_approved/final_approvedneed a CI pass of the reviewed SHA;cc-statsand the measured first-pass rate follow. The status file shows the gate apart from any stage.cc-implement-issuedoes not wait underparallel; both reviews define the awaiting status;cc-resolve-commentsdiagnoses named CI failures beside the findings; both orchestrators share one byte-identical## CI policysection that the validator enforces (every gate status, the one call, resume). Configuration, review lifecycle, workflows, telemetry and instrumentation pages, and the changelog.Settled decisions IR-001/IR-002/IR-003/IU-001 and the second review's IR-001/IR-002 are applied as written. The single helper lives in its own module,
scripts/ci_gate.py, so the orchestrators can run the same coderun_cycle.pyimports; it is the only waiter, not a second scheduler.Coordination: #182 — the resolution keeps its own wait for the head it pushes under both policies, and
parallelis not stated tocc-resolve-comments; #182 can turn that on against these semantics. #145 — failures are routed by SHA and count; classification and the flaky retry stay there. #164 — the SHA-tiedcirows and the status file'scikey are reusable by the monitor. #189 — the new surface is a separate module plus small closures.Diagnosis
gh pr checks --watch, about 15 min) before returning, so the review cannot start; a clean review with pending checks has no completed non-approval state (COMPLETES["review"] == {APPROVED, CHANGES_REQUESTED}); the runtime never gates CI itself and trusts the reviewer'sAPPROVED;_checks()keeps counts without their SHA; a--fromresume has no awaiting state.run_cycle.COMPLETES,drive(),_checks(),cc-implement-issuestep 11 and the review skills' status lists. Live evidence of the approval gap: on open PR refactor(F2): extract WorkItemIdentity and grouping-identity rule for metrics (fixes #185) #204 the required check Skills, manifests, and Bash installer isskippingwhilegh pr checks 204exits 0; the new gate reportsCI_SKIPPEDfor it.strictunchanged; no second scheduler; the resolution's wait left to refactor(F1): staged verification in resolve, full CI gate in rereview #182.Work units
WU-1parallelpolicy, CI gate, receipt validation, resume reuse, schema-19 telemetry, statusscripts/ci_gate.py,scripts/run_cycle.py,scripts/cycle.py,scripts/telemetry.py,scripts/cycle_status.py,scripts/review_contract.py,scripts/stats.py,scripts/runtime.manifesttests/test_ci_gate.py,tests/test_ci_policy.py(the two key cases on a controlled fake CI, races, missing/skipped/unreadable checks, SHA changes, resume, polling ownership, and a simulated strict-vs-parallel benchmark),tests/test_cycle_outcomes.py,tests/test_telemetry.py,tests/test_stats.pydependent: revert withWU-2, whose validator and skills use its vocabulary andci_gate.py; schema-19 rows already written stay readable by older codeWU-2## CI policy, validator rule, docs, changelogskills/cc-*/SKILL.md(6),scripts/validate-package.py,docs/*.md(6),CHANGELOG.mdtests/test_validate_package.py(drift, lost gate status, missing section, review status, implementation wait)python3 scripts/validate-package.pyexit 0; full suite 1375 exit 0independentVerification (agent-reported)
These results are agent-reported, not runtime-observed.
python3 scripts/validate-package.pypython3 -m unittest tests.test_ci_gate tests.test_ci_policy tests.test_cycle_outcomes tests.test_telemetry tests.test_stats tests.test_validate_packagepython3 -m unittest discover -s testspython3 scripts/ci_gate.py --repo datacas/code-cycle-toolkit --pr 204 --sha 20947f45839e0c150c56aac4c17f4ad2cc411c8d --once | grep -q '"status": "CI_SKIPPED"'python3 scripts/ci_gate.py --repo datacas/code-cycle-toolkit --pr 227 --sha 734b8dc0579ddadc1f374ab7b9e0826ec917e1df --once | grep -q '"status": "CI_UNREADABLE"'(merged PR)python3 scripts/ci_gate.py --repo datacas/no-such-repository-228 --pr 1 --sha aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --once | grep -q 'gh api exited 1'python3 scripts/ci_gate.py --repo bad --pr 1 --sha abc 2>&1 | grep -q 'must be owner/name'python3 scripts/run_cycle.py --task 228 --repo owner/name --config /tmp/cc228-boundary/bitbucket.yml --database /tmp/cc228-boundary/t.sqlite --workspace current --cwd /tmp/cc228-boundary --ci-policy parallel 2>&1 | grep -q 'parallel CI policy reads GitHub checks'python3 scripts/run_cycle.py --task 228 --repo owner/name --config /tmp/cc228-boundary/typo.yml --database /tmp/cc228-boundary/t.sqlite --workspace current --cwd /tmp/cc228-boundary 2>&1 | grep -q 'unknown key under code_cycle.ci: polcy'test ! -e /tmp/cc228-boundary/t.sqlite(the refusals happen before any dispatch or telemetry write)Conclusion:
verified_with_reservations; boundaryrequired(CLI entry points, theghprovider boundary, runtime configuration loading).Not verified: a complete
--ci-policy parallelcycle dispatching real Codex/Claude stages against a live PR and its CI (excessive cost: paid dispatches and a disposable PR); it is covered with a controlled fake CI and fake stages intests/test_ci_policy.py. Windows is covered by CI only. The orchestrator prose is checked by the validator, not executed by an agent here.Environment shared with CI: Python 3 (local 3.10.12) with PyYAML; a Git checkout on a named branch (the runtime tests already need one: an export without
.gitfails pre-existing tests too). Not shared: the boundary runs used this machine's authenticatedghagainst live GitHub; the unit tests make no network calls (fake provider, injectedghrunner).The checks of the pushed head follow in a comment once they finish.