Skip to content

fix(server): start a second agent of the same kind from New session - #328

Merged
devswha merged 3 commits into
mainfrom
fix/agent-name-unique
Oct 2, 2026
Merged

devswha merged 3 commits into
mainfrom
fix/agent-name-unique

Conversation

@devswha

@devswha devswha commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Fixes #314

Why

New session names an agent after its kind when the client sends no name (claude, codex, ...). herdr's agent.start takes a name once per session and answers agent_name_taken for a second one, so every session after the first of a kind got its workspace but no agent.

Change

  • With no name from the client, the server picks one that is free in the session: the kind, then <kind>-2, <kind>-3, ... (server/agent-name.ts, kept inside herdr's 32-character limit).
  • Two creations at once can pick the same free name, so the start picks again on agent_name_taken, three attempts at most. A name the client gives is used as given and never retried.
  • Client, wire contract and shell-started agents (omo, gjc) are unchanged.

Validation

  • server/agent-name.test.ts: the kind when free, the first free number, the length limit.
  • server/api.contract.test.ts: two workspaces of one kind both start with distinct names, and an explicit name is kept. It fails on main with agent_name_taken.
  • bun run typecheck, bun run test:unit (1034 pass), bun run build, bun test ./server/api.contract.test.ts (75 pass).

A remote PC gets this with the next remote runtime; this PR does not raise it.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: a0e65191-2ead-40cd-b3bc-7ece4e850e77

📥 Commits

Reviewing files that changed from the base of the PR and between 11ef35d and ff5cc55.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • server/agent-name.test.ts
  • server/agent-name.ts
  • server/api.contract.test.ts
  • server/index.ts
 __________________________________________
< Lint long and prosper with cleaner code. >
 ------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

# Conflicts:
#	CHANGELOG.md
#	server/api.contract.test.ts
herdr 0.9.3 answers agent_pane_busy for a pane whose shell is not up yet; CI hit it 20 ms after workspace.create.
@devswha
devswha merged commit e4d2fa2 into main Oct 2, 2026
10 of 11 checks passed
@devswha
devswha deleted the fix/agent-name-unique branch October 2, 2026 14:06
devswha added a commit that referenced this pull request Oct 2, 2026
## Change

Prepares v0.3.43: `package.json` and `herdr-plugin.toml` go to 0.3.43,
and the `[Unreleased]` notes move under `## [0.3.43] - 2026-10-02` with
its compare link.

What it ships:
- the sidebar's rows as they were before 0.3.42, without the new tab and
split buttons (#327);
- the message box stays editable while the app reconnects (#318);
- a second agent of the same kind starts from New session (#328, fixes
#314).

No new remote runtime: `REMOTE_BUNDLE_VERSION` stays 11. #328's server
fix reaches a remote PC with the next runtime.

## Do not merge yet

The maintainer releases this by hand. After the merge: `gh workflow run
release.yml --ref main -f version=0.3.43`

## Validation

`bun run typecheck`, `bun run test:unit` (1034 pass), `bun run build`.
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.

"+" new Claude session fails: "agent name claude is already used" when another Claude session exists

1 participant