feat(refinery,boot): add --agent flag for model selection (#469)

* feat(refinery,boot): add --agent flag for model selection (hq-7d5m)

Add --agent flag to gt refinery start/attach/restart and gt boot spawn
commands for consistent model selection across all agent launch points.

Implementation follows the existing pattern from gt deacon start:
- Add StringVar flag for agent alias
- Pass override to Manager/Boot via SetAgentOverride()
- Use BuildAgentStartupCommandWithAgentOverride when override is set

Files affected:
- cmd/gt/refinery.go: add flags to start/attach/restart commands
- internal/refinery/manager.go: add SetAgentOverride and use in Start()
- cmd/gt/boot.go: add flag to spawn command
- internal/boot/boot.go: add SetAgentOverride and use in spawnTmux()

Closes #438

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(refinery,boot): use parameter-passing pattern for --agent flag

Address PR review feedback:

1. ADD TESTS: Add tests for --agent flag existence following witness_test.go pattern
   - internal/cmd/refinery_test.go: tests for start/attach/restart
   - internal/cmd/boot_test.go: test for spawn

2. ALIGN PATTERN: Change from setter pattern to parameter-passing pattern
   - Manager.Start(foreground, agentOverride) instead of SetAgentOverride + Start
   - Boot.Spawn(agentOverride) instead of SetAgentOverride + Spawn
   - Matches witness.go style: Start(foreground bool, agentOverride string, ...)

Updated all callers to pass empty string for default agent:
- internal/daemon/daemon.go
- internal/cmd/rig.go
- internal/cmd/start.go
- internal/cmd/up.go

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: furiosa <will@saults.io>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Will Saults
2026-01-13 15:14:47 -06:00
committed by GitHub
parent 45de02db43
commit bda248fb9a
10 changed files with 122 additions and 28 deletions

View File

@@ -779,7 +779,7 @@ func runRigBoot(cmd *cobra.Command, args []string) error {
} else {
fmt.Printf(" Starting refinery...\n")
refMgr := refinery.NewManager(r)
if err := refMgr.Start(false); err != nil { // false = background mode
if err := refMgr.Start(false, ""); err != nil { // false = background mode
return fmt.Errorf("starting refinery: %w", err)
}
started = append(started, "refinery")
@@ -859,7 +859,7 @@ func runRigStart(cmd *cobra.Command, args []string) error {
} else {
fmt.Printf(" Starting refinery...\n")
refMgr := refinery.NewManager(r)
if err := refMgr.Start(false); err != nil {
if err := refMgr.Start(false, ""); err != nil {
fmt.Printf(" %s Failed to start refinery: %v\n", style.Warning.Render("⚠"), err)
hasError = true
} else {
@@ -1437,7 +1437,7 @@ func runRigRestart(cmd *cobra.Command, args []string) error {
skipped = append(skipped, "refinery")
} else {
fmt.Printf(" Starting refinery...\n")
if err := refMgr.Start(false); err != nil {
if err := refMgr.Start(false, ""); err != nil {
fmt.Printf(" %s Failed to start refinery: %v\n", style.Warning.Render("⚠"), err)
startErrors = append(startErrors, fmt.Sprintf("refinery: %v", err))
} else {