Repository navigation
[Bugfix #1844] Derive fallback builder role ids through buildAgentName - #1993
Merged
Merged
Conversation
…ntName The overview's worktree-name fallback built task and generic-protocol role ids by hand, skipping the leading-zero stripping buildAgentName applies when spawn names the terminal. An all-digit short id (task-0042) therefore mapped to builder-task-0042 while its terminal is builder-task-42, and the builder was filtered out of /api/overview. The ids reported in the issue (task-S0-L, task-_-LM) were already fixed by PIR #1740; this closes the remaining drift.
… id; anchor literal Adds a getOverview test of the user-visible symptom: task-0042, task-S0-L and task-_-LM with no stored row survive the active-terminal filter. Fails on main's overview.ts, passes with the fix. Also pins task-0042 -> builder-task-42 as a literal so the unit test does not rely on buildAgentName alone.
waleedkadous
marked this pull request as draft
November 26, 2026 00:04
waleedkadous
marked this pull request as ready for review
November 26, 2026 22:18
waleedkadous
added a commit
that referenced
this pull request
Nov 26, 2026
waleedkadous
added a commit
that referenced
this pull request
Nov 26, 2026
PR #1993 (bugfix-1844) already routes worktreeNameToRoleId's task and issue-less protocol branches through buildAgentName, with tests for the issue's ids, leading zeros, getOverview and the worktree- carve-out. The merge took main's overview.ts and overview.test.ts; this drops my duplicate getOverview test that merged in beside main's. What remains is the afx cleanup fix (findTaskBuilder / findProjectBuilder via taskBuilderId) and its tests.
waleedkadous
added a commit
that referenced
this pull request
Nov 26, 2026
5 tasks done
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.
Fixes #1844
Problem
A builder whose worktree-derived role id doesn't match the role id its terminal registered under is filtered out of
/api/overview, so it disappears from the VSCode Agents view. The issue reports this for task ids containing-or_(task-S0-L,task-_-LM) on 3.3.4.Root cause
The ids in the report were already fixed on main. PIR #1740 (the issue-key worktree change, commit f251a98, first released in v3.3.6) changed
worktreeNameToRoleId()to take the whole remainder as the short id. It also made discovery prefer the builder id stored in global.db over parsing the directory name. On main today,task-S0-L→builder-task-s0-landtask-_-LM→builder-task-_-lm, which match what spawn registers.One drift remained in the same fallback. It still assembled the task and generic-protocol role ids by hand instead of calling
buildAgentName(), the function spawn names the terminal with.buildAgentName()strips leading zeros from an all-digit id, and a base64url short id can be all digits:buildAgentName)task-0042builder-task-0042builder-task-42experiment-0042builder-experiment-0042builder-experiment-42When global.db has no usable row for the builder, this hides it exactly as #1844 describes. Rows from older versions carry a legacy id and fall through to this path.
Fix
The fallback's task and generic-protocol branches now call
buildAgentName('task', id)/buildAgentName('protocol', id, protocol). This is the issue's own suggested fix ("derive the role id from the same function that registers the terminal, so the two cannot drift"). The generic branch's numbered path now goes throughbuildAgentName()too, so a zero-padded generic name loses its zeros as the terminal name does:air-0633-slug→builder-air-633(wasbuilder-air-0633). That matchesbuildAgentName('spec', projectId, protocol)at spawn and brings the generic protocols in line with thespir/tick/bugfix/pirbranches above, which have always stripped. Theworktree-branch is unchanged: spawn names that terminalworktree-<short id>directly, not throughbuildAgentName(), so its zeros stay.Left alone on purpose:
experiment-12-astill reads as numbered spawn 12. An issue-less spawn with short id12-awould registerbuilder-experiment-12-a, but from the directory name alone it can't be told apart from a pre-Spec-653 numbered worktree with a slug (<protocol>-<N>-<slug>). The fallback mostly serves legacy rows, so reading the name as numbered first is the safer choice. A present-day spawn has abuilder-…row, so the stored id resolves it.Testing
strips leading zeros from an all-digit short id, as buildAgentName does (#1844):task-0042,task-0000,experiment-0042andmaintain-0007-xare checked againstbuildAgentName, andworktree-0042is pinned to keep its zeros. It fails on main (expected 'builder-task-0042' to be 'builder-task-42') and passes with the fix.keeps a live task builder whatever characters its short id holds (#1844): this is the user-visible symptom. It creates.builders/task-0042,task-S0-Landtask-_-LMwith no global.db row and callsgetOverview()with the active-terminal set that spawn registers (builder-task-42,builder-task-s0-l,builder-task-_-lm). All three must survive the filter. It fails on main'soverview.tsand passes with the fix.task-0042→builder-task-42as a literal, so it doesn't rely onbuildAgentNamealone.task-S0-L,task-_-LM). It is coverage only: it already passes on main because forge: add a jira provider preset (hybrid tracker — issues from Jira, PR concepts fall through to github, Linear-style) #1740 fixed them.tsc --noEmitis clean. The three role-id test files (overview,pir-1740-issue-key-worktree,overview-agent-state) pass: 230 tests (after merging current main).packages/codevsuite: 9845 passed on the first run. The 117 failures in that run came from an unbuilt worktree (Skeleton directory not found). All 15 of those files pass afterpnpm build(334 passed, 3 skipped).Review
getOverviewsymptom test.