Skip to content

fix(desktop): wire up tool_progress so live bash output doesn't blank the app#2693

Merged
esengine merged 1 commit into
main-v2from
fix/desktop-toolprogress-event
Jun 2, 2026
Merged

fix(desktop): wire up tool_progress so live bash output doesn't blank the app#2693
esengine merged 1 commit into
main-v2from
fix/desktop-toolprogress-event

Conversation

@esengine
Copy link
Copy Markdown
Owner

@esengine esengine commented Jun 2, 2026

Root cause of the white screen

ToolProgress was appended to the event.Kind enum (to keep earlier Kind values wire-stable) but never added to the desktop wire map or the frontend. So when bash streams live output mid-turn:

  1. kindNames[event.ToolProgress] misses → Go returns the zero value "".
  2. toWire emits kind: "".
  3. The frontend applyEvent has no case for it and no default → returns undefined.
  4. reducer returns undefined → the whole useReducer state becomes undefined.
  5. Next render: todoItem reads state.items off undefinedTypeError: Cannot read properties of undefined (reading 'items') → tree unmounts → white screen.

Caught via the new crash overlay (#2691); the [react] stack pointed straight at the todoItem memo. This is independent of the cmd-window popup (#2686) — both just happen while bash runs, which is why hiding the popup didn't stop the blanking.

Fix

  • Map ToolProgress → "tool_progress" in kindNames + toWire, add it to EventKind, and handle it in applyEvent (append the chunk to the tool's output, so live progress now actually renders).
  • Add default: return s to both applyEvent and the reducer — an event kind a newer kernel emits but this build doesn't name yet is now ignored, never fatal.
  • Tighten TestKindNamesComplete to walk every Kind through ToolProgress (the old hand-listed set had missed ToolProgress too, so it stayed green), plus a toWire(ToolProgress) test.

Validation

  • gofmt / go vet / go build / go test ./... in desktop/ — pass (the tightened completeness test now fails if any Kind is unmapped)
  • npm run typecheck + npm run build in desktop/frontend

… the app

ToolProgress was appended to the event.Kind enum but never added to the desktop
wire map (kindNames) or the frontend. When a tool like bash streamed live output
mid-turn, toWire looked the kind up, missed, and emitted kind:"" (Go map zero
value). The frontend reducer had no case for it and — crucially — no default, so
applyEvent returned undefined, the whole reducer state went undefined, and the
next render read state.items off undefined: the tree unmounted to a white screen.

Independent of the cmd-window popup (#2686); both just happen while bash runs,
which is why hiding the popup didn't stop the blanking.

- Map ToolProgress -> "tool_progress" in kindNames + toWire, add it to EventKind,
  and handle it in applyEvent (append the chunk to the tool's output).
- Add default: return s to both applyEvent and the reducer, so an event kind a
  newer kernel emits but this build doesn't name yet is ignored, not fatal.
- Tighten TestKindNamesComplete to walk every Kind through ToolProgress (the old
  hand-listed set had missed ToolProgress too), plus a toWire(ToolProgress) test.
@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 2, 2026
@esengine esengine merged commit 062c568 into main-v2 Jun 2, 2026
5 checks passed
@esengine esengine deleted the fix/desktop-toolprogress-event branch June 2, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant