fix: fall back to the herdr space when naming a session topic - #59
Merged
Conversation
#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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What broke
On a two-project fleet (
omp-conductoron nanoclaw), both Telegram topics ended up titledconductor, even though herdr's spaces areveltrosecurityandconductor.Live
threads.jsonat the time:nameworkspaceLabelconductorconductor…/projects/conductor/worktreesconductorveltrosecurity/root/.omp/conductorWhy
#56 set the title to
ownAgentName ?? basename(cwd). Both halves fail together:agentNameForSessionreads herdr over a socket and swallows its own failure, soundefinedis a routine outcome, not a broken host.topics tidy oncloses the topic on exit, so a restart cannot adopt and the title is re-derived every time rather than settled once.Panes under a shared parent directory then all fall back to the same basename. One missed lookup is enough to retitle a live project's topic.
The knock-on: omp-conductor identified a project's topic by claim title, so once both said
conductorit could not tell them apart — arm challenges, pages and digests went to the wrong topic or degraded to the flat chat. (Fixed on that side too, by matchingworkspaceLabelfirst — but the title should be right at the source.)Change
workspaceLabelis already captured, by a different call than the agent name, and is equally one-to-one with the pane. New precedence:Extracted as
sessionTopicTitleintopics.ts, beside the module's other pure policy (decideRoute,findAdoptableThread) and exported so the rule is unit-testable — the same shape ascanAutoResumeTopic. Blank is treated as absent: Telegram rejects an empty topic name, and a space with no custom name must not consume the fallback.Scope
Titles are set at creation; re-adoption reuses the stored
name. So this affects new topics only — existing ones are untouched, exactly as documented.Tests
5 new cases in
topics.test.ts: agent name wins; space label when the lookup is empty; basename outside herdr; blank/whitespace treated as absent; and the actual regression — two panes under one tree getting distinct titles, with the pre-fix collapse pinned as the contrast.bun run check(typecheck + test): 283 pass / 0 fail.Docs:
docs/guide.mdupdated to the three-step rule and why the middle step exists.