fix(sandbox): use spec-required cleveragents/plan- branch prefix in GitWorktreeSandbox
CI / lint (pull_request) Successful in 26s
CI / quality (pull_request) Successful in 44s
CI / typecheck (pull_request) Successful in 55s
CI / security (pull_request) Successful in 54s
CI / build (pull_request) Successful in 20s
CI / helm (pull_request) Successful in 32s
CI / unit_tests (pull_request) Successful in 7m1s
CI / e2e_tests (pull_request) Successful in 17m26s
CI / integration_tests (pull_request) Successful in 23m31s
CI / coverage (pull_request) Successful in 11m6s
CI / docker (pull_request) Successful in 1m20s
CI / status-check (pull_request) Successful in 2s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 58m2s

- Implemented branch naming change in GitWorktreeSandbox.create() from sandbox/<plan_id> to cleveragents/plan-<plan_id>, located in src/cleveragents/infrastructure/sandbox/git_worktree.py
- Updated the create() method docstring to reflect the new branch naming convention
- Updated test fixtures:
  - features/steps/git_worktree_coverage_boost_steps.py: sandbox/test -> cleveragents/plan-test, sandbox/cleanup-test -> cleveragents/plan-cleanup-test, sandbox/branch-delete-fail -> cleveragents/plan-branch-delete-fail
- Updated scenario:
  - features/garbage_collection.feature: sandbox/test-plan -> cleveragents/plan-test-plan
- Design rationale:
  - Adopted the spec-required format: cleveragents/plan-{safe_plan_id} to align with the spec-defined namespace for all CleverAgents-managed git branches
  - Ensures consistent branch naming across code, tests, and features for easier policy enforcement and maintainability

ISSUES CLOSED: #2601
This commit is contained in:
2026-04-05 08:29:55 +00:00
parent 1411adfed3
commit 4b9798bc40
3 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ Feature: CONC3 - Garbage collection and cleanup
And the cleanup summary should report 1 sandbox removed
Scenario: Git worktree sandbox cleanup removes branch
Given a stale git worktree sandbox with branch "sandbox/test-plan"
Given a stale git worktree sandbox with branch "cleveragents/plan-test-plan"
When I purge stale sandboxes
Then the worktree directory should be removed
And the cleanup summary should report 1 sandbox removed
@@ -207,7 +207,7 @@ def step_gwtcb_commit_modified_diff(ctx: Context) -> None:
# Set sandbox to ACTIVE with valid worktree/branch
ctx.gwtcb_sandbox._status = SandboxStatus.ACTIVE
ctx.gwtcb_sandbox._worktree_path = repo_dir
ctx.gwtcb_sandbox._branch_name = "sandbox/test"
ctx.gwtcb_sandbox._branch_name = "cleveragents/plan-test"
ctx.gwtcb_sandbox._base_commit = "abc123"
ctx.gwtcb_sandbox._original_branch = "main"
@@ -284,7 +284,7 @@ def step_gwtcb_active_ready_commit(ctx: Context) -> None:
ctx.gwtcb_sandbox._status = SandboxStatus.ACTIVE
ctx.gwtcb_sandbox._worktree_path = repo_dir
ctx.gwtcb_sandbox._branch_name = "sandbox/test"
ctx.gwtcb_sandbox._branch_name = "cleveragents/plan-test"
ctx.gwtcb_sandbox._base_commit = "abc123"
ctx.gwtcb_sandbox._original_branch = "main"
@@ -436,7 +436,7 @@ def step_gwtcb_cleanup_worktree_exists(ctx: Context) -> None:
worktree_dir = tempfile.mkdtemp(prefix="gwtcb-worktree-")
ctx.gwtcb_sandbox._status = SandboxStatus.ACTIVE
ctx.gwtcb_sandbox._worktree_path = worktree_dir
ctx.gwtcb_sandbox._branch_name = "sandbox/cleanup-test"
ctx.gwtcb_sandbox._branch_name = "cleveragents/plan-cleanup-test"
@given("gwtcb _run_git is mocked to fail on worktree remove")
@@ -488,7 +488,7 @@ def step_gwtcb_cleanup_no_worktree_dir(ctx: Context) -> None:
# so the worktree removal block is skipped
ctx.gwtcb_sandbox._status = SandboxStatus.ACTIVE
ctx.gwtcb_sandbox._worktree_path = "/tmp/nonexistent-gwtcb-worktree"
ctx.gwtcb_sandbox._branch_name = "sandbox/branch-delete-fail"
ctx.gwtcb_sandbox._branch_name = "cleveragents/plan-branch-delete-fail"
@given("gwtcb _run_git is mocked to fail on branch delete")
@@ -168,7 +168,7 @@ class GitWorktreeSandbox:
def create(self, plan_id: str) -> SandboxContext:
"""Create a git worktree for isolated modifications.
Creates a new branch ``sandbox/<plan_id>`` and a worktree at a
Creates a new branch ``cleveragents/plan-<plan_id>`` and a worktree at a
temporary directory. The worktree starts from the current HEAD
of the repository.
@@ -226,7 +226,7 @@ class GitWorktreeSandbox:
# Create a sanitised branch name
safe_plan_id = _sanitise_branch_name(plan_id)
self._branch_name = f"sandbox/{safe_plan_id}"
self._branch_name = f"cleveragents/plan-{safe_plan_id}"
# Create a temporary directory for the worktree
self._worktree_path = tempfile.mkdtemp(prefix=f"ca-sandbox-{safe_plan_id}-")