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
- Start CyberStrike for the first time (no provider configured):
cyberstrike
- TUI automatically opens the provider selection dialog
- Select a provider (e.g., Anthropic)
- Complete OAuth flow (browser redirect → paste code)
- Wait ~1-2 seconds — the model list appears
- Select a model
- 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:
dialog-provider.tsx explicitly calls sync.bootstrap() after sdk.client.instance.dispose()
- 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-667 — bootstrap() 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
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
cyberstrikeWorkaround: Exit with
Ctrl+CorEsc, restartcyberstrike. 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()callWhen the provider auth flow completes:
dialog-provider.tsxexplicitly callssync.bootstrap()aftersdk.client.instance.dispose()sync.tsx:299-301receivesserver.instance.disposedand also callsbootstrap()Both run concurrently, potentially causing state inconsistency.
Flow trace
Relevant files
packages/cyberstrike/src/cli/cmd/tui/component/dialog-provider.tsx— Auth flow, dispose + bootstrappackages/cyberstrike/src/cli/cmd/tui/component/dialog-model.tsx— Model selection, dialog.clearpackages/cyberstrike/src/cli/cmd/tui/context/sync.tsx:299-301— SSEserver.instance.disposedhandlerpackages/cyberstrike/src/cli/cmd/tui/context/sync.tsx:580-667—bootstrap()functionNote
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