UAT: agents cleanup status does not display sandbox.cleanup policy setting #3985

Open
opened 2026-04-06 08:17:17 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/cleanup-status-missing-sandbox-cleanup-policy
  • Commit Message: fix(cli): display sandbox.cleanup policy in agents cleanup status output
  • Milestone: (backlog — no milestone assigned)
  • Parent Epic: #365 (Epic: Concurrency & Cleanup — closed; no active replacement epic found)

Backlog note: This issue was discovered during autonomous operation
on milestone v3.7.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.

Background and Context

The agents cleanup status command displays retention policies to operators. The sandbox.cleanup configuration key is defined in docs/specification.md and registered in ConfigService._REGISTRY, but it is absent from the Settings pydantic-settings class. Because cleanup status reads from get_settings() rather than ConfigService, the sandbox.cleanup policy value is never surfaced in the command output.

Per docs/specification.md configuration table:

| `sandbox.cleanup` | string | `on_apply` | `CLEVERAGENTS_SANDBOX_CLEANUP` | When to clean up sandbox working directories. Accepted values: `on_apply` (clean up after successful apply), `on_terminal` (clean up when plan reaches any terminal state — applied, cancelled, or failed), `manual` (never auto-clean; user must delete). |

The sandbox.cleanup setting is registered in src/cleveragents/application/services/config_service.py:

_register(
    "sandbox",
    "cleanup",
    str,
    "on_apply",
    project_scopable=False,
    env_var="CLEVERAGENTS_SANDBOX_CLEANUP",
    description="When to clean up sandbox: on_apply, on_terminal, manual.",
)

Per features/garbage_collection.feature, the cleanup status command is the canonical place to display all retention policies. The spec configuration table defines sandbox.cleanup as a key retention policy setting that should be visible to operators.

Current Behavior

The agents cleanup status command only shows:

  Sandbox max age:        48 hours
  Checkpoint max/plan:    50
  Session inactivity:     30 days
  Log retention:          30 days
  Backup retention:       7 days
  Schedule:               manual

The sandbox.cleanup policy (on_apply, on_terminal, or manual) is not displayed. This setting controls when sandbox directories are automatically cleaned up during plan execution, which is directly relevant to the cleanup status display.

Expected Behavior

The agents cleanup status command should display the sandbox.cleanup policy alongside the other retention policies, e.g.:

  Sandbox max age:        48 hours
  Sandbox cleanup policy: on_apply
  Checkpoint max/plan:    50
  Session inactivity:     30 days
  Log retention:          30 days
  Backup retention:       7 days
  Schedule:               manual

Root Cause

The cleanup status command uses get_settings() which returns a Settings (pydantic-settings) instance. The sandbox.cleanup setting is registered in ConfigService._REGISTRY but there is no corresponding sandbox_cleanup field in the Settings class. This means the cleanup status command cannot display this setting without either:

  1. Adding a sandbox_cleanup field to Settings (with CLEVERAGENTS_SANDBOX_CLEANUP env var), or
  2. Refactoring cleanup status to resolve sandbox.cleanup via ConfigService instead of Settings directly.

Acceptance Criteria

  • agents cleanup status output includes a Sandbox cleanup policy: line showing the current sandbox.cleanup value (on_apply, on_terminal, or manual).
  • The displayed value reflects the CLEVERAGENTS_SANDBOX_CLEANUP environment variable when set.
  • The displayed value falls back to the spec default (on_apply) when the env var is not set.
  • The features/garbage_collection.feature scenario CLI status command shows retention policies is updated to assert the new line is present.
  • All nox stages pass and coverage remains ≥ 97%.

Subtasks

  • Add sandbox_cleanup: str field to Settings in src/cleveragents/config/settings.py with env="CLEVERAGENTS_SANDBOX_CLEANUP" and default "on_apply"
  • Update cleanup status in src/cleveragents/cli/commands/cleanup.py to read and display settings.sandbox_cleanup as Sandbox cleanup policy:
  • Update features/garbage_collection.feature — add And the cleanup CLI output should contain "Sandbox cleanup policy" to the CLI status command shows retention policies scenario
  • Update Behave step definitions if needed to support the new assertion
  • Run nox -e typecheck and resolve any Pyright errors
  • Run nox -e unit_tests and confirm all tests pass
  • Run nox -e coverage_report and confirm coverage ≥ 97%

Definition of Done

  • All subtasks above are checked off
  • A Git commit is created with the exact first line: fix(cli): display sandbox.cleanup policy in agents cleanup status output
  • The commit is pushed to branch fix/cleanup-status-missing-sandbox-cleanup-policy
  • A pull request is created, reviewed (≥ 2 approvals), and merged
  • All nox stages pass
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/cleanup-status-missing-sandbox-cleanup-policy` - **Commit Message**: `fix(cli): display sandbox.cleanup policy in agents cleanup status output` - **Milestone**: *(backlog — no milestone assigned)* - **Parent Epic**: #365 (Epic: Concurrency & Cleanup — closed; no active replacement epic found) > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.7.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. ## Background and Context The `agents cleanup status` command displays retention policies to operators. The `sandbox.cleanup` configuration key is defined in `docs/specification.md` and registered in `ConfigService._REGISTRY`, but it is absent from the `Settings` pydantic-settings class. Because `cleanup status` reads from `get_settings()` rather than `ConfigService`, the `sandbox.cleanup` policy value is never surfaced in the command output. Per `docs/specification.md` configuration table: ``` | `sandbox.cleanup` | string | `on_apply` | `CLEVERAGENTS_SANDBOX_CLEANUP` | When to clean up sandbox working directories. Accepted values: `on_apply` (clean up after successful apply), `on_terminal` (clean up when plan reaches any terminal state — applied, cancelled, or failed), `manual` (never auto-clean; user must delete). | ``` The `sandbox.cleanup` setting is registered in `src/cleveragents/application/services/config_service.py`: ```python _register( "sandbox", "cleanup", str, "on_apply", project_scopable=False, env_var="CLEVERAGENTS_SANDBOX_CLEANUP", description="When to clean up sandbox: on_apply, on_terminal, manual.", ) ``` Per `features/garbage_collection.feature`, the `cleanup status` command is the canonical place to display all retention policies. The spec configuration table defines `sandbox.cleanup` as a key retention policy setting that should be visible to operators. ## Current Behavior The `agents cleanup status` command only shows: ``` Sandbox max age: 48 hours Checkpoint max/plan: 50 Session inactivity: 30 days Log retention: 30 days Backup retention: 7 days Schedule: manual ``` The `sandbox.cleanup` policy (`on_apply`, `on_terminal`, or `manual`) is **not displayed**. This setting controls when sandbox directories are automatically cleaned up during plan execution, which is directly relevant to the cleanup status display. ## Expected Behavior The `agents cleanup status` command should display the `sandbox.cleanup` policy alongside the other retention policies, e.g.: ``` Sandbox max age: 48 hours Sandbox cleanup policy: on_apply Checkpoint max/plan: 50 Session inactivity: 30 days Log retention: 30 days Backup retention: 7 days Schedule: manual ``` ## Root Cause The `cleanup status` command uses `get_settings()` which returns a `Settings` (pydantic-settings) instance. The `sandbox.cleanup` setting is registered in `ConfigService._REGISTRY` but there is no corresponding `sandbox_cleanup` field in the `Settings` class. This means the `cleanup status` command cannot display this setting without either: 1. Adding a `sandbox_cleanup` field to `Settings` (with `CLEVERAGENTS_SANDBOX_CLEANUP` env var), or 2. Refactoring `cleanup status` to resolve `sandbox.cleanup` via `ConfigService` instead of `Settings` directly. ## Acceptance Criteria - `agents cleanup status` output includes a `Sandbox cleanup policy:` line showing the current `sandbox.cleanup` value (`on_apply`, `on_terminal`, or `manual`). - The displayed value reflects the `CLEVERAGENTS_SANDBOX_CLEANUP` environment variable when set. - The displayed value falls back to the spec default (`on_apply`) when the env var is not set. - The `features/garbage_collection.feature` scenario `CLI status command shows retention policies` is updated to assert the new line is present. - All nox stages pass and coverage remains ≥ 97%. ## Subtasks - [ ] Add `sandbox_cleanup: str` field to `Settings` in `src/cleveragents/config/settings.py` with `env="CLEVERAGENTS_SANDBOX_CLEANUP"` and default `"on_apply"` - [ ] Update `cleanup status` in `src/cleveragents/cli/commands/cleanup.py` to read and display `settings.sandbox_cleanup` as `Sandbox cleanup policy:` - [ ] Update `features/garbage_collection.feature` — add `And the cleanup CLI output should contain "Sandbox cleanup policy"` to the `CLI status command shows retention policies` scenario - [ ] Update Behave step definitions if needed to support the new assertion - [ ] Run `nox -e typecheck` and resolve any Pyright errors - [ ] Run `nox -e unit_tests` and confirm all tests pass - [ ] Run `nox -e coverage_report` and confirm coverage ≥ 97% ## Definition of Done - [ ] All subtasks above are checked off - [ ] A Git commit is created with the exact first line: `fix(cli): display sandbox.cleanup policy in agents cleanup status output` - [ ] The commit is pushed to branch `fix/cleanup-status-missing-sandbox-cleanup-policy` - [ ] A pull request is created, reviewed (≥ 2 approvals), and merged - All nox stages pass - Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
HAL9000 added this to the v3.5.0 milestone 2026-04-09 03:12:16 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
#365 Epic: Concurrency & Cleanup
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3985
No description provided.