Skip to content

feat: name a session topic after its herdr agent, not its cwd basename - #56

Merged
TerrifiedBug merged 1 commit into
masterfrom
fix/topic-name-from-agent
Aug 15, 2026
Merged

feat: name a session topic after its herdr agent, not its cwd basename#56
TerrifiedBug merged 1 commit into
masterfrom
fix/topic-name-from-agent

Conversation

@TerrifiedBug

Copy link
Copy Markdown
Owner

Problem

A session's topic title comes from one line:

let name = basename(cwd);

That is whatever the parent directory happens to be called, so it is ambiguous exactly when topics matter most — several panes under one tree all claim a topic with the same title. Concretely, a conductor fleet whose pane runs in ~/.omp/conductor gets a topic called "conductor", and its sibling project's pane, running in ~/.omp/conductor/projects/<name>/worktrees, would get "worktrees". Neither names the thing the operator is looking at.

The plugin already captures the herdr space, but never reads the identity that is actually per-session.

Fix

Prefer the herdr agent name for the topic title, falling back to basename(cwd).

An agent name is assigned deliberately (herdr agent start <name>, agent rename) and is one-to-one with the session — which is precisely what a per-session topic represents. The workspace label is deliberately not used: it is one-to-many over panes, so it would be no more specific than the directory it replaced, and would regress users whose label is generic while their cwd basename is meaningful.

pane list does not carry the agent name, so agentNameForSession reads agent list and matches on the exact agent_session.value — the same way findSessionSpace already matches. One extra herdr call, once, at claim time.

Captured independently of the space snapshot so a failed space lookup still yields a correctly named topic, and a herdr call that fails warns and falls back rather than blocking the claim.

Behaviour

Context Topic title
herdr pane with an agent name that agent name
herdr pane, no agent name basename(cwd) (unchanged)
outside herdr basename(cwd) (unchanged)

Existing topics are untouched: nothing calls editForumTopic, and a re-adopted topic keeps the name recorded in threads.json.

Tests

Mutation-verified. agentNameForSession returns the bound name, is undefined for an absent / empty / missing name (so the caller keeps its own fallback rather than creating a blank title), and rejects a malformed herdr reply instead of guessing. Dropping the empty-name guard fails the suite.

docs/guide.md updated: the per-session topics section documents the agent-name-first rule and why the fallback exists.

basename(cwd) is whatever the parent directory happens to be called, so every pane
under one tree claims a topic with the same useless title. A herdr agent name is
assigned deliberately and is one-to-one with the session, which is exactly what a
per-session topic represents. pane list does not carry it; agent list does.

Falls back to basename(cwd) outside herdr, or when herdr names no agent.
@TerrifiedBug
TerrifiedBug merged commit f87be23 into master Aug 15, 2026
1 check passed
@TerrifiedBug
TerrifiedBug deleted the fix/topic-name-from-agent branch August 15, 2026 10:06
TerrifiedBug added a commit that referenced this pull request Aug 15, 2026
#56 titled a topic after the pane's herdr agent name, falling back to
`basename(cwd)`. Both halves fail together on a multi-project fleet:
`agentNameForSession` reads herdr over a socket and swallows its own failure, so
"no agent name" is a routine outcome, and `topics tidy on` closes the topic on
exit — so the title is re-derived on every restart rather than settled once.

On a host running two projects under `~/.omp/conductor`, one missed lookup
titles that pane's topic "conductor" after the shared parent directory. Both
projects then carry the same title, and a consumer that identifies a project's
topic by name (omp-conductor's escalation routing) can no longer tell them
apart — pages, digests and arm challenges land in the wrong topic or degrade to
the flat chat.

The herdr space label is equally one-to-one with the pane and is captured by a
different call, so it holds the title up when the agent name does not. The rule
moves into `topics.ts` as `sessionTopicTitle`, beside the rest of the module's
pure policy, and blank is treated as absent throughout: Telegram rejects an
empty topic name.

Existing topics are unaffected — a title is set at creation and re-adoption
reuses the stored name.
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