6.2 KiB
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, correctentry.get('kind')data key. This is the version Python actually uses. _show_menuscallback (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)
-
Dead
_render_comms_history_panelat lines 3041-3073: Python silently discards the first definition when the second (3435) is encountered. The dead version uses the staleentry.get('type')key (current data model useskind), callsself._cb_load_prior_log()(method does not exist — correct name iscb_load_prior_log), and usesbegin_child("scroll_area")which collides with the ID used in_render_tool_calls_panel. This is ~33 lines of noise that misleads future workers. -
Dead inline
begin_main_menu_bar()block at lines 1680-1705: HelloImGui renders the main menu bar before invokingshow_gui(_gui_func). By the time_gui_funcruns, the menubar is already committed;imgui.begin_main_menu_bar()returnsFalse, so the entire 26-line block never executes. Consequences:- The "manual slop" > "Quit" menu item (sets
self.should_quit = True) is dead —should_quitis 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 directai_client.reset_session()call.
- The "manual slop" > "Quit" menu item (sets
-
Duplicate
__init__state assignments at lines 308-311:ui_conductor_setup_summary,ui_new_track_name,ui_new_track_desc,ui_new_track_typeare 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. -
Redundant double "Token Budget" labels in
_render_provider_panel(lines 2741-2743):imgui.text("Token Budget:")followed byimgui.separator()followed byimgui.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 nocollapsing_header("Token Budget")in_gui_func; the panel is embedded inside the "Provider & Model" collapsing section with duplicate labels. -
Missing "Quit" in live
_show_menus: The only functional quit path is the window close button. HelloImGui's proper quit API isrunner_params.app_shall_exit = True(accessible viaself.runner_params.app_shall_exit).
Goals
- Remove dead
_render_comms_history_panelduplicate (lines 3041-3073). - Remove dead inline
begin_main_menu_bar()block (lines 1680-1705). - Add working "Quit" to
_show_menususingself.runner_params.app_shall_exit = True. - Remove duplicate
__init__state assignments (lines 308-311). - Fix double "Token Budget" labels; give the panel its own
collapsing_headerin AI Settings.
Functional Requirements
Phase 1 — Dead Code Removal
- Delete lines 3041-3073 (
_render_comms_history_panelfirst definition) fromgui_2.pyentirely. 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# ---- Menubarcomment 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 setsself.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 theself._render_token_budget_panel()call. The separator before them (line ~2740) should remain to close off the Telemetry section cleanly. - In
_gui_funcAI Settings window (around lines 1719-1723), add a newcollapsing_header("Token Budget")section that callsself._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 -qto verify no test regressions. - Each phase should be committed independently for clean git history.
Architecture Reference
- docs/guide_architecture.md: HelloImGui runner params, callback lifecycle
- conductor/workflow.md: Task lifecycle and TDD protocol
Out of Scope
- Refactoring
_render_mma_dashboardcontent organization. - Changing
mma_tier_usagedefault model names (runtime concern, not code quality). - The
mma_agent_focus_uxtrack (planned separately in TASKS.md). - Any new feature work.