Repository navigation
Description
Epic: field-2026-09-28 (downstream non-Node adoption) Tier: mechanical Graph: tracker #1203
Problem. PhaseLogSchema (run-log-schema.ts:234-275) has no model field, though the phase result carries resolvedModel and usage[] (phase-executor.ts:1684-1696). The run-log entry (batch-executor.ts:1833-1856) drops them. RunLogSchema has no tool-version field, only the log schema's version: 1. Only metrics.json has models, and its top-level model is a guess: process.env.ANTHROPIC_MODEL ?? "opus" (run-orchestrator.ts:1960). You cannot tell from a run log which model or which sequant produced a verdict.
AC
- AC-1: Each phase entry in the run log records
model(resolved) andrequestedModelwhen the driver reports them. Evidence:npx vitest run src/lib/workflow/run-log-schema.test.ts - AC-2: The run log records
sequantVersionand thedrivername at the top level. Evidence:npx vitest run src/lib/workflow/run-log-schema.test.ts - AC-3: The metrics' top-level
modelcomes from resolved phase models, notANTHROPIC_MODEL ?? "opus". Evidence:npx vitest run src/lib/workflow/run-orchestrator.test.ts
The changes are additive and optional, so no schema-version bump is needed. Related: #914, #975, #971, #986.
Graph metadata
- No dependency edges; frontier from wave 1.
May touch
src/lib/workflow/run-log-schema.tssrc/lib/workflow/batch-executor.tssrc/lib/workflow/run-orchestrator.ts
File overlap (don't run in the same wave; merge one first):
- fix(run): spec runs in the main checkout, which the skills pre-flight never checks — a stale checkout silently degrades spec (#933 regression) #1193:
src/lib/workflow/run-orchestrator.ts - fix(qa): parseQaSummary returns null when AC statuses are bold words with no emoji — the SEQUANT_QA_GAPS findings marker is then never read #1194:
src/lib/workflow/batch-executor.ts - fix(adopt): missing-skills remedies contradict each other, and the README plugin path omits the skills that runs need #1201:
src/lib/workflow/run-orchestrator.ts
Activity
admarble commentedon Sep 29, 2026
Context before wave 3 (main @ 1b0fa9a). #1193, #1194 and #1201 have merged since this issue was written. Two of them touched this issue's files: #1194 changed
run-log-schema.tsandbatch-executor.ts(PhaseLog now carries the qasummary), and #1201 changedrun-orchestrator.ts. Current line refs:PhaseLogSchema:run-log-schema.ts:240(was :234)resolvedModelis built atphase-executor.ts:1807and set at:1818(was :1684-1696)batch-executor.ts:1863(createPhaseLogFromTiming, main loop). Other call sites are at:1256(spec) and:2041(quality loop). All three should carry the model.process.env.ANTHROPIC_MODEL ?? "opus":run-orchestrator.ts:2045(was :1960)Run rules for the phase agents (spec, exec and qa):
npm test. Run the targetednpx vitest run <files>named in the ACs, in the foreground with atimeout. Every MCP-dispatched phase has a hard 30-minute wall, and in wave 2 an exec ran up to 27 minutes. This applies to the qa phase too, not only exec.failedTestmust start with the test file path (src/…test.ts > <describe> > <case>). If it starts with a describe name, §6i floors the verdict to AC_NOT_MET.Closes #<this issue>for this issue andRefs #1203for the tracker. NeverCloses #1203..sequant/settings.jsonmust handle JSONC (comments and trailing commas), not bareJSON.parse/jq.admarble commentedon Sep 29, 2026
Complexity: Standard (3 ACs, 1 directory)
AC Quality Check
All three AC have an explicit
Evidence:clause naming a scopednpx vitest run <file>command. Checked againstmain(1b0fa9a):run-log-schema.test.ts(76 tests) andrun-orchestrator.test.ts(7 tests) both pass today with zero assertions onmodel/requestedModel/sequantVersion/driveror on the metricsmodelderivation — none of the three checks are vacuous.No vague/unmeasurable/incomplete language. No title/body tension.
Scope Assessment
Non-Goals:⚠️ Not present in the issue body. The issue's own text is scoping enough (three additive fields, one guess replaced) that I don't think a split is warranted, but flagging per the checklist.
src/lib/workflow/)Verdict: ✅ SCOPE_OK
Acceptance Criteria
AC-1: Each phase entry in the run log records
model(resolved) andrequestedModelwhen the driver reports themVerification: Unit Test
Scenario: Given a phase execution whose driver populated
modelUsage(soPhaseResult.resolvedModelis set) and/or whose config declared arole:policy for that phase → WhencreatePhaseLogFromTimingbuilds thePhaseLogandLogWriter.logPhasepersists it → Then the persisted entry carriesmodelequal to the resolved model andrequestedModelequal to the pre-resolution value; both fields are absent (notnull/empty string) when the driver reported nomodelUsageand no role was configured.Assumptions: Field naming and the source of
requestedModelare open — see Design Review Q2 and Open Questions 1–2.AC-2: The run log records
sequantVersionand thedrivername at the top levelVerification: Unit Test
Scenario: Given a run with
config.agentresolved (default"claude-code") → WhenLogWriter.initializecallscreateEmptyRunLog→ Then the top-level (sibling toversion/runId, not nested inconfig) log object carriessequantVersion(fromgetVersion()in./version.js) anddriver(the resolved agent/driver name), for every driver — not justclaude-code.Assumptions:
RunConfigSchemacurrently has noagentfield;driverneeds a new home at the top level per the AC's literal wording, not insideconfig.AC-3: The metrics' top-level
modelcomes from resolved phase models, notANTHROPIC_MODEL ?? "opus"Verification: Unit Test
Scenario: Given a run whose phases resolved concrete models via
modelUsage(already computed byenrichPhasePoliciesFromResults) → WhenRunOrchestratorcallsmetricsWriter.recordRun→ Thenmetrics.json's top-levelmodelis derived from a resolved phase model, not the rawprocess.env.ANTHROPIC_MODEL ?? "opus"guess; the guess remains only as a last-resort fallback for drivers that report nomodelUsageat all.Assumptions: Exact selection rule among multiple resolved phase models is open — see Open Questions 3.
Implementation Plan
Phase 1: Per-phase
model/requestedModelin the run logmodel: z.string().optional()andrequestedModel: z.string().optional()toPhaseLogSchema(src/lib/workflow/run-log-schema.ts:240-283).createPhaseLogFromTiming's optionsPick<PhaseLog, …>(src/lib/workflow/log-writer.ts:444-460) to includemodel/requestedModel.batch-executor.ts(:1256spec,:1863main loop,:2041quality loop), passmodel: result.resolvedModelandrequestedModelfrom the source decided in Open Question 2.Phase 2:
sequantVersion/driverat the run-log top levelsequantVersion: z.string().optional()anddriver: z.string().optional()toRunLogSchema(run-log-schema.ts:382-406), top-level — sibling toversion/runId.createEmptyRunLog(run-log-schema.ts:439), setsequantVersioninternally viagetVersion()(./version.js) on every call (no caller plumbing needed), and acceptdriverin the existingoptionsparam, mirroring howstartCommitis threaded today.driver?: stringtoLogWriterOptions(log-writer.ts) and thread it into thecreateEmptyRunLogcall insideinitialize().new LogWriter({...})call site (run-orchestrator.ts:779), passdriver: config.agent.Phase 3: Fix the metrics.json guess
run-orchestrator.tsaround:2045, capture the result ofenrichPhasePoliciesFromResults(config.phasePolicies, results)in a local variable (it is currently inlined directly into thephasePolicies:field of therecordRuncall) and derivemodelfrom it per Open Question 3, falling back toprocess.env.ANTHROPIC_MODEL ?? "opus"only when no phase resolved a model at all.No schema-version bump — all four new fields are optional/additive, matching the pattern already used for
resolvedModel/usage/requestedModel(#975, #986).Design Review
run-log-schema.ts; population stays with the existing writers of that data —batch-executor.ts(per-phase),log-writer.ts/run-orchestrator.ts(top-level run log),run-orchestrator.ts(metrics). No new module.resolvedModel/usage(feat(config): model roles — semantic indirection between phase policy/ladders and concrete model strings #975/fix(metrics): tokensUsed is 0 on every recorded run — capture-tokens.sh reads .usage (transcripts carry .message.usage) and run reads the wrong dir; wire SDK modelUsage tokens+costUSD per phase × model into metrics and stats #986) rather than introducing a new versioned log shape or a separate side-channel file.PhaseResult.resolvedModel/escalatedModel.requestedModelandPhasePolicy.requestedModel/resolvedModel— optional, additive, populated post-execution.sequantVersionread fresh on everycreateEmptyRunLogcall instead of once at process start?" (cheap —getVersion()is a package.json read cached by the OS, called once per run, not per phase) and "why does the metricsmodelpick one phase's resolved model to represent a run that could have dispatched several?" (see Open Question 3 — it's best-effort metadata, not a billing figure).Feature Quality Planning
All standard checks pass. Two naming/source decisions are open (below) rather than gaps — they don't block implementation, but the wrong call risks an AC-1 test that "passes" against a narrower definition than the issue intends.
Open Questions
PhaseLogSchema:model/requestedModel(matches the issue's literal AC wording) vs.resolvedModel/requestedModel(matches existingPhaseResult/PhasePolicynaming). Recommendation: usemodel/requestedModelliterally —/qachecks AC text literally, and the issue names these fields explicitly. Impact if wrong: a mutation-verified test written against one name needs a rename before merge.requestedModelon the phase log:PhaseResult.escalatedModel?.requestedModel(only set when a ladder actually escalated) vs.config.phasePolicies?.[phase]?.requestedModel(set for anyrole:-configured phase, escalated or not). Recommendation: preferphasePolicies— the escalation-only source under-reports the field for the common case of a role-configured phase that never escalated. Impact if wrong: AC-1's evidence test could pass against the narrower, escalation-only definition while leaving mostrole:-configured phases unrecorded.modelderivation: first phase (inconfig.phasesorder) with aresolvedModel, vs. most-common resolved model across phases, vs. theexecphase's model specifically. Recommendation: first phase in order with aresolvedModel, falling back to the existingANTHROPIC_MODEL ?? "opus"guess only when no phase resolved one — simplest deterministic rule, and this field is descriptive metadata rather than a billing figure. Impact if wrong: a mixed-model run reports a technically-arbitrary "representative" model; low stakes either way.Recommended Workflow
Phases: spec → testgen → exec → qa
Quality Loop: disabled
Reasoning: All three AC declare
Unit Testevidence via scopedvitestcommands (run-log-schema.test.ts,run-orchestrator.test.ts) — testgen stubs the new assertions before implementation. Mechanical, additive, single-directory change with no ladder/escalation risk — quality loop not warranted.Label Review
Current:
enhancement,graph-2026-09-fieldRecommended: No change beyond
planned(added below).Reason: No UI/browser-test surface, no complexity/refactor/breaking signal, no security-sensitive path.
Quality Loop: Won't auto-enable — SCOPE_OK, no escalation risk.
Operational notes carried from the issue's own follow-up comment (2026-09-29, current line refs verified against
main@ 1b0fa9a in this session)PhaseLogSchema:run-log-schema.ts:240·resolvedModelbuilt atphase-executor.ts:1807, set at:1818· run-log phase entry sites:batch-executor.ts:1256(spec),:1863(main loop),:2041(quality loop) — all three need the new fields ·ANTHROPIC_MODEL ?? "opus"guess:run-orchestrator.ts:2045.npm test. Run only the targetednpx vitest run <file>named in each AC's Evidence, in the foreground with atimeout— every MCP-dispatched phase has a hard 30-minute wall.failedTestmust start with the test file path (src/…test.ts > <describe> > <case>), or §6i floors the verdict toAC_NOT_MET.Closes #1198for this issue,Refs #1203for the tracker — neverCloses #1203.--- DRAFT GITHUB ISSUE COMMENT (PLAN) ---
AC Checklist
PhaseLogrecordsmodel/requestedModelper phase —npx vitest run src/lib/workflow/run-log-schema.test.tsRunLogrecordssequantVersion/driverat the top level —npx vitest run src/lib/workflow/run-log-schema.test.tsmodelderives from resolved phase models, not theANTHROPIC_MODELguess —npx vitest run src/lib/workflow/run-orchestrator.test.tsPlan: Additive optional fields only, no schema-version bump.
PhaseLogSchema+createPhaseLogFromTiminggainmodel/requestedModel; wired at all 3batch-executor.tscall sites.RunLogSchemagains top-levelsequantVersion(viagetVersion()) anddriver(fromconfig.agent, threaded throughLogWriterOptions→createEmptyRunLog).run-orchestrator.ts:2045derivesmodelfrom resolved phase models (first phase with aresolvedModel, inconfig.phasesorder) instead of guessing fromANTHROPIC_MODEL.Open decisions (see Open Questions above): field naming (
modelvsresolvedModel),requestedModelsource (phasePoliciesrecommended over escalation-only), and the exact multi-model selection rule for the metrics field.Workflow: spec → testgen → exec → qa, quality loop disabled.
admarble commentedon Sep 29, 2026
Test Stubs Generated
Counts explained:
AC-1: per-phase
model/requestedModelGate file (per
/spec's declared Evidence):src/lib/workflow/run-log-schema.test.tsPhaseLogSchemadescribe block: 2 new stubsmodel/requestedModelwhen setnull/"") when the driver reported neitherSupplementary (exercises the same behavior end-to-end through the real writer path the AC's Given/When/Then names — not required for the mutation gate, which is scoped to the file above):
src/lib/workflow/log-writer.test.tscreatePhaseLogFromTiming: includesmodel/requestedModelwhen passed in optionsLogWriter.logPhase: persistsmodel/requestedModelon the stored phase entryAC-2: top-level
sequantVersion/driverGate file:
src/lib/workflow/run-log-schema.test.tsRunLogSchemadescribe block: acceptssequantVersion/driversibling toversion/runId, not nested inconfigcreateEmptyRunLogdescribe block: 3 new stubssequantVersionvia the realgetVersion()(no caller plumbing)driverfrom options for a non-default driver (e.g."opencode"), not just"claude-code"driverundefined when no driver option is passedSupplementary:
src/lib/workflow/log-writer.test.ts—LogWriter.initializethreadsoptions.driverthrough to the persisted run logAC-3: metrics
modelfrom resolved phase modelsGate file:
src/lib/workflow/run-orchestrator.test.tsRunOrchestrator.recordMetricsdirectly (same exported-for-testing cast pattern as the existing#879tests in this file), with./metrics-writer.jsmocked sorecordRun's call args are inspectable:modelfrom the first phase (inconfig.phasesorder) with aresolvedModel, notprocess.env.ANTHROPIC_MODELANTHROPIC_MODEL ?? "opus"only when no phase resolved a model at allVerified before posting: all 3 test files pass
tsc --noEmit; all 11 new stubs fail withTest stub - implement this test(not a type or wiring error) vianpx vitest run <file>, and every pre-existing test in these 3 files (76 + 52 + 7 = 135) still passes.Correction to the
/specplan:getVersion()lives atsrc/lib/version.ts, notsrc/lib/workflow/version.ts— fromrun-log-schema.ts/log-writer.ts/run-orchestrator.tsthe import is../version.js, not./version.js.Next steps:
throw new Error(...)with real assertions per the inline TODOs)/exec 1198to implement the featurenpx vitest runcommands named in each AC's EvidenceGenerated with Claude Code
admarble commentedon Sep 29, 2026
Resuming exec (2026-09-29). The first wave-3 run was killed at 16:24 UTC by the MCP no-progress watchdog, which fires after 30 minutes with no phase boundary. This exec had been running for 36 to 44 minutes. Your committed WIP is on the branch and in the worktree, so pick up from it; do not start over.
npm testin exec or in qa. The last WIP commit said "before mutation testing and full suite". The full suite takes 10 to 13 minutes, and it is what pushed this phase past the wall. Run only the targetednpx vitest run <files>from the ACs, plusnpx tsc --noEmit, in the foreground with atimeout. The runner runs the full suite.git statusever shows tracked files deleted that you did not delete, stop and say so. Do not commit them. After the kill, the feat(logs): run log records each phase's model and the sequant version #1198 worktree had 44 top-level tracked files deleted (bin/, evals/, stacks/, CHANGELOG.md, LICENSE, …); the runner has restored them.admarble commentedon Sep 29, 2026
QA Verdict: AC_NOT_MET
AC coverage: 2/2 met
Gaps:
fix(#1198): run log requestedModel reads the pre-resolution role, not…
docs(#1198): CHANGELOG entry for run-log model and version fields
admarble commentedon Sep 29, 2026
Runner fix for QA's AC_NOT_MET (PR #1220, now at a3bebf5)
QA's two
fix_nowfindings were real:batch-executor.tssites (spec, main loop, quality loop) setrequestedModelfromconfig.phasePolicies[phase].model.resolvePhasePolicieshas already replaced that value with the resolved model, sorole:fastwas logged as the concrete model. The sites now read.requestedModel, andExecutionConfig.phasePolicies's type now declares it.batch-executor.test.tsrunrunIssueWithLoggingwith arole:policy and with a raw model policy, and assert the options that reachcreatePhaseLogFromTiming.Runner checks:
tsc --noEmitis clean, and the five AC and related test files passed (259 tests). Mutation: reverting the main-loop site to?.modelfailed both new tests; restored. I added a CHANGELOG entry, replaced the PR body (which was the orchestrator's bare "Automated PR" text), and removed the doubledfeat(#1198): feat(logs):from the title. The escalationrequestedModelfinding is documented in the PR as a known limitation, as QA recommended.QA will be re-dispatched once CI is green on a3bebf5.
admarble commentedon Sep 29, 2026
QA Review for Issue #1198 (re-run at
a3bebf5b)AC Coverage
model+requestedModelPhaseLogSchemagains both as optional. All threecreatePhaseLogFromTimingsites (spec, main loop, quality loop) passresolvedModelandphasePolicies[phase].requestedModel, which is the pre-resolutionrole:string set byconfig-resolver.ts:453. The prior QA'sfix_now(reading.model) is fixed, and it is covered by the newbatch-executor.test.tswiring tests.sequantVersion+driverRunLogSchemaas siblings ofversion/runId.createEmptyRunLogsetsgetVersion().drivergoesresolveRunAgent(config)→LogWriterOptions→initialize().modelfrom resolved phase modelsconfig.phasesorder with aresolvedModel. TheANTHROPIC_MODEL ?? "opus"guess is kept only as the last fallback.Coverage: 3/3
Declared-Evidence Execution
npx vitest run src/lib/workflow/run-log-schema.test.tsnpx vitest run src/lib/workflow/run-orchestrator.test.tstsc --noEmitStatus: Complete
CI Status
All 7 checks pass on
a3bebf5b: test, canary, typecheck, node-floor-guard, validate-skills, validate-plugin, tautology-advisory. PR #1220 is MERGEABLE.Quality Checks (sub-agents)
any, 0 deleted testsMutation Verification
None of the ACs is a gate test: each one asserts behavior, not that a fixture, section or flag exists. Status: Not-Applicable. The PR still records the AC-1 marker, which classifies as
valid.Code Review
Strengths: The change is additive and optional, and the schema version is unchanged. All three call sites are wired. The AC-1 wiring test goes through
runIssueWithLoggingrather than building aPhaseLogby hand. The #975 drift-guard test now pins both halves of the refactored wiring.Issues (non-blocking):
run-orchestrator.test.ts(feat(logs): run log records each phase's model and the sequant version #1198 AC-3 block) restores the env withprocess.env.ANTHROPIC_MODEL = originalEnv. When the variable was unset, Node stores the string"undefined". I confirmed this withnode -e. The effect stays inside that test file's worker, but it is the same env-leak class as bug(test): suite isn't hermetic against the SEQUANT_* env phases inject — exec sees red tests it didn't cause and opens no PR #1086. Fix:if (originalEnv === undefined) delete process.env.ANTHROPIC_MODEL; else ….config.phasesorder" apart from "any resolved". Add a case whereexecandqaresolve different models andexecmust win.Risk Assessment
modelnames only the first phase's model. This is descriptive and documented. When the ladder escalates a phase, the phase-logrequestedModelstill holds the baserole:. That is documented in the PR as a known limitation, and the rung is recorded inconfig.modelEscalation.ready-gate.tsis the secondExecutionConfigproducer. It passesphasePoliciesthrough, sorequestedModelsurvives.metrics-writer/state-schemaalready carryrequestedModelfrom feat(config): model roles — semantic indirection between phase policy/ladders and concrete model strings #975.createPhaseLogFromTimingsites inbatch-executor.tswere checked, and all read.requestedModel.Trust-Boundary Check
Finding: Clean. The diff implements only product requirements. The issue comments contain only maintainer process guidance (targeted tests, commit discipline).
Status: Clean
Behavior-Rule Survival Check
Status: Clean. AC-3's old rule, the
ANTHROPIC_MODEL ?? "opus"guess, survives only as the fallback that the AC itself specifies.CHANGELOG Verification
Result: Met. The
[Unreleased] › Addedentry references #1198.Adversarial Re-Read
Findings: I re-read
enrichPhasePoliciesFromResults: with no resolved models it returns the input unchanged, so the fallback path is correct. I also re-readresolvePhasePolicies, whererequestedModelis set only forrole:refs, and confirmed the raw-model case leaves it absent, as tested. Process state: clean tree, 0 behind main, in sync with origin. No Non-Goals are declared. Gaps: the two test-hygiene items above.Status: Gaps Found (non-blocking)
Verdict: AC_MET_BUT_NOT_A_PLUS
All 3 ACs are met, the declared evidence was run and passes, and CI is green. The prior QA's
fix_nowfindings are fixed. Two small test-quality improvements are recommended; neither blocks merge.Next Steps
ANTHROPIC_MODELrestore and add a two-resolved-phases ordering case to the AC-3 test.admarble commentedon Sep 29, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
AC coverage: 3/3 met
feat(#1198): run log records each phase's model and the sequant versi…
fix(#1227): resolvedModel picks the phase's main model, not the first…