Repository navigation
refactor(arms): run arms from a typed ArmsRunConfig instead of the parsed Namespace - #270
Open
vlad-perevezentsev wants to merge 5 commits into
Open
vlad-perevezentsev wants to merge 5 commits into
vlad-perevezentsev wants to merge 5 commits into
Conversation
resolve_doc_library_id, validate_expected_skills, probe_sampling and validate_supported_matrix_harnesses read no parsed arguments, and judge_reliability imported the probe from another command. Move them, unchanged, into a new evaluation-layer module under public names; the commands and the tests import them from there. validate_expected_skills collects the offered skill names in a helper of its own, so the moved function stays under the complexity cap and its growth baseline entry goes. Refs intel#4 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
_build_arms_output read the run configuration off the parsed Namespace, most fields with a getattr default, and matrix-run copied the Namespace per cell and mutated the copy. Add ArmsRunConfig to dokimi/eval/arms_run.py: frozen, the field names are the flags' dest names, and each default is what arms run runs with when the flag is left out. run_arms is the body of _build_arms_output, split under the complexity cap, and cell_config puts a matrix cell into a config with dataclasses.replace. run_config_from_args is the one place parsed flags become a config. A doc arm with no library id raises LibraryIdError instead of exiting inside the run; both commands print the same message and exit 1. The regex test over getattr(args, ...) goes with the getattr defaults. subjects run still hands matrix-run a Namespace; the next commit changes that. No flag changes; stdout, exit codes and arms.v1 are unchanged. Refs intel#4 Refs intel#229 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
subjects run built a Namespace by hand from FORWARDED_RUN_CONFIG_FIELDS and called cmd_arms_matrix_run with it. Split the matrix run out of that handler into run_matrix(config, ...), which takes the config and the input and output paths, and have subjects run call it with run_config_from_args(args, product=..., baseline_arm=...). A field subjects run has no flag for takes the config's default, as before. FORWARDED_RUN_CONFIG_FIELDS and forwarded_run_config have no caller left and are removed. Refs intel#4 Refs intel#229 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
The loop over the cells still lived in the command. Move it into the run module: check_matrix checks every cell's harness and sampling, and run_matrix calls it before the first cell is paid for, then runs the cells in turn and hands each finished cell and its arms.v1 output to a callback, so a later cell's failure keeps the earlier ones. A failing cell raises MatrixCellError naming it; a bad question record and LibraryIdError pass through. The command keeps the files: it checks the matrix before it makes the output dir, makes the dirs before the first paid call, saves each cell from the callback, and writes the plugin deltas and the rollup. The messages and exit codes are unchanged; the cell-name collision check now runs before the harness check, ahead of the paid sampling probe. Refs intel#4 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
vlad-perevezentsev
requested review from
antonwolfy,
jharlow-intel,
napetrov,
vchamarthi and
xaleryb
as code owners
October 28, 2026 16:12
run_matrix re-raises EmptyQuestionError past the MatrixCellError wrapper, so a blank question is bad input (exit 2), not a failed cell (exit 1). Nothing pinned it: dropping it from the tuple left the suite green. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
Contributor
|
Ran: the full suite, lint and types on the head; the head merged into current main; old-vs-new CLI runs of arms run, matrix-run and subjects run.
|
antonwolfy
reviewed
Oct 29, 2026
antonwolfy
left a comment
Contributor
There was a problem hiding this comment.
The refactor holds up, with two open points from @xaleryb that I confirm and that should be fixed before merge. I found nothing new.
I agree with @xaleryb that the head merged into current main fails test_answering_stack_parity.py, and that ArmsRunConfig keeps the Claude judge for a non-default judge_provider. New evidence: ArmsRunConfig(product="p", judge=True, judge_provider="openai").judge_model is claude-sonnet-5-5; the CLI paths are fine only because cli.py resolves the sentinel first.
What I ran, on a Linux review host at 4d7ca1d:
make ci-local: 25 passed, 3 failed, 7 skipped. 9302 tests passed; changed-line coverage 95% (232 lines measured).Fragment for package changesfails because the PR changesdokimi/dokimi/with no changelog fragment and noskip-changeloglabel, as @xaleryb noted; either one turns it green. The other two failures are not the PR's:pip-auditlistsfilelockadvisories in the lock files, which this PR does not touch.test_unbalanced_quote_in_hook_completes_quicklytook 1.04s against a 1s limit, and passes on its own (508 passed intest_repo_environment.py).- Mutation run: 119 single-point mutants of
arms_run.py,commands/arms.pyandcommands/subjects.py(fields dropped on the way toArmRunner,run_config_from_argsfields, defaults,cell_config, exit codes, error routing). The related test files kill all 119.
Checked, no issues
- Parity: every flag the base passed to
ArmRunner,JudgeandJudgePanelstill reaches them; exit codes and messages forLibraryIdError,MatrixCellErrorandEmptyQuestionErrormatch the base. - Description:
ArmsRunConfighas 24 fields named after thearms runflag dests, and the defaults match the flags apart from the judge model above. - Growth baseline: the removed entries and the new line counts match;
test_growth_ratchet.pypasses. - Leftovers: no references to the removed helpers remain in code, tests or docs. All five commits carry
Signed-off-by.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
arms run,arms matrix-runandsubjects runpass an arms run its configuration as anargparse.Namespace.matrix-runcopies the Namespace and mutates it for each cell.subjects runbuilds one by hand fromFORWARDED_RUN_CONFIG_FIELDS._build_arms_outputreads most fields withgetattr(args, ..., default), so when a caller drops a field, the run looks the same as if the user had chosen the default.This PR replaces that hand-off with one frozen dataclass and moves the run out of
commands/. It is the second half of the #4 Wave 5 item, as described in this #4 comment. No flag changes; stdout, exit codes andarms.v1stay the same.dokimi/eval/arms_run.py(new; no existingeval/*file changes):ArmsRunConfig: 24 fields, named after the flags' currentdest. Each default is whatarms runruns with when the flag is left out, so thegetattrdefaults are gone.run_armsis the body of_build_arms_output, split to stay under the complexity cap.cell_configbuilds a matrix cell's config withdataclasses.replace(...).run_matrix(config, cells, specs, questions, on_cell)checks every cell before the first paid call, then runs the cells in turn and hands each finished one toon_cell.probe_samplingis also used byjudge_reliability).commands/arms.pykeeps argument parsing, output paths, saving, printing and exit codes.run_config_from_argsis the one place where flags become a config. The commands'run_matrixwrites the cells, the plugin deltas and the rollup.subjects runbuilds the config directly.FORWARDED_RUN_CONFIG_FIELDS,forwarded_run_config()and the regex test overgetattr(args, ...)are removed.LibraryIdErrorreplaces aSystemExitraised inside_build_arms_output, andMatrixCellErrornames the failing cell. Both commands print the same messages and exit 1, as before.There is one order change in
matrix-run: the check that cell names give distinct file names now runs before the harness check, so both cheap checks come before the paid sampling probe.Commits, each passing the tests on its own: (1) move the shared checks to the new module; (2)
ArmsRunConfig+run_armsforarms runandmatrix-run; (3)subjects runbuilds the config; (4) the matrix loop moves to the module.#229, "the arms
Namespace" (not assessed yet). Three duplicates went away:FORWARDED_RUN_CONFIG_FIELDS, now the dataclass fields;getattrdefaults, now the dataclass defaults, which a test checks against thearms runflags;dataclasses.replace.The remaining duplicates are the flag definitions themselves (#94 F1a/F1b). F1b can now rename fields to the registry's
api_kwargin one place.Depends on #264, overlaps #238
ArmRunner. Its tests are not on this branch, so CI here does not run them until test(arms): pin what arms run, matrix-run and subjects run hand the arms runner #264 merges. Run locally against every commit of this branch, they pass with no edit (11 passed). After test(arms): pin what arms run, matrix-run and subjects run hand the arms runner #264 merges, this branch is rebased and one commit rewrites that file's docstring, which describes the hand-off removed here. Its tests stay unchanged.cmd_arms_matrix_run. Merging it gives 4 mechanical conflict hunks incommands/arms.py; I rebase after it merges.Evidence
New
tests/test_arms_run_config.py(5 tests):arms runflag defaults;Error: ...and exits 1, forarms runandmatrix-run;run_matrixrefuses a bad cell before any provider call.The three CLI tests also pass on
main.9 other test files change only their imports and monkeypatch targets.
Mutation sweep: 19 single edits (fields dropped on the way to the runner, defaults changed, cells not applied, errors misrouted). Each one fails a test.
pytestwith test(arms): pin what arms run, matrix-run and subjects run hand the arms runner #264's file in place: 9260 passed, 57 skipped.make ci-localreports one failure, "Fragment for package changes", which needs theskip-changeloglabel.Growth:
commands/arms.pygoes from 772 to 513 lines. The_build_arms_output(13) and_validate_expected_skills(11) baseline entries are removed.Merge Danger
Door: two-way. This is an internal refactor; the CLI, stdout, exit codes and artifacts do not change.
Blast Radius: the three commands that run arms, guarded by #264's parity tests.
Overlap: #238 (see above). #255 changes
--providerchoices in lines this PR does not touch.Not in this PR:
subjects runandmatrix-runlack today: adding them changes behaviour.plugins/judge_panel: they stay comma-separated strings, because tuples would change how a cell's plugin list is split.Checklist
pytestpassesruff,mypy, and schema checks pass (make ci-local)evaluating-treatments.mddepends_onand the architecture note name the new module. No changelog fragment (internal refactor): needsskip-changelogAGENTS.mdRefs #4
Refs #229