Skip to content

✨ feat: support per-rung models under --vm — ladder and advisor work in VM mode - #33

Merged
bdougie merged 6 commits into
mainfrom
worktree-issue-28-vm-ladder
Jul 5, 2026
Merged

bdougie merged 6 commits into
mainfrom
worktree-issue-28-vm-ladder

Conversation

@bdougie

@bdougie bdougie commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Closes #28. Follow-up to #25, #24, and #20.

Problem

VM isolation (--vm) and the cost-optimization features (escalation ladder, advisor) were mutually exclusive: agent.New() warned and disabled both under VM mode because the VM executor hardcoded a claude invocation with no --model plumbing.

Changes

  • worker.NewVMExecutor takes VMExecConfig{Model} — passes --model inside the VM claude invocation and stamps Provider/Model on results so fix_attempt telemetry can compare tiers under VM mode (the base worker model gap from Plumb --model through to claude and codex executors #20).
  • agent.WithVMExecutorFactory — cmd/run.go injects a func(model string) worker.Executor closure over the VM handle; agent.New builds the base worker, each ladder rung, and the advisor through it under cfg.VM. New now applies options before cfg resolution (injected executors still win; resolution only fills what's unset).
  • Scope per the issue: rungs and the advisor must resolve to the claude provider under --vm; a cross-provider rung (e.g. ollama/...) or non-claude advisor disables that capability with a warning. Cross-provider rungs inside VMs stay out of scope.
  • vm.Exec honors its context (exec.CommandContext) — the advisor's 5-minute planning timeout can now actually cancel a hung mb ssh invocation.
  • Docs: README, example.config.toml, and the sweeper skill note the claude-only constraint under [vm].

Also unblocks the repo's pre-commit coverage gate, which failed on a clean checkout: covers four untested branches and fixes a macOS mktemp bug in scripts/check-coverage.sh (a suffixed template like coverage-XXXXXX.out is treated as a literal path, so concurrent runs raced on one shared file).

Testing

  • TDD throughout; every commit passed the 100%-coverage pre-commit gate.
  • New tests: VM executor --model arg construction and result metadata; ctx propagation through the vm runner; agent factory wiring for base/rungs/advisor plus the disable paths (no factory, cross-provider rung, non-claude advisor).
  • go build ./... && go vet ./... && go test ./... all green.

bdougie added 6 commits July 5, 2026 12:22
The coverage hook failed on a clean checkout for two reasons:
- Four untested branches (NewEscalation negative clamp, ResolveStrategy
  retry hint, AnalyzeModels read error + sort tie-break, agent.New
  unknown advisor/rung provider) were below the 100% bar.
- macOS mktemp treats a template with a suffix (coverage-XXXXXX.out) as
  a literal path, so concurrent runs shared one file and raced on it.

Also adds the implementation plan for #28.
vm.Exec previously ignored its context (exec.Command, not
CommandContext), so cancellation and timeouts never reached the mb ssh
process — in particular the advisor's 5-minute planning timeout could
not cancel a hung VM invocation.
…#28)

agent.New now applies options before cfg resolution (injected executors
still win; resolution only fills what is unset) and gains
WithVMExecutorFactory. Under --vm the base worker, each escalation rung,
and the advisor are constructed through the factory — claude models
only; a cross-provider rung or non-claude advisor provider disables
that capability with a warning instead of the previous blanket gate.
The useVM block now injects agent.WithVMExecutorFactory instead of a
pre-built base executor; agent.New constructs the base worker, ladder
rungs, and advisor from the factory with their configured models.
@bdougie
bdougie merged commit d2cbf84 into main Jul 5, 2026
6 checks passed
@bdougie
bdougie deleted the worktree-issue-28-vm-ladder branch July 5, 2026 21:19
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.

VM mode disables the escalation ladder — support per-rung models under --vm

1 participant