Compare commits

..

2 Commits

3 changed files with 36 additions and 13 deletions

View File

@@ -47,6 +47,24 @@
- **Heuristics & Backlog**: Added Data-Oriented Design and Immediate Mode architectural heuristics (inspired by Muratori/Acton) to product-guidelines.md. Logged future decoupling and robust parsing tracks to a 'Future Backlog' in TASKS.md.
---
## 2026-03-02 (Session 4)
### Track: mma_agent_focus_ux_20260302 — Completed |TASK:mma_agent_focus_ux_20260302|
- **What**: Per-tier agent focus UX — source_tier tagging + Focus Agent filter UI (all 3 phases)
- **Why**: All MMA observability panels were global/session-scoped; traffic from Tier 2/3/4 was indistinguishable
- **How**:
- Phase 1: Added `current_tier: str | None` module var to `ai_client.py`; `_append_comms` stamps `source_tier: current_tier` on every comms entry; `run_worker_lifecycle` sets `"Tier 3"` / `generate_tickets` sets `"Tier 2"` around `send()` calls, clears in `finally`; `_on_tool_log` captures `current_tier` at call time; `_append_tool_log` migrated from tuple to dict with `source_tier` field; `_pending_tool_calls` likewise. Checkpoint: bc1a570
- Phase 2: `_render_tool_calls_panel` migrated from tuple destructure to dict access. Checkpoint: 865d8dd
- Phase 3: `ui_focus_agent: str | None` state var added; Focus Agent combo (All/Tier2/3/4) + clear button above OperationsTabs; filter logic in `_render_comms_history_panel` and `_render_tool_calls_panel`; `[source_tier]` label per comms entry header. Checkpoint: b30e563
- **Issues**:
- `claude_mma_exec.py` fails with nested session block — user authorized inline implementation for this track
- Task 2.1 set_file_slice applied at shifted line, leaving stale tuple destructure + missing `i = i_minus_one + 1`; caught and fixed in Phase 3 Task 3.4
- **Known limitation**: `current_tier` is a module-level `str | None` — safe only because MMA engine serializes `send()` calls. Concurrent Tier 3/4 agents (future) will require `threading.local()` or per-ticket context passing. Logged to backlog.
- **Verification gap noted**: No API hook endpoints expose `ui_focus_agent` state for automated testing. Future tracks should wire widget state to `_settable_fields` for `live_gui` fixture verification. Logged to backlog.
- **Result**: 18 tests passing. Focus Agent combo visible in Operations Hub. Comms entries show `[main]`/`[Tier N]` labels. Meta-Level Sanity Check: 53 ruff errors in gui_2.py before and after — zero new violations.
---
## 2026-03-02 (Session 3)
### Track: feature_bleed_cleanup_20260302 — Completed |TASK:feature_bleed_cleanup_20260302|

View File

@@ -6,12 +6,14 @@
*(none — all planned tracks queued below)*
## Completed This Session
- `mma_agent_focus_ux_20260302` — Per-tier source_tier tagging on comms+tool entries; Focus Agent combo UI; filter logic in comms+tool panels; [tier] label per comms entry. 18 tests. Checkpoint: b30e563.
- `feature_bleed_cleanup_20260302` — Removed dead comms panel dup, dead menubar block, duplicate __init__ vars; added working Quit; fixed Token Budget layout. All phases verified. Checkpoint: 0d081a2.
- `context_token_viz_20260301` — Token budget panel (color bar, breakdown table, trim warning, cache status, auto-refresh). All phases verified. Commit: d577457.
## Planned: Next Track
### `mma_agent_focus_ux_20260302` (initialized — run after bleed cleanup)
### `mma_agent_focus_ux_20260302` — COMPLETED (b30e563)
~~(initialized — run after bleed cleanup)~~
**Priority:** High
**Depends on:** `feature_bleed_cleanup_20260302` Phase 1 (dead comms panel removed)
**Track dir:** `conductor/tracks/mma_agent_focus_ux_20260302/`
@@ -105,6 +107,14 @@ To ensure smooth execution, execute the tracks in the following order:
**Context:** Running `uv run ruff check .` and `uv run mypy --explicit-package-bases .` revealed massive technical debt in type safety (512+ Mypy errors across 64 files, 200+ remaining Ruff violations). The `gui_2.py` and `api_hook_client.py` files specifically have severe "Any" bleeding and incorrect unions.
**Goal:** Resolve all static analysis errors. Enforce strict `mypy` compliance, remove implicit `Optional` types, and fix ambiguous variables (`l`). Integrate `ruff` and `mypy` into a CI pre-commit hook so Tier 3 workers are forced to write type-safe code going forward.
### `hook_api_ui_state_verification`
**Context:** Manual verification of UI widget state is difficult and unreliable. `live_gui` fixture + `ApiHookClient` exist but new widget state vars (e.g. `ui_focus_agent`) are not wired to `_settable_fields` or GET endpoints. Future tracks must add state to `_settable_fields` and write `live_gui`-based tests instead of relying on user confirmation.
**Goal:** Add `ui_focus_agent` (and a standard pattern for future widgets) to `_settable_fields`; add a `/api/gui/state` GET endpoint returning key UI vars; write `live_gui` integration test for Focus Agent filter.
### `concurrent_tier_source_tier`
**Context:** `ai_client.current_tier` is a module-level `str | None`. Safe today because the MMA engine serializes `send()` calls. When concurrent Tier 3/4 agents run in parallel (multiple tickets processed simultaneously), this will produce incorrect tier tags.
**Goal:** Replace with `threading.local()` storage or pass `source_tier` explicitly through the `send()` call signature so each concurrent agent self-identifies without sharing module state.
### `test_suite_performance_and_flakiness`
**Context:** Running `uv run pytest` takes over 5.0 minutes to execute and frequently hangs on integration tests (e.g. `test_spawn_interception.py`). Several simulation tests (`test_sim_ai_settings.py`, `test_extended_sims.py`) are also currently failing or timing out.
**Goal:** Audit the test suite for `time.sleep()` abuse. Replace hardcoded sleeps with `threading.Event()` hooks or robust polling. Isolate slow integration tests with `@pytest.mark.slow` and ensure the core unit test suite runs in under 10 seconds to maintain high-velocity TDD.

View File

@@ -45,16 +45,11 @@ Focus: Update `_render_tool_calls_panel` to read dicts. No UI change — just fi
---
## Phase 3: Focus Agent UI + Filter Logic
## Phase 3: Focus Agent UI + Filter Logic [checkpoint: b30e563]
Focus: Add the combo selector and filter the two log panels.
- [ ] Task 3.1: Add `ui_focus_agent` state var to `App.__init__`.
- **Location**: `gui_2.py` `__init__`, after `self.active_tier: str | None = None` (line ~283 — confirm with `grep -n "self.active_tier" gui_2.py`).
- **What**: Insert `self.ui_focus_agent: str | None = None`.
- **How**: Use `Edit`.
- **Verify**: `grep -n "ui_focus_agent" gui_2.py` returns exactly 1 hit (the new line, before Phase 3.3 adds more).
- [ ] Task 3.2: Add Focus Agent selector widget in Operations Hub.
- [x] Task 3.1: Add `ui_focus_agent` state var to `App.__init__`. b30e563
- [x] Task 3.2: Add Focus Agent selector widget in Operations Hub. b30e563
- **Location**: `gui_2.py` `_gui_func`, Operations Hub block (line ~1774). Confirm with `get_file_slice(1774, 1792)`. Current content:
```python
if imgui.begin_tab_bar("OperationsTabs"):
@@ -80,7 +75,7 @@ Focus: Add the combo selector and filter the two log panels.
- **Note**: Tier 1 omitted — Tier 1 (Claude Code) never calls `ai_client.send()`, so it produces no comms entries.
- **How**: Use `Edit`.
- [ ] Task 3.3: Add filter logic to `_render_comms_history_panel`.
- [x] Task 3.3: Add filter logic to `_render_comms_history_panel`. b30e563
- **Location**: `gui_2.py` `_render_comms_history_panel` (after bleed cleanup, line ~3400). Confirm with `py_get_definition`.
- **What**: After the `log_to_render = self.prior_session_entries if self.is_viewing_prior_session else list(self._comms_log)` line, add:
```python
@@ -96,7 +91,7 @@ Focus: Add the combo selector and filter the two log panels.
Insert this after the `imgui.text_colored(C_LBL, f"{entry.get('provider', '?')}/{entry.get('model', '?')}")` line.
- **How**: Use `Edit` for each insertion.
- [ ] Task 3.4: Add filter logic to `_render_tool_calls_panel`.
- [x] Task 3.4: Add filter logic to `_render_tool_calls_panel`. b30e563
- **Location**: `gui_2.py:2989`. Confirm with `get_file_slice(2989, 3000)`.
- **What**: After `imgui.begin_child("scroll_area")` + clipper setup, change the render source:
- Replace `clipper.begin(len(self._tool_log))` with a pre-filtered list:
@@ -109,11 +104,11 @@ Focus: Add the combo selector and filter the two log panels.
- Inside the loop use `tool_log_filtered[i_minus_one]` instead of `self._tool_log[i_minus_one]`.
- **How**: Use `Edit`.
- [ ] Task 3.5: Write tests for Phase 3.
- [x] Task 3.5: Write tests for Phase 3. 6 tests, 18/18 passed. b30e563
- Test that `ui_focus_agent = "Tier 3"` filters out entries with `source_tier = "Tier 2"`.
- Run `uv run pytest tests/ -x -q`.
- [ ] Task 3.6: Conductor — User Manual Verification
- [x] Task 3.6: Conductor — User Manual Verification. UI confirmed by user. b30e563
- Launch app. Open Operations Hub.
- Confirm "Focus Agent:" combo appears above tabs with options: All, Tier 2, Tier 3, Tier 4.
- With "All" selected: all entries show with `[main]` or `[Tier N]` labels in comms history.