b907ccd9f8
CI / helm (pull_request) Successful in 35s
CI / build (pull_request) Successful in 3m51s
CI / lint (pull_request) Successful in 3m56s
CI / quality (pull_request) Successful in 4m21s
CI / typecheck (pull_request) Successful in 4m32s
CI / security (pull_request) Successful in 4m43s
CI / push-validation (pull_request) Successful in 23s
CI / e2e_tests (pull_request) Successful in 7m51s
CI / integration_tests (pull_request) Successful in 8m32s
CI / unit_tests (pull_request) Successful in 9m6s
CI / docker (pull_request) Successful in 1m29s
CI / coverage (pull_request) Successful in 13m28s
CI / status-check (pull_request) Waiting to run
When a user cancels a plan after execute, the git worktree branch and directory created during execute are not cleaned up, causing resource leaks (dangling worktrees accumulate over time). Add GitWorktreeSandbox.cleanup_stale() classmethod in the infrastructure layer with idempotent error handling. _cleanup_sandbox_for_plan() in the CLI layer resolves the plan's linked git-checkout resource and delegates to cleanup_stale(). Called after service.cancel_plan() in the cancel CLI handler. ISSUES CLOSED: #9230
18 lines
1015 B
Gherkin
18 lines
1015 B
Gherkin
@cancel-worktree-cleanup
|
|
Feature: Plan cancel cleans up worktree sandbox (#9230)
|
|
Verifies that cancelling a plan after execute removes the
|
|
git worktree branch and directory to prevent resource leaks.
|
|
|
|
Scenario: _cleanup_sandbox_for_plan removes worktree for cancelled plan for cwc
|
|
Given a temp git project with a worktree sandbox for plan "01TESTCANCEL000000000000" for cwc
|
|
And a mocked service that resolves the project for cwc
|
|
When I call _cleanup_sandbox_for_plan for plan "01TESTCANCEL000000000000" for cwc
|
|
Then the branch "cleveragents/plan-01TESTCANCEL000000000000" should not exist for cwc
|
|
And the worktree directory should not exist for cwc
|
|
|
|
Scenario: _cleanup_sandbox_for_plan is a no-op when no sandbox exists for cwc
|
|
Given a temp git project without any worktree for cwc
|
|
And a mocked service with no linked resources for cwc
|
|
When I call _cleanup_sandbox_for_plan for plan "01TESTNOSANDBOX0000000000" for cwc
|
|
Then the call should complete without error for cwc
|