UAT: Duplicate context subcommand registration conflict in agents actor CLI causes undefined behavior #3149

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

Metadata

  • Branch: fix/backlog-actor-context-duplicate-subcommand-registration
  • Commit Message: fix(cli): remove duplicate context subcommand registration from agents actor CLI
  • Milestone: (none — backlog)
  • Parent Epic: #396

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.

Background and Context

The agents actor context command group has two separate Typer apps both registered under the name "context", creating a routing conflict with undefined behavior. When Typer has two sub-apps registered under the same name, one may shadow the other, or commands may be duplicated or missing entirely.

Current Behavior

Registration 1 — in src/cleveragents/cli/commands/actor.py (near end of file):

from cleveragents.cli.commands.actor_context import app as actor_context_app
...
app.add_typer(actor_context_app, name="context")

This registers actor_context.py's app, which has remove, export, import commands backed by ContextManager.

Registration 2 — in src/cleveragents/cli/main.py:

actor.app.add_typer(
    context.app,
    name="context",
    help="Actor context management commands",
)

This registers context.py's app, which has list, show, clear, add, remove, export, import, delete commands backed by ContextService/ProjectService.

Code Locations

File Issue
src/cleveragents/cli/commands/actor.py Line near end: app.add_typer(actor_context_app, name="context") — first duplicate registration
src/cleveragents/cli/main.py actor.app.add_typer(context.app, name="context", ...) — second duplicate registration
src/cleveragents/cli/commands/actor_context.py First registered app (remove, export, import via ContextManager)
src/cleveragents/cli/commands/context.py Second registered app (list, show, clear, add, remove, export, import via ContextService/ProjectService)

Expected Behavior (from spec)

The agents actor context command group should have a single, well-defined set of subcommands: list, show, clear, add, remove, export, import — all routed through a single Typer app backed by the canonical ContextService/ProjectService implementation in context.py.

Impact

  1. Users may get unexpected or non-deterministic behavior when running agents actor context commands
  2. The list, show, clear, add commands from context.py may be inaccessible if actor_context.py shadows them
  3. The remove, export, import commands exist in both apps with different implementations (different backing APIs), creating ambiguity about which implementation is invoked
  4. actor_context.py appears to be a legacy/alternative implementation; context.py is the canonical path per its docstring and service usage

Subtasks

  • Investigate which registration wins at runtime (add a test or manual verification)
  • Confirm context.py is the canonical implementation (per spec and service layer)
  • Remove the duplicate app.add_typer(actor_context_app, name="context") call from src/cleveragents/cli/commands/actor.py
  • Verify actor_context.py is either deleted or repurposed (not registered under "context")
  • Ensure all spec-required subcommands (list, show, clear, add, remove, export, import) are accessible via agents actor context after the fix
  • Tests (Behave): Add/update BDD scenarios asserting all agents actor context subcommands are reachable and route to the correct implementation
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

  • Only one Typer app is registered as "context" under actor.app — the canonical context.py app
  • All spec-required subcommands (list, show, clear, add, remove, export, import) are accessible and functional via agents actor context
  • The legacy actor_context.py registration is removed or the file is repurposed without conflicting registration
  • BDD scenarios cover all agents actor context subcommands
  • All nox stages pass
  • Coverage >= 97%
  • A Git commit is created where the first line of the commit message matches fix(cli): remove duplicate context subcommand registration from agents actor CLI exactly, followed by a blank line, then additional details about the implementation.
  • The commit is pushed to the remote on the branch fix/backlog-actor-context-duplicate-subcommand-registration exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.

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

## Metadata - **Branch**: `fix/backlog-actor-context-duplicate-subcommand-registration` - **Commit Message**: `fix(cli): remove duplicate context subcommand registration from agents actor CLI` - **Milestone**: *(none — backlog)* - **Parent Epic**: #396 > **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. ## Background and Context The `agents actor context` command group has two separate Typer apps both registered under the name `"context"`, creating a routing conflict with undefined behavior. When Typer has two sub-apps registered under the same name, one may shadow the other, or commands may be duplicated or missing entirely. ## Current Behavior **Registration 1** — in `src/cleveragents/cli/commands/actor.py` (near end of file): ```python from cleveragents.cli.commands.actor_context import app as actor_context_app ... app.add_typer(actor_context_app, name="context") ``` This registers `actor_context.py`'s app, which has `remove`, `export`, `import` commands backed by `ContextManager`. **Registration 2** — in `src/cleveragents/cli/main.py`: ```python actor.app.add_typer( context.app, name="context", help="Actor context management commands", ) ``` This registers `context.py`'s app, which has `list`, `show`, `clear`, `add`, `remove`, `export`, `import`, `delete` commands backed by `ContextService`/`ProjectService`. ### Code Locations | File | Issue | |------|-------| | `src/cleveragents/cli/commands/actor.py` | Line near end: `app.add_typer(actor_context_app, name="context")` — first duplicate registration | | `src/cleveragents/cli/main.py` | `actor.app.add_typer(context.app, name="context", ...)` — second duplicate registration | | `src/cleveragents/cli/commands/actor_context.py` | First registered app (`remove`, `export`, `import` via `ContextManager`) | | `src/cleveragents/cli/commands/context.py` | Second registered app (`list`, `show`, `clear`, `add`, `remove`, `export`, `import` via `ContextService`/`ProjectService`) | ## Expected Behavior (from spec) The `agents actor context` command group should have a single, well-defined set of subcommands: `list`, `show`, `clear`, `add`, `remove`, `export`, `import` — all routed through a single Typer app backed by the canonical `ContextService`/`ProjectService` implementation in `context.py`. ## Impact 1. Users may get unexpected or non-deterministic behavior when running `agents actor context` commands 2. The `list`, `show`, `clear`, `add` commands from `context.py` may be inaccessible if `actor_context.py` shadows them 3. The `remove`, `export`, `import` commands exist in **both** apps with different implementations (different backing APIs), creating ambiguity about which implementation is invoked 4. `actor_context.py` appears to be a legacy/alternative implementation; `context.py` is the canonical path per its docstring and service usage ## Subtasks - [ ] Investigate which registration wins at runtime (add a test or manual verification) - [ ] Confirm `context.py` is the canonical implementation (per spec and service layer) - [ ] Remove the duplicate `app.add_typer(actor_context_app, name="context")` call from `src/cleveragents/cli/commands/actor.py` - [ ] Verify `actor_context.py` is either deleted or repurposed (not registered under `"context"`) - [ ] Ensure all spec-required subcommands (`list`, `show`, `clear`, `add`, `remove`, `export`, `import`) are accessible via `agents actor context` after the fix - [ ] Tests (Behave): Add/update BDD scenarios asserting all `agents actor context` subcommands are reachable and route to the correct implementation - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done - [ ] Only one Typer app is registered as `"context"` under `actor.app` — the canonical `context.py` app - [ ] All spec-required subcommands (`list`, `show`, `clear`, `add`, `remove`, `export`, `import`) are accessible and functional via `agents actor context` - [ ] The legacy `actor_context.py` registration is removed or the file is repurposed without conflicting registration - [ ] BDD scenarios cover all `agents actor context` subcommands - [ ] All nox stages pass - [ ] Coverage >= 97% - [ ] A Git commit is created where the **first line** of the commit message matches `fix(cli): remove duplicate context subcommand registration from agents actor CLI` exactly, followed by a blank line, then additional details about the implementation. - [ ] The commit is pushed to the remote on the branch `fix/backlog-actor-context-duplicate-subcommand-registration` exactly. - [ ] The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.6.0 milestone 2026-04-05 07:01:53 +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#3149
No description provided.