Repository navigation
Wire the recorder into a cycle somebody can run - #12
Conversation
CycleRecorder shipped with no caller outside its tests. The guarantee it enforces -- route, dispatch and record as one operation, with no path that does only part -- therefore applied to nothing, and the telemetry store had zero productive rows however many cycles ran. run_cycle.py is that sequence, written once: probe the executors, label the work before routing anything, then implement -> review -> (resolve -> rereview)* with every stage going through recorder.stage(). It decides nothing. No cost model, no learning, no rule that changes itself from an outcome. It does not infer a verdict either. A review's outcome is read from the structured result the driver explicitly asks the executor to emit, which every review skill documents as opt-in on request, and never from an exit code or from prose. When the block is absent the cycle stops and says the verdict is unknown: a guess would be indistinguishable from data forever after. Orca is named out loud as the case where the dispatch returns a started worker rather than a finished stage, so a cycle routed there stops after the dispatch. The probe map is now taken once and handed to the recorder, which passes it to every dispatch. Without it each dispatch probed again on its own, so an availability could change between two stages with nothing recording that it had -- exactly what the orchestration contract tells a run not to do. The acceptance criterion is from an installed layout, not from scripts/: install into a temporary home, put fake agent binaries on PATH, start the entrypoint as a person would, then open telemetry.sqlite and read the rows. It covers the healthy cycle, a second round after CHANGES_REQUESTED, a review that reports no verdict, and the scenario the fallback exists for -- Codex reporting an exhausted window, the recorder rerouting once, and all three facts surviving in SQLite: the abandoned attempt, the fallback decision, and what the fallback did. One thing found while writing the driver: the request it composes contains the word ORCHESTRATION_RESULT, so an executor that echoes its own prompt puts a decoy earlier in the stream. Reading forwards parsed the prompt and reported no verdict, so the block is now read from the end.
Initial review — PR #12SummaryI reviewed the accumulated diff from [REV-001] · high · open · blocks:yes — An asynchronous Orca dispatch is treated as completed workPath:
I reproduced this with an Orca-shaped successful dispatch followed by a successful Claude-shaped review: the report contained Please stop and record the asynchronous dispatch as a human/external follow-up state when the result carries an Orca [REV-002] · medium · open · blocks:no — Non-object structured output crashes the driverPath:
I reproduced this with Please require Security triageThis is a sensitive change because it launches local agent CLIs, accepts a caller-provided working directory, and processes agent output. The scoped security audit found no confirmed vulnerability: subprocesses are invoked with argument arrays rather than a shell, the working directory is passed explicitly to the child process, and the changed code does not persist credentials or transcript prose in telemetry. The two findings above are correctness/reliability findings, not security findings. Verification
CIAll checks currently reported for head
Unverified items and residual riskNo live Orca worker or real provider was available in this review; the asynchronous path was validated with an adapter-shaped execution harness and the installed fake-agent path was exercised end to end. Until REV-001 is fixed, a configured Orca route can advance the workflow before implementation completion. Until REV-002 is fixed, malformed model output can terminate a run without its closing telemetry row. VerdictCHANGES_REQUESTED — REV-001 blocks approval. REV-002 should also be fixed before relying on the CLI as a durable cycle runner. |
The driver documented that Orca returns a receipt rather than a result, and then advanced on DispatchOutcome.SUCCEEDED like every other executor. A cycle routed to Orca ran its review against work still being written and could reach READY_FOR_MANUAL_MERGE for an implementation that had not finished. The claim was in the docstring and nothing in the code enforced it. The distinction is now carried, not narrated. Adapter.completes_work states what a backend is, OrcaAdapter declares False, and the dispatch wrapper applies it to every result, so an adapter cannot report finished work it only launched by forgetting a keyword. Every stage in the driver stops on it, naming the reference the work continues under, and the cycle still closes itself so the stop leaves its row. The wrapper also stopped rebuilding its result field by field. It now uses dataclasses.replace and sets only the two things this layer knows that the adapter does not; listing the rest again is how a new field gets dropped. Second finding, same commit: a delimited block holding a JSON string or number parsed cleanly, was returned as a result, and raised AttributeError on the first .get -- ending the run before its closing row. read_structured_result now requires an object, and a malformed block takes the existing unknown-verdict path. Both reproduced first: an Orca-shaped run reached READY_FOR_MANUAL_MERGE with roles ['implement', 'review'], and a block containing "APPROVED" raised. After the fix the first stops at implement with the dispatchId in the reason and a coordinate row, and the second stops with no structured verdict.
Resolution summaryBoth findings reproduced against [REV-001] · high · resolved · valid · blocks:yes — An asynchronous Orca dispatch is treated as completed workValid, and the uncomfortable part is that this PR's own docstring already said "Orca is a start, not a finish" while the code advanced on Reproduced: an Orca-shaped successful dispatch followed by a successful review gave Fixed by carrying the distinction rather than describing it:
I chose the adapter declaration over sniffing Also fixed while in there: [REV-002] · medium · resolved · valid · blocks:no — Non-object structured output crashes the driverValid and reproduced:
Regression tests
Verification
Sensitivity triageUnchanged in kind and narrower in effect: the diff adds a stop condition and a type check, executes nothing new, and passes no new data to a subprocess. Agreeing with the review's triage, these are correctness findings; no audit finding. Residual risksNo live Orca worker has still never been started end to end — the asynchronous contract is verified against the real adapter with an injected runner and a real receipt payload, not against a running worker. Collecting an Orca stage's result after the fact remains out of scope: this driver stops and says where the work went, it does not follow it. One thing noticed while triaging and deliberately left alone: Status: RESOLVED — REV-001 and REV-002 closed at |
Re-review — PR #12Scope and change since the previous reviewThe previous review covered The fix commit adds an explicit asynchronous-dispatch signal to Previous findings[REV-001] · high · resolved · valid · blocks:yes — An asynchronous Orca dispatch is treated as completed workStatus: corrected and verified by execution.
Independent reproduction with an Orca-shaped successful dispatch produced only [REV-002] · medium · resolved · valid · blocks:no — Non-object structured output crashes the driverStatus: corrected and verified by execution.
Independent reproduction with Current accumulated reviewNo new findings. The changed executor wrapper preserves the adapter result fields while applying readiness and asynchronous state, and blocked dispatches remain non-asynchronous. The known Security triage and auditThe change remains sensitive because it launches local agent CLIs and handles working-directory and agent-result data. The scoped security audit found no confirmed vulnerability: no new shell execution or credential persistence was introduced, subprocess arguments remain structured, and the new state is control-flow metadata rather than sensitive output. Verification
CIAll current checks for
Unverified items and residual riskNo live Orca worker or real provider was started. The asynchronous contract was verified against the real adapter with an injected receipt runner, and the installed fake-agent cycle remains covered end to end. Following an asynchronous worker after dispatch remains outside this driver's scope; it records the handoff and stops rather than claiming completion. VerdictAPPROVED — both previous findings are resolved and verified, no new blocking finding is open, and all required checks pass at the reviewed head. |
Why
CycleRecordershipped in #10 with no caller outside its own tests. The guarantee it enforces — route, dispatch and record as one operation, with no path through it that does only part — therefore applied to nothing, and telemetry had zero productive rows however many cycles ran.What this adds
scripts/run_cycle.py: probe the executors once, label the work before routing anything, thenimplement → review → (resolve → rereview)*with every stage going throughrecorder.stage().python3 ~/.code-cycle/runtime/run_cycle.py \ --repo owner/name --task API-7 --difficulty 2 --verifiability autoIt decides nothing: no cost model, no learning, no rule that changes itself from an outcome. Those stay where they are until there is something measured to move them with.
It does not infer a verdict. A review's outcome is read from the structured result the driver explicitly asks the executor to emit — opt-in on request in every review skill, so a documented capability rather than a hopeful one — and never from an exit code or from prose. When the block is absent the cycle stops and records that the verdict is unknown. A guess would be indistinguishable from data forever after, and the point of this instrument is to be believed later.
Orca is named as the exception. Its dispatch returns a started worker and a
dispatchId, not a finished stage, so a cycle routed there stops after the dispatch rather than treating absent output as failure.One fix to the recorder
CycleRecordernow takes the probe map and passes it to every dispatch. Without itdispatch()probed all executors again on each call, so an availability could change between two stages with nothing recording that it had — which is exactly whatcc-orchestratortells a run not to do, and it was the runtime doing it.The acceptance criterion is an installed layout, not
scripts/tests/test_installed_cycle.pyinstalls the toolkit into a temporary home, puts fake agent binaries onPATH, starts the entrypoint the way a person would, and then openstelemetry.sqliteto read what the run left behind. No provider, no network, no credential: the agents are a script that prints what a real one prints, including the resolved model the way each real CLI reports it.It covers four scenarios:
implement → review → APPROVED, five rows, endingREADY_FOR_MANUAL_MERGE;CHANGES_REQUESTED— nine rows,iterationgoing0,0,0,0,1,1,1,1,1, with the findings counts the reviewer reported;1, final statusHUMAN_INTERVENTION;missing_capability=operating_quota, the fallback decision withused_fallback=1, and what Claude then did.Found while writing it
The request the driver composes contains the words
ORCHESTRATION_RESULT, so an executor that echoes its own prompt puts a decoy earlier in the stream. Reading forwards parsed the prompt and reported no verdict; the block is now read from the end. The fake agent echoes its prompt precisely so this stays covered.Verification
python3 -m unittest discover -s tests—Ran 330 tests ... OK(was 322).python3 scripts/validate-package.py—VALID.implement cheap_coder codex succeeded,review reviewer claude succeeded,READY_FOR_MANUAL_MERGE, five rows in SQLite with requested and resolved models matching.What is still not done
Nothing reads the recorded rows back automatically;
first_pass_rate()reaches the cost model only when someone passes it. The sequence from here is: one canary cycle against a real provider, then normal use untilMINIMUM_SAMPLE = 10, then compare the observed rate against the conservative0.0— and only then consider wiring it in.