fix(desktop): wire up tool_progress so live bash output doesn't blank the app#2693
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause of the white screen
ToolProgresswas appended to theevent.Kindenum (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:kindNames[event.ToolProgress]misses → Go returns the zero value"".toWireemitskind: "".applyEventhas nocasefor it and nodefault→ returnsundefined.reducerreturnsundefined→ the wholeuseReducerstate becomesundefined.todoItemreadsstate.itemsoffundefined→TypeError: Cannot read properties of undefined (reading 'items')→ tree unmounts → white screen.Caught via the new crash overlay (#2691); the
[react]stack pointed straight at thetodoItemmemo. 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
ToolProgress → "tool_progress"inkindNames+toWire, add it toEventKind, and handle it inapplyEvent(append the chunk to the tool's output, so live progress now actually renders).default: return sto bothapplyEventand the reducer — an event kind a newer kernel emits but this build doesn't name yet is now ignored, never fatal.TestKindNamesCompleteto walk every Kind throughToolProgress(the old hand-listed set had missedToolProgresstoo, so it stayed green), plus atoWire(ToolProgress)test.Validation
gofmt/go vet/go build/go test ./...indesktop/— pass (the tightened completeness test now fails if any Kind is unmapped)npm run typecheck+npm run buildindesktop/frontend