Skip to content

Fix multi-repo team worker spawn#1047

Merged
SuuBro merged 12 commits into
masterfrom
goal/minimal-multi-a6312fb8
Jul 23, 2026
Merged

Fix multi-repo team worker spawn#1047
SuuBro merged 12 commits into
masterfrom
goal/minimal-multi-a6312fb8

Conversation

@SuuBro

@SuuBro SuuBro commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • spawn host team workers from persisted multi-repo goal worktrees using exact local component HEADs
  • launch from one branch container and retain per-repo cleanup metadata
  • roll back only worktrees created by the current attempt and remove empty nested containers safely
  • add focused real-Git direct and REST regression coverage

Validation

  • focused multi-repo real-Git regression
  • unchanged single-repo TeamManager spawn regression
  • npm run check
  • full implementation workflow: build, type-check, unit, browser, E2E, gap analysis, code-quality review, and bug hunt

🤖 Generated with Bobbit

SuuBro and others added 6 commits July 23, 2026 14:23
Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes host multi-repository team-worker provisioning and cleanup.

  • Creates component worktrees from each persisted goal worktree’s exact local HEAD.
  • Persists per-repository cleanup metadata during initial session creation.
  • Tracks branch ownership so rollback removes only branches created by the current attempt.
  • Adds real-Git regression coverage and registers it in the test execution map.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failures remain.

Important Files Changed

Filename Overview
src/server/agent/team-manager.ts Spawns host multi-repository workers from exact component HEADs and threads ownership-aware cleanup metadata through session creation and team persistence.
src/server/skills/git.ts Adds exact per-repository start points, branch-ownership tracking, partial rollback, and safe empty-container removal for worktree sets.
src/server/agent/session-manager.ts Persists and consumes per-repository worktree coordinates for restoration, branch guarding, and purge cleanup.
src/server/agent/session-setup.ts Carries multi-repository metadata through initial persistence and delegates failed pre-provisioned worker cleanup to TeamManager.
tests2/integration/team-spawn-multi-repo-real-git.test.ts Adds direct and REST real-Git regression coverage for exact component starts, rollback, persistence, and cleanup.

Sequence Diagram

sequenceDiagram
  participant TM as TeamManager
  participant Git as createWorktreeSet
  participant SM as SessionManager
  participant Store as SessionStore
  TM->>TM: Read each goal component HEAD
  TM->>Git: Create worker component worktrees
  Git-->>TM: Container, paths, branch ownership
  TM->>SM: createSession with repoWorktrees
  SM->>Store: Persist initial cleanup metadata
  alt Session creation succeeds
    SM-->>TM: Worker session
  else Provisioning or session creation fails
    TM->>Git: Clean created worktrees and owned branches
    Git->>Git: Remove empty nested container
  end
Loading

Reviews (2): Last reviewed commit: "test post-spawn multi-repo cleanup owner..." | Re-trigger Greptile

Comment thread src/server/agent/team-manager.ts
Comment thread src/server/agent/team-manager.ts
SuuBro and others added 2 commits July 23, 2026 15:55
Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
result.worktrees.map(worktree => worktree.worktreePath),
);
} catch (err) {
console.error(`[team-manager] Failed to remove worker branch container ${result.container}:`, err);
console.error(`[team-manager] Component "${worktree.repo}" cleanup left worktree at ${worktree.worktreePath}`);
} catch { /* removed */ }
} catch (err) {
console.error(`[team-manager] Failed to clean up component "${worktree.repo}" worktree ${worktree.worktreePath}:`, err);
result.worktrees.map(worktree => worktree.worktreePath),
);
} catch (err) {
console.error(`[team-manager] Failed to remove worker branch container ${result.container}:`, err);
result.worktrees.map(worktree => worktree.worktreePath),
);
} catch (err) {
console.error(`[team-manager] Failed to remove worker branch container ${result.container}:`, err);
SuuBro and others added 4 commits July 23, 2026 16:29
Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
@SuuBro
SuuBro merged commit 2f1ba22 into master Jul 23, 2026
6 of 7 checks passed
@SuuBro
SuuBro deleted the goal/minimal-multi-a6312fb8 branch July 23, 2026 19:41
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.

2 participants