forked from cleveragents/cleveragents-core
06428a5db6
Replace flat shutil.copy2 apply with spec-aligned git worktree flow
(specification.md §13225-13276):
Execute phase: creates an isolated git worktree via GitWorktreeSandbox
for the plan's linked git-checkout resource. LLM file output is
written to the worktree and committed on branch
cleveragents/plan-<plan_id> — no merge yet.
Apply phase: merges the worktree branch into the project's current
branch via git merge. Prints spec-aligned panels:
- Apply Summary: Plan ID, artifacts count, insertions/deletions,
project name, applied-at timestamp
- Sandbox Cleanup: worktree removed, branch merged to main
- Footer: ✓ OK Changes applied
Non-git projects (fs-directory resources) fall back to the original
flat directory sandbox with shutil.copy2.
Also fixes:
- context_tier_hydrator metadata types (int/float → string) that
caused Pydantic validation errors during context assembly
- A2A facade duplicate execute dispatch (idempotent handler)
- Logs actual error from context assembly failures
ISSUES CLOSED: #4454
43 lines
2.1 KiB
Gherkin
43 lines
2.1 KiB
Gherkin
@git-worktree-apply
|
|
Feature: Git worktree sandbox apply lifecycle (#4454)
|
|
Verifies that the apply phase merges LLM output from a git worktree
|
|
branch back into the project's main branch.
|
|
|
|
Scenario: Create worktree sandbox for git-checkout resource for wt_apply
|
|
Given a temp git project with 1 file for wt_apply
|
|
When I create a sandbox for the project for wt_apply
|
|
Then the sandbox path should be a directory for wt_apply
|
|
And the sandbox path should differ from the project path for wt_apply
|
|
|
|
Scenario: Worktree branch exists after sandbox creation for wt_apply
|
|
Given a temp git project with 1 file for wt_apply
|
|
When I create a sandbox for the project for wt_apply
|
|
Then the branch "cleveragents/plan-01TEST00000000000000000099" should exist for wt_apply
|
|
|
|
Scenario: Files written to sandbox appear on worktree branch for wt_apply
|
|
Given a temp git project with 1 file for wt_apply
|
|
And I create a sandbox for the project for wt_apply
|
|
When I write "fixed.py" to the sandbox for wt_apply
|
|
And I commit the sandbox for wt_apply
|
|
Then "fixed.py" should exist on branch "cleveragents/plan-01TEST00000000000000000099" for wt_apply
|
|
|
|
Scenario: Merge applies changes to main branch for wt_apply
|
|
Given a temp git project with 1 file for wt_apply
|
|
And I create a sandbox for the project for wt_apply
|
|
And I write "fixed.py" to the sandbox for wt_apply
|
|
And I commit the sandbox for wt_apply
|
|
When I merge the sandbox branch into main for wt_apply
|
|
Then "fixed.py" should exist in the project root for wt_apply
|
|
|
|
Scenario: Cleanup removes worktree and branch for wt_apply
|
|
Given a temp git project with 1 file for wt_apply
|
|
And I create a sandbox for the project for wt_apply
|
|
When I cleanup the sandbox for wt_apply
|
|
Then the sandbox path should not exist for wt_apply
|
|
And the branch "cleveragents/plan-01TEST00000000000000000099" should not exist for wt_apply
|
|
|
|
Scenario: Fallback to flat copy for non-git directory for wt_apply
|
|
Given a temp non-git directory with 1 file for wt_apply
|
|
When I copy files from sandbox to project for wt_apply
|
|
Then the project should have the copied file for wt_apply
|