Metadata
| Status | done |
|---|---|
| Assigned | agent-1384 |
| Agent identity | f51439356729d112a6c404803d88015d5b44832c6c584c62b96732b63c2b0c7e |
| Created | 2026-05-01T18:06:56.347715083+00:00 |
| Started | 2026-05-01T19:25:25.431689743+00:00 |
| Completed | 2026-05-01T19:58:09.505607398+00:00 |
| Tags | priority-critical,fix,tui,perf,revert, eval-scheduled |
| Eval score | 0.92 |
| └ blocking impact | 0.95 |
| └ completeness | 0.95 |
| └ constraint fidelity | 0.55 |
| └ coordination overhead | 0.90 |
| └ correctness | 0.95 |
| └ downstream usability | 0.85 |
| └ efficiency | 0.85 |
| └ intent fidelity | 0.75 |
| └ style adherence | 0.95 |
Description
Description
fix-tui-graph (commit 83b3814b3, including 73f2f5c11) shipped the chat-specific 'sort by last-activity' minimal version. User redirected via wg msg send AFTER agent had committed; the redirect to a generic primitive (last_interaction_at field on every task, debounced rendering) was not incorporated.
Result post-landing: every event (state change, chat message, agent heartbeat) triggers a re-sort of the visible task list. Viewport chases whatever just bubbled. The TUI is unusable — 'CONSTANTLY scrolling through things' per user.
User direct quote 2026-05-01: 'wg tui fixing sort has left a COMPLETELY BROKEN STATE the TUI scrolls through things CONSTANTLY it's so fucking wild and weird.'
Step 1: revert the bad ship
git revert 73f2f5c11 # 'fix: sort TUI graph view by last-activity within status groups'
# Plus any merge commit if necessary
Confirm revert is clean (no leftover field references, no dangling code paths). cargo build passes. cargo install. TUI is usable again.
Step 2: redo properly per the user's redirected scope
Per the redirect logged on fix-tui-graph (which the original agent missed):
Generic primitive
- Add
last_interaction_atto every task in graph.jsonl - Schema migration: hard add (per skip-back-compat-ceremony memory). Existing tasks default to created_at.
- Single helper that wraps mutation + timestamp-bump. Every mutation site calls it.
Events that count as interaction
- State change (open → in-progress → done/failed/etc.)
- New
wg logentry - New
wg msg send/wg msg read - Chat history append (user typed, agent replied)
wg editmutations- Worker agent heartbeat / activity (NOTE: this is the dangerous one — heartbeats fire frequently)
Render performance — CRITICAL
The original fix's failure mode was 'sort on every event = re-render on every event = viewport chases'. The redo MUST add:
- Sort stability: when two tasks tie on last_interaction_at (e.g., both at the most recent second), tie-break by stable ID order so the visible row positions don't flip-flop
- Render debouncing: the TUI's view-rebuild on graph events is throttled to ~5 events/sec MAX, regardless of underlying mutation rate. Sub-second events accumulate; the next debounced flush applies them all in one sort+render pass.
- Worker heartbeat exclusion (recommended): heartbeats SHOULD update last_interaction_at semantically, but the TUI render path may ignore heartbeat-only changes and only re-sort on substantive events (state change, log entry, message, edit). Discuss in implementation: easiest is to exclude heartbeats from triggering re-sort.
Viewport behavior
The recent fix-tui-viewport / implement-tui-viewport cycle established a stability policy. The new sort logic must compose with that — the user expects viewport to stay anchored unless they explicitly move it. Sort changes that bubble a task into view should NOT yank the viewport; only explicit user navigation should change focus.
Validation
- Step 1 (revert) lands cleanly: cargo build + cargo test pass; TUI doesn't constantly scroll; user can verify visibly
- Step 2 (redo) — failing tests written first
- last_interaction_at field exists on all tasks; updated by all mutation paths
- Sort stability test: two tasks with identical last_interaction_at don't flip-flop
- Render debounce test: simulate 100 events/sec; assert at most ~5 re-renders/sec
- Heartbeat-noise test: with 8 active agents heartbeating, TUI doesn't re-sort visibly. Only substantive events bubble tasks.
- Viewport test: when a task bubbles into view due to sort change, viewport doesn't jerk; user navigation still works
- No regression of fix-tui-viewport stability properties
- Live smoke: open TUI with 8/8 agents busy + active chat. ASSERT: no constant scrolling, viewport stable, sort visible-but-calm
- cargo build + cargo test pass
- Permanent smoke scenario covering the constant-scroll regression
- cargo install --path . was run before claiming done
Process note
This is the third time today an agent committed before reading a redirect message. The pattern: wg msg send is best-effort with no ack; agents poll inbox at checkpoints; commit can happen between message-arrival and next-checkpoint.
For high-stakes redirects, consider:
- A
wg msg send-blockingvariant that pauses the agent's spawn until the message is read (changes the IPC semantics; not free) - The corrective verify-task pattern (which DID work for verify-correct-wg-2 — but only because the redirect was honored; same pattern would have caught this miss too)
The cost of this revert+redo is real (2 worktrees, redo work). The lesson is: any redirect of in-flight work should be paired with a corrective verify-task pre-emptively, NOT after observing whether redirect landed.
Depends on
Required by
- (none)
Log
- 2026-05-01T18:06:56.331115928+00:00 Task paused
- 2026-05-01T18:07:01.318098545+00:00 Task published
- 2026-05-01T18:07:34.522576738+00:00 Lightweight assignment: agent=Careful Programmer (f5143935), exec_mode=full, context_scope=graph, reason=Only implementation-capable agent; Careful tradeoff suits correctness-critical fix requiring schema migration, render-debounce tuning, and strict smoke testing.
- 2026-05-01T18:07:37.568040261+00:00 Spawned by coordinator --executor claude --model opus
- 2026-05-01T18:07:49.444523982+00:00 Starting work: inspecting commits 83b3814b3 (merge) and 73f2f5c11 (sort fix) before reverting
- 2026-05-01T18:11:32.983526873+00:00 Step 1 (revert) complete: 3c534627a reverts 83b3814b3. cargo build + 2155 lib tests pass. Now planning Step 2 (generic last_interaction_at primitive).
- 2026-05-01T19:25:15.978498877+00:00 Task unclaimed: agent 'agent-1380' (PID 225547) process exited
- 2026-05-01T19:25:25.431693560+00:00 Spawned by coordinator --executor claude --model opus
- 2026-05-01T19:51:38.610512419+00:00 Step 2 complete: last_interaction_at field + auto-bump in modify_graph + chat-append bumps + TUI activity sort with stable id tiebreak + ~5/s render debounce. 11 integration tests + 6 unit tests + 1 smoke scenario all pass. cargo install --path . done. Live wg viz against 1000+ task graph renders cleanly. Pre-existing integration_chat tests still fail unrelated to this change (wg init requires -m).
- 2026-05-01T19:52:22.566293195+00:00 Committed: e2dee582b — pushed to remote (origin/wg/agent-1380/revert-redo-fix)
- 2026-05-01T19:57:57.811551102+00:00 Rebased onto origin/main (which now has its own revert of fix-tui-graph + sweep-purge-stale). Conflict in state.rs maybe_refresh comment was trivial. Force-pushed: f248df699. Reinstalled. Running wg done now.
- 2026-05-01T19:58:09.505617517+00:00 Task pending eval (agent reported done; awaiting `.evaluate-*` to score)
- 2026-05-01T20:01:27.886283029+00:00 PendingEval → Done (evaluator passed; downstream unblocks)