fix-tui-perf-2

Fix: TUI perf (RETRY) — apply 6 prioritized fixes from diagnose-tui-scales; STAY IN SCOPE

Metadata

Statusdone
Assignedagent-1495
Agent identityf51439356729d112a6c404803d88015d5b44832c6c584c62b96732b63c2b0c7e
Created2026-05-02T02:47:10.538824025+00:00
Started2026-05-02T02:48:13.160981024+00:00
Completed2026-05-02T03:42:59.005172205+00:00
Tagspriority-high,fix,perf,tui,retry, eval-scheduled
Eval score0.73
└ blocking impact0.80
└ completeness0.65
└ constraint fidelity0.40
└ coordination overhead0.85
└ correctness0.75
└ downstream usability0.70
└ efficiency0.75
└ intent fidelity0.73
└ style adherence0.75

Description

Description

fix-tui-perf (agent-1398) failed catastrophically — agent went off-scope, deleted 1265 lines including html assets and integration tests, never reached wg done. Redoing with explicit scope guardrails.

STRICT SCOPE — ONLY THESE FILES MAY BE MODIFIED

The diagnose (diagnose-tui-scales) names exact file:line targets. Touch ONLY these:

  • src/messages.rs (lines ~207-256, ~667-713) — message_stats fold-into-one
  • src/commands/viz/mod.rs (lines ~646-756) — token_usage caching
  • src/tui/viz_viewer/state.rs (lines ~7092-7250, ~7815-7835, ~10857+) — fs watcher, sort_mode, agent streams
  • src/tui/viz_viewer/event.rs (lines ~256-341, ~627-637) — main loop decoupling
  • src/graph.rs (line ~914) — parse_token_usage_live caching
  • tests/ — ADD new bench files; DO NOT MODIFY OR DELETE existing tests
  • tests/smoke/manifest.toml + scenarios/ — ADD new smoke scenarios; DO NOT remove existing

DO NOT touch:

  • src/html.rs, src/html_assets/* — html surface is unrelated
  • tests/integration_html.rs — unrelated
  • tests/smoke/scenarios/wg_html_* — unrelated
  • Any font bundle, asset, or scaffolding

If the agent finds itself wanting to delete files or refactor outside this list, that's a sign it's gone off-scope. STOP and post a wg log entry asking for clarification rather than continuing.

The 6 fixes (read diagnose-tui-scales for full spec)

  1. Cache message_stats + coordinator_message_status per (task_id, mtime); fold to single read
  2. Cache live_token_usage + agency_token_usage per (agent_id, log_mtime)
  3. Eliminate second graph load in apply_sort_mode StatusGrouped
  4. Throttle viz regen to ~5fps (debounce maybe_refresh)
  5. Decouple chat PTY render from graph render — input-latency killer
  6. Per-agent tail thread for stream parsing

Validation

  • Failing tests/benchmarks written first per diagnose's A-E spec
  • Each of 6 fixes applied with file:line targeting from the diagnose
  • cargo build + cargo test pass — NO test deletions, NO test breakage
  • grep for deleted files in agent's diff: ZERO outside the strict scope list
  • All 5 benchmarks (A-E) pass per diagnose's thresholds
  • Live smoke against this project (~250 tasks, 8 agents busy): chat input latency <50ms p99, CPU stays well under 100%
  • No regression of revert-redo-fix's last_interaction_at primitive (should COMPOSE — perhaps becomes a clean cache key)
  • Permanent smoke scenarios A-E added (not modified existing scenarios)
  • cargo install --path . was run before claiming done

Process note

The previous attempt deleted html assets and tests entirely. To prevent recurrence: this task's scope is explicitly bounded to the file list above. Worker agent should verify their final diff with git diff main --stat | grep -v '^src/messages\|^src/commands/viz/mod\|^src/tui/viz_viewer\|^src/graph\|^tests/' — that grep should return zero unexpected files. If it returns anything, the work has gone off-scope and should be reset.

Also: agent must call wg done at the end (last attempt failed because agent exited without calling it). Failed-pending-eval rescue couldn't compensate.

Depends on

Required by

Log