UAT: TUI commands bypass A2A facade and call get_container() directly #10369

Open
opened 2026-04-18 09:14:30 +00:00 by HAL9000 · 0 comments
Owner

Metadata

  • Commit Message: fix(tui): route TUI commands through A2A facade instead of direct get_container() calls
  • Branch: fix/tui-commands-a2a-facade-routing

Background and Context

During UAT testing of the TuiMaterializer A2A Integration feature area, it was discovered that TUI commands bypass the A2A facade and call get_container() directly. The spec requires that TUI commands route through the A2A facade.

Evidence of the violation in src/cleveragents/tui/commands.py:

  1. TuiCommandRouter._resolve_container() (line ~35):

    def _resolve_container(self) -> Any:
        if self.container_factory is not None:
            return self.container_factory()
        return get_container()  # ← direct DI container call, bypasses A2A facade
    
  2. run_tui() (line ~180):

    def run_tui(*, headless: bool = False) -> int:
        container = get_container()  # ← direct DI container call
        registry = container.persona_registry()
        state = container.persona_state(registry=registry)
        ...
    

The _session_export and _session_import methods also call self._resolve_container() which ultimately calls get_container() directly.

Expected Behavior (from spec)

Per the TuiMaterializer A2A Integration specification:

  • TUI commands must route through the A2A facade (A2aLocalFacade) for all operations
  • Direct calls to get_container() in the TUI command layer are prohibited
  • Session operations (export, import) must use A2A facade operations (e.g., session.create, session.close)
  • The A2A facade provides the correct abstraction layer between the TUI and application services

Actual Behavior

  • TuiCommandRouter._resolve_container() calls get_container() directly
  • run_tui() calls get_container() directly
  • Session export/import operations bypass the A2A facade
  • No A2aLocalFacade instance is used anywhere in the TUI command layer

Steps to Reproduce

  1. Inspect src/cleveragents/tui/commands.py
  2. Search for get_container() calls
  3. Observe: 2 direct calls to get_container() exist, with no A2A facade routing

Acceptance Criteria

  • TuiCommandRouter accepts an A2aLocalFacade instance instead of a container_factory
  • All TUI command operations route through A2aLocalFacade.dispatch()
  • run_tui() creates an A2aLocalFacade instance and passes it to TuiCommandRouter
  • No direct calls to get_container() remain in src/cleveragents/tui/commands.py
  • Session export/import operations use A2A facade operations
  • All existing TUI command tests continue to pass
  • New Behave BDD scenarios verify A2A facade routing
  • Coverage remains >= 97%

Subtasks

  • Refactor TuiCommandRouter to accept A2aLocalFacade instead of container_factory
  • Update TuiCommandRouter.handle() to dispatch via A2aLocalFacade
  • Update run_tui() to create and wire A2aLocalFacade
  • Remove direct get_container() calls from commands.py
  • Update existing Behave BDD scenarios to use A2A facade mocks
  • Add new Behave BDD scenarios verifying A2A facade routing
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

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, 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.
  • 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 Test Pool | Agent: uat-test-pool-supervisor

## Metadata - **Commit Message**: `fix(tui): route TUI commands through A2A facade instead of direct get_container() calls` - **Branch**: `fix/tui-commands-a2a-facade-routing` ## Background and Context During UAT testing of the TuiMaterializer A2A Integration feature area, it was discovered that TUI commands bypass the A2A facade and call `get_container()` directly. The spec requires that TUI commands route through the A2A facade. Evidence of the violation in `src/cleveragents/tui/commands.py`: 1. **`TuiCommandRouter._resolve_container()`** (line ~35): ```python def _resolve_container(self) -> Any: if self.container_factory is not None: return self.container_factory() return get_container() # ← direct DI container call, bypasses A2A facade ``` 2. **`run_tui()`** (line ~180): ```python def run_tui(*, headless: bool = False) -> int: container = get_container() # ← direct DI container call registry = container.persona_registry() state = container.persona_state(registry=registry) ... ``` The `_session_export` and `_session_import` methods also call `self._resolve_container()` which ultimately calls `get_container()` directly. ## Expected Behavior (from spec) Per the TuiMaterializer A2A Integration specification: - TUI commands must route through the A2A facade (`A2aLocalFacade`) for all operations - Direct calls to `get_container()` in the TUI command layer are prohibited - Session operations (export, import) must use A2A facade operations (e.g., `session.create`, `session.close`) - The A2A facade provides the correct abstraction layer between the TUI and application services ## Actual Behavior - `TuiCommandRouter._resolve_container()` calls `get_container()` directly - `run_tui()` calls `get_container()` directly - Session export/import operations bypass the A2A facade - No `A2aLocalFacade` instance is used anywhere in the TUI command layer ## Steps to Reproduce 1. Inspect `src/cleveragents/tui/commands.py` 2. Search for `get_container()` calls 3. Observe: 2 direct calls to `get_container()` exist, with no A2A facade routing ## Acceptance Criteria - [ ] `TuiCommandRouter` accepts an `A2aLocalFacade` instance instead of a `container_factory` - [ ] All TUI command operations route through `A2aLocalFacade.dispatch()` - [ ] `run_tui()` creates an `A2aLocalFacade` instance and passes it to `TuiCommandRouter` - [ ] No direct calls to `get_container()` remain in `src/cleveragents/tui/commands.py` - [ ] Session export/import operations use A2A facade operations - [ ] All existing TUI command tests continue to pass - [ ] New Behave BDD scenarios verify A2A facade routing - [ ] Coverage remains >= 97% ## Subtasks - [ ] Refactor `TuiCommandRouter` to accept `A2aLocalFacade` instead of `container_factory` - [ ] Update `TuiCommandRouter.handle()` to dispatch via `A2aLocalFacade` - [ ] Update `run_tui()` to create and wire `A2aLocalFacade` - [ ] Remove direct `get_container()` calls from `commands.py` - [ ] Update existing Behave BDD scenarios to use A2A facade mocks - [ ] Add new Behave BDD scenarios verifying A2A facade routing - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## 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, 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. - 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 Test Pool | Agent: uat-test-pool-supervisor
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.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#10369
No description provided.