Skip to content

[Bug] Shell-mode any command triggers renderer Switch crash (beyond #174) #182

@Astro-Han

Description

@Astro-Han

Summary

In composer shell mode (mod+shift+x), sending any command — including successful ones like gh --help and nonexistent ones like absolutelyfake — triggers a renderer crash:

TypeError: switchFunc(...) is not a function
    at Switch.createMemo.name [as fn]
    at runComputation
    at updateComputation
    ...

Full stack from the session:

TypeError: switchFunc(...) is not a function
    at Switch.createMemo.name [as fn] (http://localhost:5173/@fs/.../node_modules/.vite/deps/chunk-VL2SL2GY.js?v=db12a2de:1549:29)
    at runComputation (.../chunk-VL2SL2GY.js:734:22)
    at updateComputation (.../chunk-VL2SL2GY.js:717:3)
    at runTop (.../chunk-VL2SL2GY.js:827:7)
    at lookUpstream (.../chunk-VL2SL2GY.js:951:87)
    at runTop (.../chunk-VL2SL2GY.js:811:74)
    at runUserEffects (.../chunk-VL2SL2GY.js:924:18)
    at runUpdates (.../chunk-VL2SL2GY.js:844:17)
    at completeUpdates (.../chunk-VL2SL2GY.js:896:17)

Repro

  1. bun run dev:desktop on origin/dev (or any branch derived from post-fix: prevent shell failure render crash #174 dev)
  2. Open a session (or new session)
  3. Press mod+shift+x to enter shell mode
  4. Type gh --help (or any command, succeeding or failing)
  5. Press Enter / Send
  6. Renderer crashes with the Switch error above

Relation to #171 / #174

#174 addressed renderer crashes on failed shell commands by replacing Switch with Show inside packages/ui/src/components/basic-tool.tsx. Manual reverification shows that (a) the crash now also fires on successful commands and (b) it originates from a different <Switch> than the one #174 patched — basic-tool.tsx no longer contains <Switch> in the current tree, so the switchFunc(...) is not a function stack must be from another message-part or tool render path.

Verified

  • Reproducible on a clean origin/dev worktree (checked at 4274751ab9, HEAD at issue filing). Not introduced by feat(app): home redesign per #151 #180; #180 does not modify packages/ui or any <Switch> rendering code.

Next steps

  1. Identify the specific <Switch> whose <Match when={...}> predicate collapses to undefined when a shell-tool part finishes. Candidate sites: packages/ui/src/components/message-part.tsx (multiple Switch blocks at L647, L861, L1348, L2110, L2185).
  2. Decide whether to migrate it to Show/conditional render (same pattern as fix: prevent shell failure render crash #174) or narrow the Match predicate to never return undefined.
  3. Add an e2e regression (extending packages/app/e2e/prompt/prompt-shell.spec.ts) covering both success and failure shell output render.

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High prioritybugSomething isn't workinguiDesign system and user interface

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions