Loading
Replay the deps flow's upstream stage in bin/eval
What does this MR do and why?
Part of #40: task B3a, the bin/eval side of the upstream review. It is stacked on !97 (merged) and targets jecsanders-42-make-eval. The stage itself (B1 and B2) is built in a separate MR off main. Both work to the same contract, so either can land first.
- One answer file per agent.
EvalFlow.with_answerswrote every agent's answer toanswer.txt, and the file tool won't overwrite, so the judge's answer would have been lost. The suite's classifier keepsanswer.txt, and every other agent writesanswer.<agent>.txt. Result rows record the judge's answer asjudge.- On
deps-gitlab, whoseflows/flow.ymlhas three classifiers, a case the gate sends toclassify_impactorclassify_spec_risknow counts as "No answer". Before, that classifier's tier was scored as a deps tier.
- On
- Replaying the fetch. The sandbox can't reach upstream, but
run_commandsteps passEvalFlow.local?.bin/eval snapshottakesfetch_upstream's compiled command fromflows/deps.ymland runs it with Ruby, outside the sandbox. It runs in a scratch directory holding the case's savedmr.json,mr_diff.jsonand atier.txtoflow. It saves<case>.upstream.out,.upstream.jsonand.upstream_route.txtbeside the case. The runner isUpstream.fetchinevals/lib/upstream.rb, so specs can reach it.- It never overwrites a saved file, and it skips a case with only some of the three saved.
- It saves nothing from a fetch that timed out, wrote no JSON or route, or could not reach upstream, so the next snapshot tries again. The fetch runs in a process group of its own, so a timeout or an interrupt stops everything
shstarted. - In a run,
EvalFlowswapsfetch_upstreamfor a stand-in that runsmv tier.txt tier_model.txt. It then copies the savedupstream.jsonand route when the model's tier islow, or writes routeskipwhen it isn't. review_upstream'supstreaminput becomes the saved stdout as a literal, the same way reads are given.- A flow without
fetch_upstreamis unchanged. A flow that keeps it but has no saved output raisesEvalFlow::Unsaved, andbin/evalaborts withrun bin/eval snapshot.--show-flowuses a placeholder instead, so it needs no fetch.
- Report.
- A new Upstream stage section has per-group totals: judged, check, incomplete, skipped, judge unreadable, as expected, and lowered by the stage.
- Its per-case table shows what the stage did, the judge's tiers, the tiers labelled, and whether those are more or less cautious than the first variant's. The judge's answer is read as
keep_higher_tierreads it: one JSON object whose tier islow,mediumorhigh. Less cautious is in bold.xmarks a run itsupstreamdoesn't expect, and lowered by the stage marks a run labelled below the model's tier. - Right after the summary, a new Less cautious than
mainsection lists every case a later variant labels less cautiously, so none can be missed.
- Suites.
deps-pilots.ymldocuments an optionalupstream:key:keep,raise,checkorincomplete. No case has a value yet, because none can be snapshotted until the stage exists.- Approving a case whose
upstreamisn'tkeepcounts as a wrong approval. Such a case doesn't count as low work in "lowcases approved". deps-upstream.ymlscaffolds the six planted cases from #40's evaluation plan. Each is one of the six low Go module bumps indeps-pilots, with its merge request files copied unchanged.planted:says what to edit in the saved upstream output. None is planted yet.
What the stage MR must provide that the contract doesn't say
fetch_upstreamreads onlymr.json,mr_diff.jsonandtier.txtfrom its working directory. The snapshot's scratch directory has nothing else, so a read ofgate.jsonorroute.txtwould find nothing.- It needs only Ruby,
gitand the two hosts. It can't rely on a runner environment variable, a token, or a file outside its directory. The snapshot stops it, and everything it started, after 300 seconds, so its own network timeouts must be shorter. - Its stdout is exactly the judge's input, and it writes nothing to stderr on a clean run. A run gives the judge the saved stdout. If
tool_responsesofrun_commandcarries more than stdout, the judge would see more in production than in the eval. P3 should check what reaches the next step. - It reads the tier as
decide_labelsdoes: the whole file stripped, then its first line, stripped and lower-cased. The contract only says the first line "is notlow", and the stand-in reads it thedecide_labelsway. If the fetch reads it any other way, an answer likeLow, or one starting with a blank line, takes a different route in production than in the eval. checksum: "unchecked"withcomplete: true. The route isskip, so the judge doesn't run, and nokeep_higher_tierrow raises it unless "clean" excludesunchecked. Either the fetch never writes that pair, orkeep_higher_tierraises it tomedium. The scorecard reports it ascheck (checksum unchecked).- The red-flag
rulevalues. Thered-flagcase plantsos/exec, the contract's example. The stage MR should list the rules it flags, so the case can use a real one. - A fetch that can't reach upstream writes a reason starting
fetch failed. The contract gives that only as an example. The snapshot relies on it to tell a failure worth retrying from an incomplete answer that belongs to the case, such asnot a single Go module bump.
Once the stage lands, bin/eval run on a deps suite aborts until bin/eval snapshot has saved each case's upstream output. spec/eval already passes saved output to every eval_flow call on the real flows, and the deps chain spec pins only the classifier, its answer and write_tier_file, so the stage landing won't break spec/eval.
Not done here
- No upstream output is saved yet, because no branch has the stage (B3b). The
deps-upstreamcases have their merge requests but no.upstream.*files. - No model call was made.
bin/eval runwithout--show-flowandbin/eval snapshotboth call the Duo CLI.
How to check
make checkpasses.ruby bin/eval run deps-pilots --show-flowprints exactly what !97 (merged) prints on the current flow, and so doesdocs. Ondeps-gitlabthe only difference is the file the two other classifiers save their answers to.- A synthetic two-agent flow with a
fetch_upstreamstep (spec/eval/fixtures/upstream_flow.rb) covers the answer files, the stand-in and the judge's literal input. It also covers the refusal without saved output, the snapshot runner, and the no-op on a flow without the fetch. The stand-in's specs run its command in a scratch directory, and the timeout spec fails if the fetch outlives itssh.
Edited by Connor Sanders