fix(done): get issue ID from agent hook and detect integration branches (#411) (#453)

Branch names like "polecat/furiosa-mkb0vq9f" don't contain the actual
issue ID, causing gt done to incorrectly parse "furiosa-mkb0vq9f" as the
issue. This broke integration branch auto-detection since the wrong issue
was used for parent epic lookup.

Changes:
- After parsing branch name, check the agent's hook_bead field which
  contains the actual issue ID (e.g., "gt-845.1")
- Fix parseBranchName to not extract fake issue IDs from modern polecat branches
- Fix detectIntegrationBranch to traverse full parent chain (molecule → bug → epic)
- Include issue ID in polecat branch names when HookBead is set

Added tests covering:
- Agent hook returns correct issue ID
- Modern polecat branch format parsing
- Integration branch detection through parent chain

Fixes #411

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Julian Knutsen
2026-01-16 19:40:18 +00:00
committed by GitHub
parent 8332a719ab
commit e5aea04fa1
5 changed files with 220 additions and 51 deletions

View File

@@ -68,6 +68,24 @@ func TestParseBranchName(t *testing.T) {
wantIssue: "gt-abc.1",
wantWorker: "Worker",
},
{
name: "polecat branch with issue and timestamp",
branch: "polecat/furiosa/gt-jns7.1@mk123456",
wantIssue: "gt-jns7.1",
wantWorker: "furiosa",
},
{
name: "modern polecat branch (timestamp format)",
branch: "polecat/furiosa-mkc36bb9",
wantIssue: "", // Should NOT extract fake issue from worker-timestamp
wantWorker: "furiosa",
},
{
name: "modern polecat branch with longer name",
branch: "polecat/citadel-mk0vro62",
wantIssue: "",
wantWorker: "citadel",
},
{
name: "simple issue branch",
branch: "gt-xyz",