From 4b9798bc40b1a2cb7be2d790df88ef2334c03a33 Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman Date: Sun, 5 Apr 2026 08:29:55 +0000 Subject: [PATCH] fix(sandbox): use spec-required cleveragents/plan- branch prefix in GitWorktreeSandbox - Implemented branch naming change in GitWorktreeSandbox.create() from sandbox/ to cleveragents/plan-, 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 --- features/garbage_collection.feature | 2 +- features/steps/git_worktree_coverage_boost_steps.py | 8 ++++---- src/cleveragents/infrastructure/sandbox/git_worktree.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/features/garbage_collection.feature b/features/garbage_collection.feature index e60fa4d7a..7c32532fd 100644 --- a/features/garbage_collection.feature +++ b/features/garbage_collection.feature @@ -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 diff --git a/features/steps/git_worktree_coverage_boost_steps.py b/features/steps/git_worktree_coverage_boost_steps.py index 5bec598f4..a4b97ac43 100644 --- a/features/steps/git_worktree_coverage_boost_steps.py +++ b/features/steps/git_worktree_coverage_boost_steps.py @@ -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") diff --git a/src/cleveragents/infrastructure/sandbox/git_worktree.py b/src/cleveragents/infrastructure/sandbox/git_worktree.py index e04b6467a..790baec0a 100644 --- a/src/cleveragents/infrastructure/sandbox/git_worktree.py +++ b/src/cleveragents/infrastructure/sandbox/git_worktree.py @@ -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/`` and a worktree at a + Creates a new branch ``cleveragents/plan-`` 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}-")