62ed63760c
Phase 1.4 of multi-repository task support: the orchestrator now reads every repository linked to a task, forwards the full list through the adapter into the lifecycle layer, and persists one TaskEnvironmentRepo plus one TaskSessionWorktree row per repo when the launch is multi-repo. Single-repo and repo-less tasks keep their previous code path verbatim (dual-write — legacy single-repo fields stay populated from the primary). - New resolveAllRepoInfo / resolveTaskRepoInfo on the executor; primary is the first by Position. - buildLaunchAgentRequest takes both the primary repoInfo and the full list, populating req.Repositories []RepoSpec only when length > 1. - New RepoSpec / RepoWorktreeResult on the orchestrator's executor package mirror the lifecycle types so the adapter can translate between them without leaking lifecycle types into the orchestrator public API. - Adapter (cmd/kandev/adapters.go) forwards req.Repositories into lifecycle.LaunchRequest and surfaces per-repo prepare results back on LaunchAgentResponse.Worktrees. - persistTaskEnvironment writes env.Repos in the same create transaction; persistTaskEnvironmentRepos handles the existing-env reuse path. TaskEnvironment.TaskDirName is now persisted. - persistWorktreeAssociation loops over resp.Worktrees in multi-repo, inserting one row per repo with its own RepositoryID. - ResumeSession now also populates req.Repositories from task repos and stamps the existing TaskDirName so the preparer reuses the same task root. - repoStore / executorStore interfaces extended with the new repo and env-repo CRUD methods; mocks updated accordingly. Tests: - LaunchPreparedSession with two task repositories populates req.Repositories in order and keeps legacy single-repo top-level fields filled from the primary. - The same launch persists one TaskEnvironment + 2 TaskEnvironmentRepo + 2 TaskSessionWorktree rows. - Single-repo launch still produces zero entries in req.Repositories and exercises only the legacy fields. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>