Repository navigation
feat(subjects): subjects run writes a run directory with its plan and result - #1494
Conversation
`subjects run` now runs in a run directory of its own (intel#94 R2, R-4): `--out-dir DIR`, else `<runs root>/<run_id>`, opened with runs/rundir.py. The run writes its plan.v1 (one cell per product x matrix cell x awareness arm, and per work harness x task x rep), gives each cell a result.v1 status as it finishes, and saves the scorecard as subject_scorecard.v2.json; run.json lists the plan, the result, the scorecard, each product's rollup, the cells' arms.v1 files, the plugin deltas and the work's task_runs. A stop (Ctrl-C, SIGTERM) leaves run.json incomplete and a result.v1 with the cells left not_run. `--out FILE` and `--out-md FILE` still get the scorecard and report. RunDir.add_artifact lists an artifact a cell saved in a subdirectory. The subject id no longer names the output directory, so its '.'/'..' refusal goes. Test-narrowed: the default results/subjects/<subject id> directory and the subject id '..' refusal are gone; test_subjects_run_directory.py tests the run directory that replaces them. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
A stop inside a product's matrix (Ctrl-C, a run-wide failure in a later matrix cell) left the cells saved before it not_run in result.v1 and unlisted in run.json, though they were answered and paid for. The cells are now recorded and listed from the files the matrix saved, in a finally around it; a cell stopped on a run-wide failure is infra_error. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
`--work-output-dir out/../w` under `--out-dir out` passed the textual is_relative_to check, and add_artifact refused the '..' with a ValueError after every cell had run: the run ended failed with no scorecard. The paths are now compared resolved, and the artifact is listed by its path below the run directory. A test runs suite.tasks end to end and checks the work cells' verdict and the listing. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
The plugin_delta listing of a subjects run had no test: dropping it passed the suite. An end-to-end run with a no-plugin and a plugin matrix cell now checks that run.json lists each product's plugin delta. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…the plan `--work-harnesses codex,codex` planned the same cell twice, so the plan.v1 was invalid and the run ended incomplete with exit 0; two suite.tasks with one name did the same. A harness named twice now runs once, and two tasks with one name are refused before the run (exit 2). The check of --work-harnesses reads the flag through the same helper as the plan and the runner. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
An unwritable --out ended a run whose every cell was measured as failed (stop: SystemExit 2), since the copy was saved inside the run's block. The scorecard in the run directory is still saved there; the --out / --out-md copies are written once the run is recorded by its cells, and a refused one still exits 2. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
The hash of the suite.tasks suite in plan.v1 hashed only the refs: a task is a directory, so _digest_values took its text. Editing a task's instruction or verifier left the hash unchanged, while plan.v1 says it is the digest of the suite's content. It now hashes each task's name and its directory's tree. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
The errored answer in the infra_error test had no text, so it failed the text check anyway and the error check went untested. It now has partial text with its error. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
|
OpenCodeReview: Commit f40cfb3 was not reviewed. This PR has reached its review limit (6 reviews). CI at `f40cfb3`: 9 still running, 11 passing, 3 skipped
To review this commit: re-request review from exai-bot in the Reviewers list. Last review (0a492bb): no findingsOpen threads from the bot: 0 |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1494 +/- ##
==========================================
+ Coverage 96.32% 96.36% +0.04%
==========================================
Files 521 523 +2
Lines 69806 70226 +420
Branches 12076 12137 +61
==========================================
+ Hits 67239 67674 +435
+ Misses 1588 1579 -9
+ Partials 979 973 -6
🚀 New features to boost your workflow:
|
Mutation of changed linesAt f40cfb3: 76 caught · 4 missed Each row is a small deliberate break (a mutant) of a line this PR changes that every test reaching that line still passes. Add a test that fails on it or, if it cannot change behaviour, put
Not checked:
Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary. |
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
A --out or --out-md file in this run's directory or in one holding a run.json was written after the run ended and replaced its run.json, plan.v1.json or result.v1.json. Such a file is now refused (exit 2) before any cell runs; the path is resolved, so a '..' or a symlink into a run directory is caught too. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
The plan's subjects[].fingerprint was the digest of subject.ref only, so a bundle with members and no ref had none, and editing a member left plan_digest unchanged. A bundle's fingerprint now also hashes each member's kind, ref and content digest, as the scorecard records them. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
The work cells got their verdicts only after TaskSuiteRunner.run() returned, so a Ctrl-C or SIGTERM during the work left the cells that had finished, and been paid for, not_run in result.v1.json. TaskSuiteRunner now hands each results[] row to an on_row callback once its cell ends, and subjects run records the cell from it; record_work takes one row. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
A --work-output-dir in (or under) a directory holding a run.json wrote the work's task-runs.json over the one that run lists. It is now refused (exit 2) before any cell runs, after resolving '..' and symlinks, as --out is. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
A --work-output-dir outside every run directory still let its task-runs.json or task-runs.md be a symlink into an earlier run; save_artifact follows the final symlink and would replace that run's run.json or result. The check now resolves both files as well as the directory, before any cell runs. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Resolving the work directory and its task-runs files left the cell directories: <work-output-dir>/<task>/<harness>/run<N> symlinked into an earlier run still wrote (and the docker harness rmtree'd) there. The check now resolves every path reachable under --work-output-dir, each directory once so a symlink loop ends, before any cell runs. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
30798fb walked everything under --work-output-dir and followed its directory symlinks, so a reused work dir whose old cell workspace links out (copytree keeps symlinks) to a tree holding a run, or holds an unreadable directory, was refused, and a link to /usr walked /usr. The check now resolves only the task-runs files and each planned cell's <task>/<harness>/run<N> directories; runner.cell_output_dir gives the layout both use. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head b091d6f)
- Contract: changed. errors dokimi/dokimi/commands/subjects.py:180; errors dokimi/dokimi/commands/subjects.py:181
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
The previous aggregate-file finding is fixed, and the interrupted-run test retains completed work. All 103 tests in the changed test files passed locally. One data-integrity issue remains in the new destination check.
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
A reused --work-output-dir keeps an earlier cell's directory, and a harness opens its files there (run.log, prompt.txt, ...) without checking for links, so one linked into another run's directory was overwritten. The preflight now also resolves every symlink in an existing cell directory, outside the agent's work/ workspace, and refuses one that leads into a directory holding a run.json. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
A product's directory sits next to run.json, plan.v1.json, result.v1.json, matrix.cells.json, the scorecard and work/ in the run directory. A product named result.v1.json made a directory there, so the run could not write its result and run.json stayed running; the others failed later or mixed the product's cells with the run's files. Such a product is now refused with exit 2 before the run starts. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head b321b82)
- Contract: changed. errors dokimi/dokimi/commands/subjects.py:181; errors dokimi/dokimi/commands/subjects.py:182
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
The new preflight covers harness files inside an ordinary existing cell directory. Reading the new early return alongside the Docker harness shows one remaining gap. The reserved-path collision discussions are also still open.
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
A --work-output-dir such as out/result.v1.json passed the preflight, which runs before open_run and so saw no run.json there; the work then made a directory where the run saves its result, and the run stayed running with no result. A work path inside this run's directory whose first part is one of the run's own names (run.json, plan.v1.json, result.v1.json, the scorecard, matrix.cells.json) is now refused with exit 2 before the run directory is opened. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
On a case-insensitive filesystem (Windows, macOS) a product named RESULT.v1.json made the directory where the run saves result.v1.json, and the run stayed running with no result. The product and --work-output-dir checks now compare the run's own names case-folded, on every platform, so a subject refused on one is refused on all. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
The --work-output-dir preflight skipped the inside of a cell directory that is a symlink, though a harness writes run.log, prompt.txt and the rest where the symlink leads; a file there linked into an earlier run was overwritten. The cell is now walked through the symlink, so such a file is refused with exit 2 before any cell runs. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head 0a492bb)
- Contract: changed. errors dokimi/dokimi/commands/subjects.py:181; errors dokimi/dokimi/commands/subjects.py:182
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
The reserved run names are now compared case-insensitively and an existing symlinked cell is visited. I reviewed the remaining preflight path and the harness writers statically, and 108 subject/CLI tests passed locally. One filesystem error can still leave a destination unchecked.
| if not cell.is_dir(): | ||
| return [] | ||
| links = [] | ||
| for root, dirs, files in os.walk(cell): # does not follow a symlinked directory: lists it in dirs |
There was a problem hiding this comment.
question: os.walk(cell) ignores listing errors by default. If this cell can be searched and written but cannot be listed, the preflight treats it as having no links, while the harness can still open its known output files there. Can the walk raise its listing error through onerror and have the CLI refuse the unchecked cell before opening the run? This follows from the code paths; the earlier symlinked-cell fix works when the target can be listed.
vchamarthi
left a comment
There was a problem hiding this comment.
@vlad-perevezentsev, could you fix the problem I found and the small thing I've marked fix before merge (in the line comments) and fix what napetrov's thread on dokimi/dokimi/commands/subjects.py:327 still points out? Then push and I'll take another look.
Optional, non-blocking (1)
dokimi/dokimi/commands/subjects.py:552:_safe_namekeeps the case, and the collision check compares names exactly, so productsDocsanddocspass it (main has it too).
What I checked on 0a492bb:
- When I changed the code on purpose, the tests still passed for 1 of 12 changes, and no test pins this one down yet (non-blocking):
dokimi/dokimi/subjects/run_plan.py:24(the condition is negated). - The 117 changed tests pass, and fail on main as expected.
- The full test suite passes with main merged in (35,668 tests), apart from failures main has too.
- It merges cleanly onto main.
| from dokimi.artifacts import run_id | ||
| from dokimi.runs.scan import runs_root | ||
|
|
||
| return Path(args.out_dir) if args.out_dir else runs_root().path / run_id() |
There was a problem hiding this comment.
Must fix (blocking): --out-dir "" opens the run in the current directory, but the copy check looks at the default directory and lets --out run.json through.
Input: subjects run s.toml --out-dir "" --out run.json in an empty directory.
Got: open_run takes "" as the current directory, since it tests out_dir is not None, but _run_home tests truthiness and returns results/<run_id>.
Also at: dokimi/dokimi/commands/subjects.py:153, dokimi/dokimi/commands/subjects.py:256, dokimi/dokimi/commands/subjects.py:290.
I tested this suggestion: it fixes the problem, and the tests still pass.
| return Path(args.out_dir) if args.out_dir else runs_root().path / run_id() | |
| return Path(args.out_dir) if args.out_dir is not None else runs_root().path / run_id() |
Details
So _refuse_copies_into_a_run checks the wrong place and does not refuse run.json, and after the run _save_scorecard writes the scorecard over the run.json that run made. I tried the calls in that order in an empty directory: the copy check returned without error, and open_run opened the current directory. The work check has the same gap: --work-output-dir result.v1.json passes there, and the work then makes a directory where the run saves its result. I expected the copy to be refused, as --out results/<run_id>/run.json is, or "" to be refused or to mean the default, with both checks agreeing. A non-empty current directory is refused by open_run, so the empty one is the case that gets through.
| except (OSError, RuntimeError) as exc: | ||
| raise InputError(f"cannot resolve --work-output-dir {work_dir}: {exc}") from exc | ||
| own = _run_own_names() - {"work"} # <run directory>/work is the work's default place | ||
| taken = sorted({part for real in reals if real != home and real.is_relative_to(home) |
There was a problem hiding this comment.
Fix before merge (blocking): A --work-output-dir equal to --out-dir passes the check only because of real != home, and no test covers that case.
Suggestion: Add a case to tests/test_subjects_run_directory.py where --work-output-dir and --out-dir are the same directory, and expect no error.
I tested this patch: it fixes the problem, and the tests still pass.
Patch
--- a/dokimi/tests/test_subjects_run_directory.py
+++ b/dokimi/tests/test_subjects_run_directory.py
@@ -602,3 +602,12 @@
run.add_artifact("arms", run.path / path if not path.startswith("/") else path)
with pytest.raises(ValueError, match="writes its result itself"):
run.add_artifact("result", run.path / "x.json")
+
+
+def test_a_work_directory_equal_to_the_out_directory_is_accepted(tmp_path, monkeypatch):
+ import argparse
+
+ from dokimi.commands.subjects import _refuse_work_in_another_run
+
+ monkeypatch.chdir(tmp_path)
+ _refuse_work_in_another_run(argparse.Namespace(out_dir="out", work_output_dir="out"), [])Details
Input: --out-dir out --work-output-dir out. The work check accepts this on 0a492bb: I called _refuse_work_in_another_run with both set to out, and it returned. If I remove real != home at this line, the same call fails with an IndexError from parts[0], and all 163 tests in the changed test files still pass. I'd add one assert to tests/test_subjects_run_directory.py: that call with both set to one directory returns without error.
… empty open_run takes --out-dir "" as the current directory, but the copy check looked at the default run directory, so --out run.json replaced the run's run.json with the scorecard. The check now uses the same directory. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
…ds a hard link The check for paths into an earlier run dropped os.walk listing errors and saw only symlinks, so an unlistable cell or a hard link to an earlier run's run.json let a harness write over it. Both now exit 2 before any cell runs. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
…used Only a cell's top-level work/ is the agent's workspace; a nested work/ holds harness files and must stay in the check. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
The skipped work result has no task_runs; reading it as a run crashed the run with KeyError and left run.json failed, with no test noticing. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
The grader is part of plan_digest, so a judged run recorded as unjudged would share the digest of an unjudged run. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
… runs The work directory may be the run directory itself; the own-name check skips it, and the run lists task-runs.json. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
|
xaleryb
left a comment
There was a problem hiding this comment.
Approved on f40cfb3. subjects run writes a run directory with its plan and result under the run-directory contract of #1150; our commits refuse --out over the run's own file and a reused work cell that cannot be listed or holds a hard link (both open threads), and add four tests. Full suite and gates are green on the head merged with main. Windows smoke had not started (the hosted Windows queue was stuck); every other check passed.
Main now has subjects run writing a run directory (intel#1494): the line that no command writes one was no longer true. The fragment also says that a run's report takes the run's answers. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…e a run (#1523) * feat(runs): --eval and --answers take a run as well as a file report eval --eval and eval score pointwise --answers now also take a run: its directory (one with a run.json), or the run_id or name of a run directory under the runs root. dokimi/runs/resolve.py reads the run's run.json through runs/scan and returns the one artifact of the kind the command reads. A file at the given path still wins, so every path reads as before. A run that has not ended complete, lists no artifact of the kind or more than one, a run.json that does not meet run.v1, or a run_id or name no run (or two runs) has exits 2 and says so; the error names the file, whose path still reads a stopped run's artifact. baseline:NAME is not handled here: it comes once runs.baseline gets its resolver. Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * docs(runs): say that no command writes a run directory a RUN can name yet The fragment and docs/runs.md showed --eval RUN as if a run's run_id from runs list worked: no command writes a run directory yet, so a RUN finds only directories the run-directory module made, and an envelope run_id is not a RUN. Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * fix(runs): refuse a run.json that is not a regular file instead of blocking on it resolve() opened ref/run.json once it existed, so a FIFO there hung the command. It now checks the stat as runs.scan does and exits 2. Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * fix(runs): say a runs root that cannot be listed cannot be searched for a run With results/ unlistable, resolve() said no run had the name, though nothing was looked up. It now says the root cannot be listed, as runs show RUN_ID does. Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * test(runs): pin a run that a plain directory of its name does not hide --eval eval reads the run named eval under the root rather than the eval/ directory eval score writes to; say so in docs/runs.md and the docstring, and test it. Test run.v1 on a run found by its run_id too. Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * refactor(runs): move the no-run error out of _find_run The unlistable-root case took _find_run to complexity 11, over the growth cap; the error it raises is now built by _no_run. Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * test(runs): build the run.v1 refusal's expected path from the path The pattern held results/r-1/run.json, which the message spells with backslashes on Windows. Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * fix(runs): look a run up by its run.json only, not by a copy of it A run directory holding a backup of its record (previous-run.json) made a lookup by name report two runs, the same directory twice: the scan selects every run.v1 document. Only a file named run.json is a run's record now. Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * fix(report): a run's report takes the run's answers for its Q&A sidecar report eval --eval RUN read the run's eval, but the sidecar looked for answers in answers/ next to eval/, which a run directory does not have: every answer in r.qa.json was null although the run lists its answers. resolve_with gives the run's answers with its eval, and report eval passes them to both report pages. Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * test(runs): pin the end of a running run's refusal when it lists no file Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * test(runs): pin that an empty value in a run directory is not that run Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * test(runs): pin that a value that cannot be looked at goes to the reader Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * docs(runs): say that subjects run writes a run directory, with no eval Main now has subjects run writing a run directory (#1494): the line that no command writes one was no longer true. The fragment also says that a run's report takes the run's answers. Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * fix(report): a run's answers that cannot be picked do not refuse its report 3aff61a looked the run's answers up with the same checks as its eval, so a run listing two answers (one per cell) or answers whose file is gone made report eval --eval RUN exit 2 with advice --eval cannot follow. The answers are taken only when the run lists exactly one file; otherwise the sidecar goes without them, as for a run that lists none. Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * fix(report): a run without answers to take does not read answers/ beside its eval f1538d1 gave the report of a run that lists no answers, two or gone ones a sidecar without answers, but resolve_with returned None for them, as for a file, so both report pages still read the answers/ next to the run's eval/: answers the run did not list went into .qa.json. resolve_with now returns "" for such a run, and the sidecar takes no answers for it. Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * test(runs): name the beside tests after the "" they assert 6dd595c made resolve_with give "" for a run whose beside artifact cannot be taken, and None only for a file, but two tests kept "none" in their names. They say "empty" now. Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * test(runs): judge a run's answers with the current --judge flag Main moved eval score pointwise to --judge PROVIDER/MODEL; the old --judge-provider/--judge-model pair now exits 2 with 'moved:', so the test stopped before the judge after the merge of main. Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * test(report): patch answers_by_id in eval_io, where the sidecar reads it The merge of main moved the sidecar's answer lookup into report/eval_io.py (answers_for_sidecar), so eval_report no longer imports answers_by_id and the test's monkeypatch found no attribute. Refs #94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> --------- Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> Co-authored-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Summary
Step R-4 of #94 R2:
subjects runis the first command that writes a run directory throughruns/rundir.py(#1150), as R-0 (#94 comment) lays out.--out-dir DIR, else<runs root>/<run_id>(results/, orDOKIMI_RUNS_DIR), in place ofresults/subjects/<subject id>/, which every run of a subject overwrote. A directory that holds anything is refused (exit 2) before any cell runs.plan.v1.jsonbefore the first call: one cell per product x matrix cell x awareness arm (arm<matrix cell>/<arm>, task the product), and one per work harness x task x rep (armwork/<harness>). Each matrix cell is recorded inresult.v1.jsonas soon as itsarms.v1file is saved, so a stop in a later cell keeps it.run.jsonincompletewith its reason andresult.v1.jsonwith the cells leftnot_run.run.jsonlists the plan, the result,subject_scorecard.v2.json, each product's rollup, the cells'arms.v1files (a stopped cell's partial file too), the plugin deltas and the work'stask_runs(when it is inside the directory).RunDir.add_artifactis new for that:artifact_pathgives one top-level file per kind, and the cells' files sit in subdirectories.--out FILE/--out-md FILEstill get the scorecard and its report, written after the run has ended, so a refused copy exits 2 without changing how the run is recorded.inconclusive, one that answered none, or whose matrix cell stopped on a run-wide failure,infra_error. A work cell ispass/failby its verifier,infra_errorwithout a verdict,not_rununder--work-dry-run.--work-harnessesruns once; twosuite.taskswith one name are refused (exit 2)../..refusal is gone.The plan module is
dokimi/subjects/run_plan.py; incommands/subjects.pyonly the run function and its helpers change, not the parser (#1420, #1197). Layout and rules:docs/run-directories.md, new sectionsubjects run.Refs #94 R2
Changed output
results/subjects/<subject id>/toresults/<run_id>/, and the scorecard in it fromsubject-scorecard.jsontosubject_scorecard.v2.json.--out-dirthat exists and is not empty, or a file, is refused (exit 2:run directory ... already exists); before, the run wrote into it. An--out-dirunder a file sayscannot make run directory ...in place ofcannot write ....--work-harnesses, which is checked only after the awareness matrix, as before) leaves that directoryfailed: the same--out-diris refused next time.Evidence
subjects run s.tomlin a row (fake model) both writeresults/subjects/s/subject-scorecard.json; there is norun.json, plan or result.DOKIMI_RUN_ID) giveresults/run-a/andresults/run-b/, eachrun.jsoncomplete; a third withrun-aexits 2 and leavesrun-aunchanged.tests/test_subjects_run_directory.py, 18 tests: one directory per run; every planned cell measured (complete); Ctrl-C at a product boundary and between two matrix cells of one product (incomplete,interrupted, the saved cells kept, the restnot_run);runs listshows one run,runs show RUN_IDits artifacts,runs rm RUN_IDremoves them;--outcopy equal to the run's scorecard; an unwritable--outexits 2 with the runcomplete; a non-empty--out-dirrefused before any model call;suite.tasksend to end with a passing harness (default,out/../out/wand an outside--work-output-dir); a plugin cell's delta listed; a repeated harness, two tasks with one name; thesuite.taskshash following the tasks' content; the statuses fromarms.v1andtask_runs.v1rows;add_artifactrefusing a path outside the directory...check inadd_artifact; textual in place of resolvedtask_runspath; norecord_workcall; no--outcopy; no artifact listing; no plugin-delta listing; no harness de-duplication; no repeated-task check; the copies back inside the run's block;and not a.errordropped.test_subjects.pyandtest_subjects_run_input.pyfollow the new path, file name and messages;test_cli_refusal_parity.pyremovesoutbetween its two calls, since a run directory is not reused.slot ci --quick(lint, mypy, the whole suite): 0 failed, 32003 passed, 131 skipped. The fullmake ci-local --offlineruns on the last commit before publishing.rundir.py's own tests cover it), Windows.Not in this PR
commands/arms.py: the run endsincompleteby its cells, withstopnull rather thanrun_stopped. That isarms' path (R-3).--work-harnessesis refused only after the awareness matrix has run and been paid for (as on main); now its results stay in afailedrun directory.runs rm RUN_IDremoves the run's artifacts, not its.mdreports ormatrix.cells.json, so the directory is not empty afterwards and cannot be reused (R3 core).subjects runhas no--max-usd, so the spend-cap stop does not apply to it yet.--nameforsubjects run(the parser is under docs(cli): help text for every option; test the deferred list #1420/Part of #94 (F1b, model + judge) #1197).Open questions
inconclusive(measured, no verdict). Shouldsubjects rungive itpass, or should a verdict come only from a latergate(L4)?DOKIMI_RUN_IDset for several steps of a CI job, a secondsubjects runwithout--out-diris refused, as the R-0 open question says; should it get<root>/<run_id>/<leaf>/instead?Checklist
pytestpasses:tests/test_subjects_run_directory.py(new, 18 tests);slot ci --quick0 failedruff,mypy, and schema checks pass:ci-local --jobs static,typecheck0 faileddocs/run-directories.md(sectionsubjects run,RunDir.add_artifact)AGENTS.md: mutations above, bad inputs (non-empty--out-dir, a file asDOKIMI_RUNS_DIR, a missing descriptor),list_new_error_paths.py,check_growth.py(test_subjects.pybaseline lowered 1046 -> 1002)raise/exit and test names the doc, contract or issue it traces to: the repeated-task refusal andadd_artifact'sValueErrorcite plan.v1 / run.v1; each test citesdocs/run-directories.mdrun_plan.py, the test file, the fragment