Repository navigation
feat(scenarios): run-scenarios --model / --author-model / --ask-model, with the served model recorded per turn - #31204
Conversation
…, with the served model recorded per turn The live driver passes `claude --model` per kind of turn; every turn records the model it asked for beside the one its stream says it was served, and the scorecard names the served model and marks a mismatch. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mMXSZe9L7NVZxrmUk
📓 Docs Drift Check29 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. What this run could not see
Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 451fafd3cfbea7b24d09038707c1a78bc942f5c9 && git checkout 451fafd3cfbea7b24d09038707c1a78bc942f5c9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 065bba721e4ba180c6bdbbf2c5fb787d49bac596 45ceeaff2988f4ac3884ff7815bda9308a7d5175 && git checkout -B drift-repro 065bba721e4ba180c6bdbbf2c5fb787d49bac596 && git merge --no-ff 45ceeaff2988f4ac3884ff7815bda9308a7d5175
node scripts/docs-audit/affected-docs.mjs --json 065bba721e4ba180c6bdbbf2c5fb787d49bac596 |
…-daow8a # Conflicts: # packages/qa/scenarios/README.md
|
domain:devx#3 · os-project-manager · session_01FEkQ5njkh3xbcDN6EtSfw7 席位核对Verdict: ACCEPT · head
Generated by Claude Code |
Requested by Leehom · project thread
Fixes #31160
Clause-②: no
Metadata-protocol: none
维护者速读
run-scenarios新增--model(每一轮都用)、--author-model(建造/迭代轮)、--ask-model(人设问答与操作轮),原样作为claude --model传给本地 Claude Code。每一轮在运行记录里同时写明「要的模型」和「实际服务的模型」(读自流的 init 行),计分卡的作者行写出实际模型,新增Run · model行按实际模型统计人设轮次,不一致处标⚠。@objectstack/scenarios,不发布任何东西;不传新参数时命令行与之前逐字节相同。回滚即还原本 PR。packages/qa/scenarios/src/runner/driver.ts(按轮次类型传--model、servedAsRequested判不一致)、src/runner/scorecard.ts(Run · model行与作者行)、src/runner/cli.ts(三个参数、回放拒收)。pnpm --filter @objectstack/scenarios exec vitest run --maxWorkers=2 test/runner/units.test.ts test/runner/orchestrate.test.ts -t model,预期全部通过(含参数到达 CLI 参数表、记录带实际模型、不一致被标出)。What changes
run-scenarios(runner/cli.ts):--model Mfor every live turn,--author-model Mfor the authoring turns (build and iterate) and--ask-model Mfor the question and operation turns, each of the last two in place of--model. A value is an alias (sonnet) or a name (claude-sonnet-4-5), passed through asclaude --modeltakes it; an empty value or one that starts with-(a forgotten value swallowing the next flag) is refused. With none, no turn passes--modeland the login's default serves, as today.runner/driver.ts):ClaudeCodeDriveralready tookmodel; it now also takesauthorModel/askModeland passes the one for the kind of turn.DriverInfostatesauthorModel/askModel, so the record'senv.driverand the run's first console line say what was asked for.RecordedDriverrefuses the three model flags as it refuses the live-driver limits (makeDriver): a replay re-reads each turn as it was recorded.meta.process.requestedModel(the--modelit was given;runner/transcript.ts), next to the stream's ownmeta.modelit already parsed. The turn summary in the record (TurnSummary,runner/orchestrate.ts) carriesmodel(served),requestedModelandmodelMismatch: truewhen the served name is not the requested one. A recording keeps both on every turn, so a replay re-reads them as the run saw them.servedAsRequested,runner/driver.ts): the CLI takes an alias and the stream names the model it resolved to, so a turn is served as asked when the served name holds the requested one as a whole run of its dash-separated parts (sonnetandclaude-sonnet-4-5inclaude-sonnet-4-5-20250929; neveropus, never a fragment likeson); a context-size suffix ([1m]) is dropped. Any other answer, including an alias that names no model family (default,opusplan), is shown as a mismatch beside both names, for the reader to judge.runner/scorecard.ts): the author rows end with the served model (success · 17/80 turns · 3m 02s · claude-opus-5-5,⚠ asked for sonneton a mismatch,model not reported (asked for sonnet)when the stream named none); new rowsRun · modelandIterate · Run · modelcount the half's question and operation turns per served model (claude-sonnet-4-5-20250929 ×12, claude-opus-5-5 ×2 ⚠ 2 not sonnet);—when no turn named a model and none was asked for.HalfScores.models(ModelTally) carries the same in the record'sscorecard.Why
The card's three asks, verbatim: "
--model ALIASfor every turn, plus optional--author-model/--ask-modelto set the build and persona turns apart. Thread them to the driver."; "The run record and the scorecard state the model actually served per turn. The stream'smeta.modelis already parsed; show any mismatch with the requested model."; "Tests: the flag reaches the CLI argument list; the record carries the served model." Every recorded turn of the 2026-11-06/07 runs used the login's default model and nothing let a run pin or compare one.Tests
test/runner/units.test.ts, the stand-inclaudeblock, 2 new cases). The stand-in now serves a model the way the real CLI's init line names it (--model X→claude-X-4-5-20250929;retiredfalls back toclaude-opus-5-5). Pins:parseArgs(['--model', 'sonnet'])→makeDriver→ both an authoring and an ask turn's argv carry--model sonnet, each turn'smeta.process.requestedModelissonnetandmeta.modelis the servedclaude-sonnet-4-5-20250929;--author-model opus --ask-model haikubeside--model sonnetsplits them;--author-modelalone leaves the ask turn with no--modeland nothing requested; no flag passes no--model; a fallback keeps both names. Negative pins: a missing, empty, blank or flag-shaped value is refused per flag; a replay refuses--model, and names--author-model, --ask-modeltogether.units.test.ts, new describe, a 12-row table): alias, name, dated name, case,[1m]suffix, other family, wrong version, a fragment of a part,default, empty.test/runner/orchestrate.test.ts, new describe, 2 cases): the real crm card throughrunCard, its driver wrapped in aRecordingDriverand a stamp that asks foropuson authoring turns andsonneton persona turns, with one question's turns servedclaude-opus-5-5. Pins: every turn summary carriesmodelandrequestedModel, exactly that question's turns carrymodelMismatch;first.modelscounts the served models; the rendered table's author row namesclaude-opus-4-1-20250805and bothRun · modelrows show⚠ N not sonnet; the written record (JSONround trip) holdsenv.driver.authorModel/askModel, the mismatched turn and the tally; the saved recording replayed throughRecordedDriver.fromFile(the--driver recorded:Fpath) answers that turn with both names. A run whose turns name no model and ask for none keeps| Run · model | — |and the author rows unchanged.Ablations (each restored: blob == HEAD, git diff HEAD empty)
All four run through
scripts/ablation-replace.mjs(anchor x1 → x0, replacement x0 → x1) on head4798cbf1; the suites importsrc/directly, so no dist leg.&& !servedAsRequested(…)inorchestrate.tssummarizereplaced by an always-falseString("ABL1").length < 0):orchestrate.test.ts -t served→1 failed | 2 passed(the served-model record case).LIVE_FLAGS.filter→LIVE_FLAGS.slice(0, 3 + …).filterincli.ts):units.test.ts -t model→1 failed | 6 passed(the refusal case).raw.trim() === '' || raw.startsWith('-')→raw === String("ABL3")):units.test.ts -t model→1 failed | 6 passed(the refusal case).--modelthreading disarmed (if (model) a.push→if (model && String("ABL4").length < 0) a.pushindriver.tsbase):units.test.ts -t model→1 failed | 6 passed(the argument-list case).Acceptance notes
model not reported, and is never counted as a mismatch: nothing was served to compare.claudeanswers an unknown model itself, and that turn is recorded as it failed. A list here would go stale with every model release.requestedModel; their turns show the served model and no mismatch.--packages, samecli.ts/scorecard.ts): it was still open when this PR opened, soorigin/mainwas merged once before it; the seat's order has this branch mergeorigin/mainagain after feat(scenarios): run-scenarios --packages published|workspace; the gallery exporter refuses workspace records #31188 lands. Scenario runner: an external driver contract (--driver external:<cmd>) and a Codex driver, so the same card can measure other agent tools; check WorkBuddy #31159 (--driver external) follows on the same files; this change stays local to the flags, the driver options and the record.@objectstack/scenariosisprivate: trueand nothing else moved:skip-changeset.Verification
Current head
45ceeaff(secondorigin/mainmerge, at065bba72, carrying #31188; plain merge, no rebase). The only conflict was the README command block, and all three new lines were kept. Inside the merge, the neworchestrate.test.tsrunRecordcall passespackages: PUBLISHEDbecause #31188 madeRunRecordMeta.packagesrequired. On this head: 25 files / 516 tests pass, typecheck and scoped eslint exit 0, anddispatch-gates --ranshows 49 derived, 49 run, 0 NOT MEASURED (check:dual-build-cjs-loadsnow measured). Ablations were not rerun because the merge touched none of the ablated lines. The rounds below are on the earlier head.All on head
0b43e745(the final commit: the work at4798cbf1plus one merge oforigin/mainat8acbfab9), in worktreeobjectstack-issue-31160, base620b6e6d.origin/mainhas since moved (#31185 among others, which touchespackages/qa/scenariosprompts and tests);git merge-treeagainst it is clean.pnpm --filter "@objectstack/scenarios..." buildon the merged head:pnpm --filter @objectstack/scenarios test→Test Files 23 passed (23),Tests 460 passed (460);pnpm --filter @objectstack/scenarios typecheck(tsc --noEmit, test files included:--listFilesliststest/runner/units.test.ts) exit 0;VERDICT command-exit 0.eslint packages/qa/scenarios --no-inline-configexit 0.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack→ 49 commands, all run on this head; 48exit 0;pnpm check:dual-build-cjs-loadsexit 3, PREREQUISITE NOT MET (it reads every package'sdist/, and only the scenarios closure was built here) — NOT MEASURED, left to CI.--ranreconciliation:49 derived famil(ies) accounted for — 48 run, 1 NOT-MEASURED.@objectstack/scenarios("private": true):skip-changeset.!in the title, no(narrowing)arm).claude, and the replay path throughRecordedDriver.fromFileon a recording the test writes.The 49 derived gates, as run
Human Minimum
packages/specholds no runtime logic. (Not touched.)pnpm lintpasses (scoped to the package).main, one pull request.skip-changeset.)packages/spectouched: its generated artifacts are regenerated and committed. (Not touched.)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.