Repository navigation
fix(server): reconcile detached-HEAD worktrees to null branch - #216
nullStack65 wants to merge 1 commit into
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
Independent full review: the fix that clears the stale branch name when a worktree's HEAD becomes detached. Reviewed exact head Verdict: one important finding and one nit. The detached-HEAD path works and its tests pass. The problem is that the new guard only checks that the folder exists, so a folder that exists but is no longer a git repository also gets its branch wiped. F1 (important), What goes wrong: the thread's last real branch name is overwritten with F2 (nit), Checked
Not verified: a live run on a real detached worktree, and evals. {
"reviewed_base": "caf9ebeb0cae23bee584f7b0acf3856fb6f6cada",
"reviewed_head": "003e816e96cb983865f083d9914b0056644648da",
"reviewer": "claude-opus-5-5, Claude Code via T3 Code",
"author_session": "unknown: PR author nullStack65, body says Model gemini-4-hydrogen; native author session not supplied to reviewer",
"reviewer_session": "t3-23264413-41298ae1fc704426",
"fresh_context": true,
"review_kind": "full",
"round_id": "t3-23264413-41298ae1fc704426",
"intent": [
"Reconcile refName === null to branch: null in WorktreeBranchSync after confirming the worktree directory exists and git.currentBranch(cwd) is null",
"Add detached: boolean (attached && branch === null) to WorktreeMcpStatusResult and t3_worktree_status",
"Focused tests in WorktreeBranchSync.test.ts and WorktreeMcpService.test.ts"
],
"prior_findings": [],
"findings": [
{
"id": "F1",
"severity": "important",
"outcome": "open",
"file": "apps/server/src/orchestration-v2/WorktreeBranchSync.ts",
"line": 45,
"summary": "Null-branch reconcile only checks that the folder exists. A folder that exists but is no longer a git repo (currentBranch returns null at GitWorkflowService.ts:358) also clears the thread's branch, and status reports detached: true. The broadcaster's isRepo is dropped. Require repositoryRoot(cwd) !== null or pass isRepo."
},
{
"id": "F2",
"severity": "nit",
"outcome": "open",
"file": "packages/contracts/src/worktreeMcp.ts",
"line": 81,
"summary": "The t3_worktree_status MCP output schema changed with no evals/ run, which the repo instructions ask for when model-facing tool text changes."
}
]
} |
|
Repair update for the fix that clears the stale branch name when a worktree's HEAD becomes detached. F1 is fixed on head F1 fix ( Test: new case "ignores detached HEAD events when the worktree directory is no longer a repository". It fails without the fix (1 failed, 4 passed) and passes with it. Fixer outcomes for the re-check: F1 important |
Squash-rebase of PR #216 onto current release/native-0.1.10; no behavior change from the original commits. Original authoring trailers: Model gemini-4-hydrogen / Task fix / Agent antigravity Model: claude-opus-5-5 Task: fix Agent: Builder drain parked-PR lane (Claude Code worker F3) Lane: magpie Harness: t3/claude-code Model-family: Claude Model-generation: Opus 5.5 Skills-SHA: unknown (source unavailable) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
857bc85 to
4bd79ae
Compare
When a worktree enters detached HEAD (
refName === null),WorktreeBranchSyncreturned early and left the stale branch name on the thread record.This change:
refName === nulltobranch: nullinWorktreeBranchSyncafter confirming the worktree directory still exists on disk andgit.currentBranch(cwd)isnull.detached: booleantoWorktreeMcpStatusResultandt3_worktree_status(attached && branch === null).WorktreeBranchSync.test.tsandWorktreeMcpService.test.ts.Deploy: fleet
Model: gemini-4-hydrogen
Task: fix