inspect: make model the primary slot edit, agent swap explicit · Entire

inspect: make model the primary slot edit, agent swap explicit

2497dd0→main·

dipree·1mo ago·2 files·+55 added/-16 removed

Editing a crew/judge slot previously re-prompted for the agent first, even though a slot's identity is its agent — so 'editing' the agent effectively replaced the slot, and the agent prompt was mislabeled 'Add a slot' on the edit path.

The per-slot menu now offers 'Change model' (the common case, a single step) and a distinct 'Change agent', the latter shown only when more than one candidate agent exists. Swapping the agent re-prompts the model since advertised models are agent-specific. Also drop the stale 'Labs entry' help assertion left over from trimming the inspect help text.

Sessions

c1c1420c2dbbView transcript

[?
Checkout the hand off doc that I just added.Pi·Opus 4.8·2 steps](/content/gh/entireio/cli/session/019eca64-8c2c-7b00-90c6-3aa49738c497#timeline-c1c1420c2dbb/index.html)

Changes

2

112 unmodified lines

113
114
115
116
116
117
118
119

112 unmodified lines

t.Fatalf("execute: %v", err)
    }
    out := buf.String()
    for _, want := range []string{"review", "--configure", "--edit", "--findings", "--agent", "--agents", "--model", "--models", "--list", "attach", "Labs entry"} {
    for _, want := range []string{"review", "--configure", "--edit", "--findings", "--agent", "--agents", "--model", "--models", "--list", "attach"} {
        if !strings.Contains(out, want) {
            t.Errorf("--help output missing %q: %s", want, out)
        }
    }
}

Mcmd/entire/cli/review/cmd_test.go+1/-1

359 unmodified lines

360
361
362
363
363
364
365
366
367
368
369
370
368
369
371
372
373
374
375
376
377
378
379
380
381
8 unmodified lines

390
391
392
384
393
394
395
396
4 unmodified lines

401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
15 unmodified lines

441
442
443
416
417
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
422
423
424
425
426
460
461
462
463
10 unmodified lines

474
475
476
443
444
445
477
478
479
480
481
482
483
10 unmodified lines

494
495
496
497
498
499
500
501
502
464
503
504
505
506

359 unmodified lines

if convErr != nil || idx < 0 || idx >= len(slots) {
            continue
        }
        action, err := promptSlotAction(ctx, slots[idx])
        // The agent identifies the slot, so editing defaults to the model
        // (the common case). Swapping the agent is offered as a distinct action,
        // and only when there is more than one candidate to switch to.
        action, err := promptSlotAction(ctx, slots[idx], len(candidates) > 1)
        if err != nil {
            return nil, err
        }
        switch action {
        case "edit":
            slot, err := promptCrewSlot(ctx, candidates, slots[idx])
        case "model":
            model, err := promptCrewModel(ctx, slots[idx].agent, slots[idx].model)
            if err != nil {
                return nil, err
            }
            slots[idx].model = model
        case "agent":
            slot, err := promptChangeAgent(ctx, candidates, slots[idx])
            if err != nil {
                return nil, err
            }
8 unmodified lines

// promptCrewSlot prompts for one slot: an agent then a model. seed pre-selects
// the current agent/model when editing an existing slot (zero value when adding).
func promptCrewSlot(ctx context.Context, launchable []string, seed crewSlot) (crewSlot, error) {
    agentName, err := promptCrewAgent(ctx, launchable, seed.agent)
    agentName, err := promptCrewAgent(ctx, launchable, seed.agent, false)
    if err != nil {
        return crewSlot{}, err
    }
4 unmodified lines

return crewSlot{agent: agentName, model: model}, nil
}

// promptChangeAgent swaps the agent on an existing slot. Because advertised
// models are agent-specific, picking a different agent re-prompts for the model
// (seeded with the current one, so a still-valid/custom value is preserved).
// Keeping the same agent leaves the slot untouched.
func promptChangeAgent(ctx context.Context, candidates []string, seed crewSlot) (crewSlot, error) {
    agentName, err := promptCrewAgent(ctx, candidates, seed.agent, true)
    if err != nil {
        return crewSlot{}, err
    }
    if agentName == seed.agent {
        return seed, nil
    }
    model, err := promptCrewModel(ctx, agentName, seed.model)
    if err != nil {
        return crewSlot{}, err
    }
    return crewSlot{agent: agentName, model: model}, nil
}

// buildCrewProfile turns an ordered slot list into a profile. Each slot becomes
// a worker keyed by workerIDForAgentModel, which disambiguates duplicates
// (claude-code, claude-code-2, claude-code:opus, …).
15 unmodified lines

return profile
}

// promptSlotAction asks what to do with an existing slot row.
func promptSlotAction(ctx context.Context, slot crewSlot) (string, error) {
// promptSlotAction asks what to do with an existing slot row. The model is the
// primary edit (the agent identifies the slot); "Change agent" is only offered
// when allowAgentChange is set (more than one candidate agent exists).
func promptSlotAction(ctx context.Context, slot crewSlot, allowAgentChange bool) (string, error) {
    options := []huh.Option[string]{huh.NewOption("Change model", "model")}
    if allowAgentChange {
        options = append(options, huh.NewOption("Change agent", "agent"))
    }
    options = append(options,
                  huh.NewOption("Remove", "remove"),
                  huh.NewOption("Cancel", "cancel"),
    )
    picked := "cancel"
    form := newAccessibleForm(huh.NewGroup(
        huh.NewSelect[string]().
            Title(slotLabel(slot)).
            Options(
                huh.NewOption("Edit", "edit"),
                huh.NewOption("Remove", "remove"),
                huh.NewOption("Cancel", "cancel"),
                ).
            Options(options...).
            Value(&picked),
    ))
    if err := form.RunWithContext(ctx); err != nil {
10 unmodified lines

return labelForSimpleAgent(s.agent) + " · " + model
}

// promptCrewAgent picks the agent for a new slot. Auto-selects when only one
// launchable agent exists.
func promptCrewAgent(ctx context.Context, launchable []string, seedAgent string) (string, error) {
// promptCrewAgent picks the agent for a slot. Auto-selects when only one
// launchable agent exists. editing tailors the title for changing an existing
// slot's agent versus choosing one for a brand-new slot.
func promptCrewAgent(ctx context.Context, launchable []string, seedAgent string, editing bool) (string, error) {
    if len(launchable) == 1 {
        return launchable[0], nil
    }
10 unmodified lines

}
}

title := "Add a slot — which agent?"
if editing {
    title = "Change agent"
}
form := newAccessibleForm(huh.NewGroup(
    huh.NewSelect[string]().
        Title("Add a slot — which agent?").
        Title(title).
        Options(options...).
        Height(reviewPickerHeight(len(options))).
        Value(&picked),