conductor(track): Initialize track 'feature_bleed_cleanup_20260302'

This commit is contained in:
2026-03-02 11:50:46 -05:00
parent 0ad47afb21
commit 4f11d1e01d
5 changed files with 192 additions and 1 deletions

View File

@@ -0,0 +1,67 @@
# Track Specification: Feature Bleed Cleanup
## Overview
Multiple tracks added code to `gui_2.py` without removing the old versions, leaving
dead duplicate methods, conflicting menu bar designs, and redundant state initializations.
This track removes confirmed dead code, resolves the two-menubar conflict, and cleans
up the token budget layout regression — restoring a consistent, non-contradictory design state.
## Current State Audit (as of 0ad47af)
### Already Implemented (DO NOT re-implement)
- **Live comms history panel** (`_render_comms_history_panel`, `gui_2.py:3435-3560`): Full-featured version with color legend, blink effects, prior-session tinted background, correct `entry.get('kind')` data key. **This is the version Python actually uses.**
- **`_show_menus` callback** (`gui_2.py:1620-1647`): HelloImGui-registered menu callback. Has "Windows" and "Project" menus. This is what actually renders in the app menubar.
- **Token budget panel** (`_render_token_budget_panel`, `gui_2.py:2748-2819`): Fully implemented with color bar, breakdown table, trim warning, cache status. Called from within `_render_provider_panel`.
- **`__init__` first-pass state vars** (`gui_2.py:218-221`): `ui_new_track_name`, `ui_new_track_desc`, `ui_new_track_type`, `ui_conductor_setup_summary` — correct first assignment.
### Gaps / Confirmed Bugs (This Track's Scope)
1. **Dead `_render_comms_history_panel` at lines 3041-3073**: Python silently discards the first definition when the second (3435) is encountered. The dead version uses the stale `entry.get('type')` key (current data model uses `kind`), calls `self._cb_load_prior_log()` (method does not exist — correct name is `cb_load_prior_log`), and uses `begin_child("scroll_area")` which collides with the ID used in `_render_tool_calls_panel`. This is ~33 lines of noise that misleads future workers.
2. **Dead inline `begin_main_menu_bar()` block at lines 1680-1705**: HelloImGui renders the main menu bar before invoking `show_gui` (`_gui_func`). By the time `_gui_func` runs, the menubar is already committed; `imgui.begin_main_menu_bar()` returns `False`, so the entire 26-line block never executes. Consequences:
- The "manual slop" > "Quit" menu item (sets `self.should_quit = True`) is dead — `should_quit` is never checked anywhere else, so even if it ran, the app would not quit.
- The "View" menu (toggling `show_windows`) duplicates the live "Windows" menu in `_show_menus`.
- The "Project" menu duplicates the live "Project" menu in `_show_menus`, with a slightly different `_handle_reset_session()` call vs direct `ai_client.reset_session()` call.
3. **Duplicate `__init__` state assignments at lines 308-311**: `ui_conductor_setup_summary`, `ui_new_track_name`, `ui_new_track_desc`, `ui_new_track_type` are each assigned twice — first at lines 218-221, then again at 308-311. The second assignments are harmless (same values) but create false ambiguity about initialization order and intent.
4. **Redundant double "Token Budget" labels in `_render_provider_panel` (lines 2741-2743)**: `imgui.text("Token Budget:")` followed by `imgui.separator()` followed by `imgui.text("Token Budget")` followed by the panel call. Two labels appear before the panel, one with trailing colon and one without. The journal entry says "Token panel visible in AI Settings under 'Token Budget'" — but there is no `collapsing_header("Token Budget")` in `_gui_func`; the panel is embedded inside the "Provider & Model" collapsing section with duplicate labels.
5. **Missing "Quit" in live `_show_menus`**: The only functional quit path is the window close button. HelloImGui's proper quit API is `runner_params.app_shall_exit = True` (accessible via `self.runner_params.app_shall_exit`).
## Goals
1. Remove dead `_render_comms_history_panel` duplicate (lines 3041-3073).
2. Remove dead inline `begin_main_menu_bar()` block (lines 1680-1705).
3. Add working "Quit" to `_show_menus` using `self.runner_params.app_shall_exit = True`.
4. Remove duplicate `__init__` state assignments (lines 308-311).
5. Fix double "Token Budget" labels; give the panel its own `collapsing_header` in AI Settings.
## Functional Requirements
### Phase 1 — Dead Code Removal
- Delete lines 3041-3073 (`_render_comms_history_panel` first definition) from `gui_2.py` entirely. Do not replace — the live version at (renumbered) ~3400 is the only version needed.
- Delete lines 308-311 (second assignments of `ui_new_track_name`, `ui_new_track_desc`, `ui_new_track_type`, `ui_conductor_setup_summary`) from `__init__`. Keep the first assignments at lines 218-221.
### Phase 2 — Menu Bar Consolidation
- Delete lines 1680-1705 (the dead `if imgui.begin_main_menu_bar(): ... imgui.end_main_menu_bar()` block) from `_gui_func`. The `# ---- Menubar` comment at line 1679 must also be removed.
- In `_show_menus` (lines 1620-1647), add a "manual slop" menu before the existing menus, containing a "Quit" item that sets `self.runner_params.app_shall_exit = True`.
### Phase 3 — Token Budget Layout Fix
- In `_render_provider_panel` (lines ~2741-2744): remove the two text labels (`imgui.text("Token Budget:")`, `imgui.separator()`, `imgui.text("Token Budget")`) and the `self._render_token_budget_panel()` call. The separator before them (line ~2740) should remain to close off the Telemetry section cleanly.
- In `_gui_func` AI Settings window (around lines 1719-1723), add a new `collapsing_header("Token Budget")` section that calls `self._render_token_budget_panel()`. It should appear after the "System Prompts" header.
## Non-Functional Requirements
- Zero behavior change to any feature that currently works.
- No new dependencies.
- After Phase 1-2, run `uv run pytest tests/ -x -q` to verify no test regressions.
- Each phase should be committed independently for clean git history.
## Architecture Reference
- [docs/guide_architecture.md](../../../docs/guide_architecture.md): HelloImGui runner params, callback lifecycle
- [conductor/workflow.md](../../workflow.md): Task lifecycle and TDD protocol
## Out of Scope
- Refactoring `_render_mma_dashboard` content organization.
- Changing `mma_tier_usage` default model names (runtime concern, not code quality).
- The `mma_agent_focus_ux` track (planned separately in TASKS.md).
- Any new feature work.