feat(domain): add agentrun creation and spec initialization to adopted branches#417
Open
feat(domain): add agentrun creation and spec initialization to adopted branches#417
Conversation
…anch agent runs - Added 17 functional requirements covering AgentRun creation and linking - Added 10 non-functional requirements for performance, consistency, and maintainability - Defined 10 measurable success criteria for feature completion - Resolved 4 product questions with structured options and AI recommendations: 1. Adopted features start as Pending (requires explicit start) 2. AgentRun.prompt uses "(adopted from existing branch)" placeholder 3. Spec directory is initialized with empty YAMLs for consistency 4. Agent validation skipped during adoption (deferred to execution time) - Detailed implementation notes following CreateFeatureUseCase pattern - Comprehensive TDD testing strategy with unit and integration test plans Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Inject IAgentRunRepository and ISpecInitializerService into AdoptBranchUseCase constructor following existing tsyringe pattern. Import required Node.js modules (existsSync, join, randomUUID), TypeSpec-generated types (AgentRunStatus, SdlcLifecycle), and getSettings service. Update test mocks to include new repositories. All dependencies already registered in DI container. Imports prepared for Phase 2 AgentRun creation logic. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…d branches Implement phase 2 of feature 071 (adopted-branch-agent-runs): - Calculate feature number from existing features in repository - Conditionally initialize spec directory (preserve existing, create if missing) - Create AgentRun record following CreateFeatureUseCase pattern (lines 156-210) - Link Feature to AgentRun via agentRunId field - Persist AgentRun before Feature (respects referential integrity) Changes: - AdoptBranchUseCase now creates AgentRun with status=pending, agentType from settings - Spec directory detection via existsSync - preserves existing work - AgentRun.prompt set to "(adopted from existing branch)" placeholder - Feature.specPath and Feature.agentRunId now populated for adopted features - All 28 unit tests passing, 4354 total tests passing Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…t run support Add unit and integration tests validating AgentRun creation, spec directory initialization, and entity linking for adopted branches. Tests cover all acceptance criteria including field validation, error handling, and persistence order. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replace hardcoded Unix paths with path.join() to ensure tests pass on Windows. Fixes CI failure on windows-latest runner where backslashes are used. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Use path.join() in test mocks to generate platform-specific paths on Windows. This ensures the mock paths match what the implementation generates with join(). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…iables Move mockWorktreePath to module level and use consistently across all tests. This ensures all path assertions work on both Unix and Windows platforms. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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.
Summary
Adds AgentRun creation and spec directory initialization to
AdoptBranchUseCase, enabling adopted features to participate in the full agent execution lifecycle (start, resume, reject iterations).Fixes: Adopted branches can now be started, resumed after interruption, and process rejection feedback - previously these operations failed with "No agent run found" error.
Changes
Core Implementation
IAgentRunRepositoryandISpecInitializerServicedependenciesfeature.agentRunIdfieldTest Coverage
Unit tests (tests/unit/use-cases/features/adopt-branch.use-case.test.ts):
Integration tests (tests/integration/features/adopt-flow.integration.test.ts):
Evidence
The following evidence was captured to prove task completion:
See:
specs/071-adopted-branch-agent-runs/evidence/adopt-branch-unit-tests.txtSee:
specs/071-adopted-branch-agent-runs/evidence/adopt-integration-tests.txtTesting
Related
specs/071-adopted-branch-agent-runs/spec.yaml🤖 Generated with Claude Code