UAT: agents actor context clear missing --all/-a option for clearing all contexts #3138

Open
opened 2026-04-05 06:44:40 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/context-clear-add-all-flag
  • Commit Message: fix(cli): add --all/-a option to agents actor context clear command
  • Milestone: (none — backlog)
  • Parent Epic: #396

Background and Context

The agents actor context clear command is specified in docs/specification.md with the following signature:

agents actor context clear [--yes|-y] (--all|-a|<NAME>)

The spec requires two mutually exclusive targeting modes:

  1. <NAME> — clear a specific named context by name
  2. --all / -a — clear all named contexts at once

The current implementation in src/cleveragents/cli/commands/context.py (context_clear function) only supports clearing a single context by name (or the current project's context when no name is given). The --all/-a flag is entirely absent, creating a functional gap between the spec and the implementation.

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


Current Behavior

The context_clear function signature is:

@app.command("clear")
def context_clear(
    name: Annotated[
        str | None,
        typer.Argument(help="Name of the context to clear"),
    ] = None,
    yes: Annotated[
        bool, typer.Option("--yes", "-y", help="Skip confirmation prompt")
    ] = False,
    context_dir: Annotated[
        Path | None,
        typer.Option(
            "--context-dir",
            help="Directory where contexts are stored",
            resolve_path=True,
        ),
    ] = None,
) -> None:

There is no --all/-a option. Running agents actor context clear --all fails with an error. When no name is provided, the command clears the current project's context rather than all named contexts.

Steps to reproduce:

  1. Run agents actor context clear --help
  2. Observe that --all/-a is not listed
  3. Run agents actor context clear --all — fails with an unrecognised option error

Expected Behavior

Per docs/specification.md, the command must accept --all/-a to target all named contexts at once:

agents actor context clear [--yes|-y] (--all|-a|<NAME>)
  • agents actor context clear mycontext — clears the named context mycontext
  • agents actor context clear --all — clears all named contexts
  • agents actor context clear -a --yes — clears all named contexts, skipping confirmation

Acceptance Criteria

  • agents actor context clear --help lists --all / -a as an option
  • agents actor context clear --all clears all named contexts (with confirmation prompt unless --yes is passed)
  • agents actor context clear -a is accepted as a short-form alias
  • --all/-a and <NAME> are mutually exclusive; providing both raises a clear error
  • Existing behaviour for agents actor context clear <NAME> is unchanged
  • All nox stages pass with coverage ≥ 97%

Supporting Information

  • Spec reference: docs/specification.mdagents actor context clear command signature
  • Affected file: src/cleveragents/cli/commands/context.py, function context_clear
  • Discovered during: UAT testing of agents actor context clear
  • Related Epic: #396 (Epic: ACMS Context Pipeline)

Subtasks

  • Add --all / -a boolean option to context_clear in src/cleveragents/cli/commands/context.py
  • Implement mutual-exclusion guard: raise a typer.BadParameter error if both --all and <NAME> are supplied
  • Implement bulk-clear logic: when --all is set, enumerate all named contexts and clear each one (respecting --yes for confirmation bypass)
  • Update --help output to reflect the new option
  • Add/update unit tests covering: --all clears all contexts, -a short form works, --all + <NAME> raises error, --all --yes skips confirmation
  • Add/update BDD scenarios in the relevant feature file for the context clear command
  • Run nox -e typecheck — confirm Pyright reports no errors
  • Run nox -e unit_tests — confirm all tests pass
  • Run nox -e coverage_report — confirm coverage ≥ 97%
  • Run nox (all default sessions) — confirm all quality gates pass

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly (fix(cli): add --all/-a option to agents actor context clear command), followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly (fix/context-clear-add-all-flag).
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass.
  • Coverage ≥ 97%.

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

## Metadata - **Branch**: `fix/context-clear-add-all-flag` - **Commit Message**: `fix(cli): add --all/-a option to agents actor context clear command` - **Milestone**: *(none — backlog)* - **Parent Epic**: #396 --- ## Background and Context The `agents actor context clear` command is specified in `docs/specification.md` with the following signature: ``` agents actor context clear [--yes|-y] (--all|-a|<NAME>) ``` The spec requires two mutually exclusive targeting modes: 1. `<NAME>` — clear a specific named context by name 2. `--all` / `-a` — clear **all** named contexts at once The current implementation in `src/cleveragents/cli/commands/context.py` (`context_clear` function) only supports clearing a single context by name (or the current project's context when no name is given). The `--all/-a` flag is entirely absent, creating a functional gap between the spec and the implementation. > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.4.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- ## Current Behavior The `context_clear` function signature is: ```python @app.command("clear") def context_clear( name: Annotated[ str | None, typer.Argument(help="Name of the context to clear"), ] = None, yes: Annotated[ bool, typer.Option("--yes", "-y", help="Skip confirmation prompt") ] = False, context_dir: Annotated[ Path | None, typer.Option( "--context-dir", help="Directory where contexts are stored", resolve_path=True, ), ] = None, ) -> None: ``` There is no `--all/-a` option. Running `agents actor context clear --all` fails with an error. When no name is provided, the command clears the current project's context rather than all named contexts. **Steps to reproduce:** 1. Run `agents actor context clear --help` 2. Observe that `--all/-a` is not listed 3. Run `agents actor context clear --all` — fails with an unrecognised option error ## Expected Behavior Per `docs/specification.md`, the command must accept `--all/-a` to target all named contexts at once: ``` agents actor context clear [--yes|-y] (--all|-a|<NAME>) ``` - `agents actor context clear mycontext` — clears the named context `mycontext` - `agents actor context clear --all` — clears **all** named contexts - `agents actor context clear -a --yes` — clears all named contexts, skipping confirmation ## Acceptance Criteria - `agents actor context clear --help` lists `--all / -a` as an option - `agents actor context clear --all` clears all named contexts (with confirmation prompt unless `--yes` is passed) - `agents actor context clear -a` is accepted as a short-form alias - `--all/-a` and `<NAME>` are mutually exclusive; providing both raises a clear error - Existing behaviour for `agents actor context clear <NAME>` is unchanged - All nox stages pass with coverage ≥ 97% ## Supporting Information - **Spec reference**: `docs/specification.md` — `agents actor context clear` command signature - **Affected file**: `src/cleveragents/cli/commands/context.py`, function `context_clear` - **Discovered during**: UAT testing of `agents actor context clear` - **Related Epic**: #396 (Epic: ACMS Context Pipeline) --- ## Subtasks - [ ] Add `--all / -a` boolean option to `context_clear` in `src/cleveragents/cli/commands/context.py` - [ ] Implement mutual-exclusion guard: raise a `typer.BadParameter` error if both `--all` and `<NAME>` are supplied - [ ] Implement bulk-clear logic: when `--all` is set, enumerate all named contexts and clear each one (respecting `--yes` for confirmation bypass) - [ ] Update `--help` output to reflect the new option - [ ] Add/update unit tests covering: `--all` clears all contexts, `-a` short form works, `--all` + `<NAME>` raises error, `--all --yes` skips confirmation - [ ] Add/update BDD scenarios in the relevant feature file for the `context clear` command - [ ] Run `nox -e typecheck` — confirm Pyright reports no errors - [ ] Run `nox -e unit_tests` — confirm all tests pass - [ ] Run `nox -e coverage_report` — confirm coverage ≥ 97% - [ ] Run `nox` (all default sessions) — confirm all quality gates pass --- ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly (`fix(cli): add --all/-a option to agents actor context clear command`), followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly (`fix/context-clear-add-all-flag`). - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass. - Coverage ≥ 97%. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.6.0 milestone 2026-04-05 06:53:15 +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
#396 Epic: ACMS Context Pipeline
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3138
No description provided.