Skip to content

t1896: Resolve specific model name in dispatch comments instead of auto-select (round-robin) #17503

@marcusquinn

Description

@marcusquinn

Problem

Dispatch comments posted by pulse-wrapper.sh show Model: auto-select (round-robin) when no explicit tier override is set (the common case). This makes it impossible to correlate worker success/failure with the specific model that was used.

Example current output:

Dispatching worker (deterministic).
- **Worker PID**: 12345
- **Model**: auto-select (round-robin)
- **Runner**: marcusquinn
- **Issue**: #17490

Root Cause

pulse-wrapper.sh line 6492:

local display_model="${selected_model:-auto-select (round-robin)}"

When selected_model is empty (no tier override), the fallback is a generic string. The actual model is chosen later by headless-runtime-helper.sh's _choose_model_auto() inside the worker process, which runs asynchronously after the dispatch comment is posted.

Fix

Pre-resolve the model using the existing select subcommand before launching the worker. This:

  1. Gives us the specific model name for the dispatch comment
  2. Allows passing it via --model so the worker uses exactly what we display (no divergence)

Implementation (pulse-wrapper.sh, ~line 6453)

Replace the current model selection block:

# BEFORE (lines 6453-6456)
local selected_model=""
if [[ -n "$model_override" ]]; then
    selected_model="$model_override"
fi

With:

# AFTER
local selected_model=""
if [[ -n "$model_override" ]]; then
    selected_model="$model_override"
else
    # Pre-resolve the round-robin model so we can display it in the dispatch
    # comment AND pass it to the worker (ensuring comment matches reality).
    selected_model=$("$HEADLESS_RUNTIME_HELPER" select --role worker 2>/dev/null) || selected_model=""
fi

And update the display_model fallback (line 6492):

# BEFORE
local display_model="${selected_model:-auto-select (round-robin)}"

# AFTER — only falls back if select failed (all models backed off)
local display_model="${selected_model:-all models backed off}"

Key considerations

  • The select subcommand calls _choose_model_auto() which respects backoff DB, auth availability, and round-robin rotation. It also updates the round-robin state, so the next call rotates correctly.
  • If select returns empty (exit 75 — all backed off), selected_model stays empty, --model is omitted, and the worker falls back to its own retry logic. The dispatch comment shows "all models backed off" instead of the misleading "auto-select".
  • Since we now always pass --model when a model is resolved, the worker's internal choose_model() gets an explicit model and skips its own round-robin — preventing the rare case where the dispatch comment and actual model diverge.

Files to change

  • .agents/scripts/pulse-wrapper.sh — lines ~6453-6456 and ~6492

Acceptance criteria

  1. Dispatch comments show specific model ID (e.g., anthropic/claude-sonnet-4-6) instead of auto-select (round-robin)
  2. ShellCheck clean
  3. When all models are backed off, comment shows all models backed off (not a false specific model)
  4. Round-robin rotation still works correctly (the select call advances the rotation state)

Metadata

Metadata

Assignees

Labels

auto-dispatchAuto-created from TODO.md tagorigin:workerCreated from worker sessionstatus:doneTask is completetier:simpleHaiku-tier sufficient: docs, formatting, config, simple renames

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions