Skip to content

Fall back to another herdr agent name when the label is taken (work-system 1.31.2) - #106

Open
gering wants to merge 2 commits into
mainfrom
task/herdr-agent-name-collision-across-spaces
Open

gering wants to merge 2 commits into
mainfrom
task/herdr-agent-name-collision-across-spaces

Conversation

@gering

@gering gering commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Problem

herdr agent names are unique per server, not per workspace. /kickoff for the same feature in two workspaces (server + app) derived the same label; the second agent start got agent_name_taken, herdr-launch.sh classified it as ambiguous, reported blocked=unverified and left an empty shell tab that looked like a started lane.

Fix (herdr-launch.sh, modern herdr path)

  • Verified live on herdr 0.9.5 (own spike- tab): agent_name_taken is immediate (exit 1) and types nothing; herdr agent get <name> returns the holder's cwd.
  • On a taken name, retry as <label>-<repo> (main checkout dir name), then -2, -3 — WORK_SYSTEM_HERDR_NAME_TRIES (default 4, clamped 1..10). The plain label stays the common case.
  • Each retry is gated on evidence (older builds were not checked):
    • holder in this worktree → a worker of this lane exists: rollback, exit 1 (no second worker);
    • holder unreadable → rollback, exit 1;
    • our pane no longer at its bare shell prompt → blocked=unverified, tab left alone.
  • All names taken → fail_definitive: tab rolled back, exit 1, /kickoff shows its manual block — loud, no shell tab posing as a lane.
  • The timeout-path agent rename walks the same names. Legacy herdr (0.7.0–0.7.4) never retries (never observed refusing a name).
  • A fallback is reported as a new herdr_name= stdout line (absent otherwise; additive).

Also

Tests

test_herdr_launch.py: fallback + rename, no suffix when free, bounded exhaustion with rollback, holder-in-this-worktree, unreadable holder, pane-left-prompt, NAME_TRIES clamp, no double slug, legacy no-retry, and the incident end-to-end — two kickoffs of one label in two workspaces (plus a same-lane relaunch) against a stateful stub server. check-structure.py green.

Review

Local /swarm:review (claude lenses + cc-harness sol/grok): 10 findings, 9 agreed + 1 partial, all addressed in daea08e; recorded for the merge gate.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RtoWD3tGh5bQtyaUkwLnVQ

gering and others added 2 commits November 4, 2026 23:09
…ystem 1.31.2)

herdr agent names are server-wide, so two lanes with the same task-derived
label in different workspaces collided: the second `agent start` got
agent_name_taken, was classified ambiguous, and left an empty shell tab
reported as blocked=unverified.

- Verified live (herdr 0.9.5): the rejection is immediate and types nothing,
  so retry under `<label>-<repo>`, then `-2`, `-3` (WORK_SYSTEM_HERDR_NAME_TRIES)
- Same walk on the legacy start and the timeout-path rename
- Report a fallback as `herdr_name=`; all names taken -> fail_definitive
  (tab rolled back, exit 1)
- Tests incl. two kickoffs of one label in two workspaces against a
  stateful stub server; /kickoff and knowledge updated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RtoWD3tGh5bQtyaUkwLnVQ
Address the swarm review of the name fallback:

- Retry only on modern herdr, and only when the holder (herdr agent get)
  runs in another worktree and our pane is back at its bare shell prompt;
  a holder in this worktree or an unreadable holder rolls back and exits 1,
  a pane that left its prompt stays blocked=unverified
- Legacy herdr keeps its single loud failure (never observed refusing)
- Validate and clamp WORK_SYSTEM_HERDR_NAME_TRIES (1..10)
- Document herdr_name= in the script header, the /kickoff template,
  the README and the CHANGELOG (1.31.2)
- Tests for each gate, the clamp, and a same-lane relaunch on the
  stateful two-workspace stub

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RtoWD3tGh5bQtyaUkwLnVQ
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.

1 participant