Skip to content

feat(model): model.mjs lane prints the model and effort a lane starts on - #330

Merged
bfcarrasco merged 1 commit into
mainfrom
feat/lane-start-model-effort
Dec 5, 2026
Merged

bfcarrasco merged 1 commit into
mainfrom
feat/lane-start-model-effort

Conversation

@bfcarrasco

Copy link
Copy Markdown
Owner

Request

Builds #321 (spec #318). Criteria:

  • model.mjs lane <kind> [<issue>] [-R owner/repo] prints JSON { model, effort } for the kinds build, research and mechanical.
  • The rows live in MODEL_TABLE and nowhere else. Defaults: mechanical on the smallest model at low effort; research on the middle model at medium; build on the worker row, at medium effort, high for expected tier 2.
  • --failed <n>: a build lane whose ticket had two failed lanes on the largest regular model gets the strongest model. Nothing else selects it.
  • model is a family name, or session where the row keeps the session's model; an unknown kind or a ticket that cannot be read exits non-zero with a usage line.
  • model.mjs worker and model.mjs judge print what they print today.

Closes #321

Change

  • lib/models.mjs: a lane section in MODEL_TABLE (haiku/low, sonnet/medium, fable/high at --failed >= 2, build medium for expected tier 0-1, else high). A lane row without model takes the worker row's model; { min } matches a count.
  • guard.mjs: the ticket read is split out as ticketFacts, which throws; the worker hook keeps its catch-all.
  • model.mjs: the lane subcommand; worker and judge paths unchanged.

Decisions

  • A build lane whose expected tier is unknown (no ticket, or no Expected tier: line) gets high effort: the riskier reading.
  • --failed counts failed lanes on the largest regular model as the caller reports them; the script does not look them up.

Proof

  • node --test "tests/*.test.mjs": 876 pass, 0 fail (26 skipped as before). New tests in tests/judge.test.mjs cover each kind, the worker-row mapping, --failed, and every usage error.
  • Against real tickets:
    • lane build 321 -R bfcarrasco/bstack → {"model":"session","effort":"medium"} (exposure external)
    • ... --failed 2 → {"model":"fable","effort":"high"}
    • lane research → {"model":"sonnet","effort":"medium"}; lane mechanical 321 -R ... → {"model":"haiku","effort":"low"}
    • lane build 999999 -R ... and lane review → exit 2 with the usage line
    • worker 321 -R ... → session; judge 316 -R ... → sonnet, as before.

… on (#321)

Lane rows live in MODEL_TABLE: mechanical on haiku at low effort, research on sonnet at
medium, build on the worker row at medium (high when the expected tier is 2 or unknown),
and fable at high only for a build lane with two failed lanes (--failed). An unknown kind,
bad arguments or an unreadable ticket exit 2 with the usage line.
@bfcarrasco

Copy link
Copy Markdown
Owner Author

bstack-judge: PASS+NOTES tier=2 sha=7fe7eaff0d4c65605175aaf2fba5587a309e1d47

PR 330 (closes #321): I checked out head 7fe7eaf detached. Base is 800b86d. Verdict: PASS+NOTES. CI on both OSes was still running when I looked, and validate was green.

Criteria and proof

  • C1 lane <kind> [<issue>] [-R owner/repo] prints JSON {model, effort}. PROVEN. Ran node plugins/bstack/scripts/model.mjs against real tickets:
    • lane build 321 -R bfcarrasco/bstack prints {"model":"session","effort":"medium"}
    • lane research prints {"model":"sonnet","effort":"medium"}
    • lane mechanical 321 -R bfcarrasco/bstack prints {"model":"haiku","effort":"low"}
  • C2 The rows live only in MODEL_TABLE, with the stated defaults. PROVEN.
    • The new rows are only in plugins/bstack/scripts/lib/models.mjs. A grep for model names finds no other definition outside tests.
    • mechanical is haiku/low and research is sonnet/medium.
    • build takes the worker row's model. The internal tier-1 ticket gets sonnet in the test fixture; the real external ticket gets session.
    • build effort is medium for tier 0-1 and high for tier 2 or an unknown tier.
  • C3 --failed selects the strongest model only for build. PROVEN.
    • lane build 321 -R bfcarrasco/bstack --failed 2 prints {"model":"fable","effort":"high"}.
    • research and mechanical with --failed 5 do not get fable.
    • fable appears in exactly one table row.
  • C4 Family name or session; an unknown kind or an unreadable ticket exits non-zero with the usage line. PROVEN.
    • lane review, bare lane, lane build 999999 -R bfcarrasco/bstack and lane research 999999 -R bfcarrasco/bstack all exit 2 with the usage line.
    • The unreadable ticket also prints a "cannot read ticket" line.
    • --failed -1, --failed 1e3 and -R placed before the issue all exit 2.
  • C5 worker and judge print what they did before. PROVEN. I ran the same commands on base (with plugins/bstack/scripts checked out at 800b86d) and on head, and the output is identical:
    • worker 321 -R bfcarrasco/bstack prints session
    • judge 316 -R bfcarrasco/bstack prints sonnet
    • worker 330 -R bfcarrasco/bstack prints session
    • judge 330 -R bfcarrasco/bstack prints opus
    • worker 1 prints session
  • Tests: node --test tests/judge.test.mjs passes 31 of 31 on head. With the base scripts it fails 4: the three new model.mjs: the model and effort a lane starts on #321 tests and the updated table-keys test. They are real new coverage. I restored the scripts afterwards and the tree is clean.
  • risk-tier.mjs --pr 330: tier 2 (guard.mjs and models.mjs are risk paths). It lists no weakened checks, and the diff deletes no tests and adds no skips.

Findings (none block)

  • F1: a repeated --failed silently keeps the last value. lane build 321 --failed 2 --failed 0 prints {"model":"session","effort":"medium"}. By contrast, a second -R is rejected. It is harmless with a well-behaved caller, but it is inconsistent: a second --failed should also print the usage line.
  • F2: --failed works without a ticket. lane build --failed 3 gives fable/high with no issue. The criterion says "a build lane whose ticket had two failed lanes". The PR's Decisions section says the script takes the count as the caller reports it, and a test asserts this on purpose. It is a choice the PR documents, not a defect.

Hypotheses I tested that turned out fine

  • guard.mjs refactor: the old body moved into ticketFacts unchanged. workerFacts still swallows every error, so the worker hook behaves as before (C5 output and the existing tests agree).
  • Object branch added to holds: no judge or worker row has an object value, and a missing count (undefined >= 2) is false, so existing matches cannot change.
  • Odd kinds: a missing kind or constructor matches no row and gets the usage line.
  • Negative or non-integer counts: rejected by the ^\d+$ check.
  • Unknown kind with a valid ticket: it reads the ticket first, then exits 2 with the usage line. That is an extra gh call but the result is correct.
  • Expected tier missing (NaN): gives effort high and the session model, which matches the documented decision.
[{"id":"F1","title":"duplicate --failed silently takes the last value while duplicate -R is rejected","reproduction":"node plugins/bstack/scripts/model.mjs lane build 321 --failed 2 --failed 0","base":"not run","head":"pass","blocks":"no","files":["plugins/bstack/scripts/model.mjs"]},{"id":"F2","title":"--failed selects the strongest model with no ticket given (documented decision: caller-reported count)","reproduction":"node plugins/bstack/scripts/model.mjs lane build --failed 3","base":"not run","head":"pass","blocks":"no","files":["plugins/bstack/scripts/model.mjs"]}]

@bfcarrasco
bfcarrasco merged commit 7e41079 into main Dec 5, 2026
4 checks passed
@bfcarrasco
bfcarrasco deleted the feat/lane-start-model-effort branch December 5, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

model.mjs: the model and effort a lane starts on

1 participant