Skip to content

TUI freezes after first-time provider setup (model selection) #66

Description

@badchars

Description

After completing first-time provider setup in TUI mode, the application freezes and becomes unresponsive. Users must exit and restart CyberStrike to use it.

Steps to Reproduce

  1. Start CyberStrike for the first time (no provider configured): cyberstrike
  2. TUI automatically opens the provider selection dialog
  3. Select a provider (e.g., Anthropic)
  4. Complete OAuth flow (browser redirect → paste code)
  5. Wait ~1-2 seconds — the model list appears
  6. Select a model
  7. Bug: TUI freezes — cursor is visible but no input is accepted, prompt is unresponsive

Workaround: Exit with Ctrl+C or Esc, restart cyberstrike. Second launch works fine since provider is now configured.

Analysis

The freeze likely stems from a race condition in the bootstrap/sync cycle during first-time setup:

Double bootstrap() call

When the provider auth flow completes:

  1. dialog-provider.tsx explicitly calls sync.bootstrap() after sdk.client.instance.dispose()
  2. SSE event handler in sync.tsx:299-301 receives server.instance.disposed and also calls bootstrap()

Both run concurrently, potentially causing state inconsistency.

Flow trace

CodeMethod.onConfirm
  → sdk.client.provider.oauth.callback(code)
  → sdk.client.instance.dispose()
  → sync.bootstrap()              ← explicit call
  → dialog.replace(<DialogModel>) 
                                   ← SSE event fires: server.instance.disposed
                                   → sync.bootstrap()  ← second call (race)
DialogModel.onSelect
  → dialog.clear()
  → local.model.set(...)          ← synchronous
  → Home route renders
  → TUI frozen

Relevant files

  • packages/cyberstrike/src/cli/cmd/tui/component/dialog-provider.tsx — Auth flow, dispose + bootstrap
  • packages/cyberstrike/src/cli/cmd/tui/component/dialog-model.tsx — Model selection, dialog.clear
  • packages/cyberstrike/src/cli/cmd/tui/context/sync.tsx:299-301 — SSE server.instance.disposed handler
  • packages/cyberstrike/src/cli/cmd/tui/context/sync.tsx:580-667bootstrap() function

Note

All affected files are identical to upstream (anomalyco/opencode) — this bug likely exists upstream as well.

Expected Behavior

After selecting a model, the TUI should transition to the prompt/chat view and accept user input immediately.

Environment

  • macOS (darwin-arm64)
  • CyberStrike 1.1.16-beta.7
  • Bun 1.3.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions