t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: `npx t3` hangs after "Migrations ran successfully" when OpenCode provider bootstrap runs

Open hevlyo opened this issue 7 months ago • 3 comments

Before submitting

  • [x] I searched existing issues and did not find a duplicate.
  • [x] I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Have opencode installed and available on PATH
  2. Use a normal existing ~/.t3 profile with default/empty settings
  3. Run: npx t3
  4. Observe startup stops after:
[18:17:08.773] INFO (#1): Running all migrations...
[18:17:08.780] INFO (#1): Migrations ran successfully
  migrations: []
  1. No browser opens and no startup URL is printed

Expected behavior

T3 should continue startup, print Listening on ..., and open/pair the browser.

A provider probe failure or timeout should not block server readiness.

Actual behavior

From tracing, the startup never reaches the later readiness phases (ready.publish / browser startup). In a controlled repro, the last relevant completed provider spans before the hang were OpenCode-related (opencode.provider.list / opencode.app.agents).

Impact

Blocks work completely

Version or commit

v0.0.21. 188df6d

Environment

Linux 6.19.11-arch1-1, Node: 25.8.0, Codex: 0.123.0, OpenCode CLI: 1.14.20

Logs or stack traces

[18:17:08.773] INFO (#1): Running all migrations...
[18:17:08.780] INFO (#1): Migrations ran successfully
    migrations: []

Screenshots, recordings, or supporting files

No response

Workaround

Disable OpenCode explicitly:

  {
    "providers": {
      "opencode": {
        "enabled": false
      }
    }
  }

Additional note

[email protected] was not a viable workaround for this profile, because it failed to decode newer persisted state/caches created by newer versions.

hevlyo avatar Apr 23 '26 21:04 hevlyo

same, macos sequoia

nggurbanov avatar Apr 23 '26 21:04 nggurbanov

Additional datapoint from macOS desktop app:

This also reproduces in the packaged desktop app, not only npx t3.

Environment:

  • macOS 26.4.1
  • T3 Code Nightly 0.0.22-nightly.20260427.140
  • Also reproduced with 0.0.22-nightly.20260427.135 and Stable/Alpha 0.0.21
  • OpenCode CLI 1.14.28
  • opencode serve works correctly when run directly
  • codesign --verify ~/.opencode/bin/opencode passes

Observed behavior:

  • App launches but no window/interface appears.
  • Electron waits for backend readiness before creating the main window.
  • Backend binds 127.0.0.1:3773, but HTTP requests hang with 0 bytes returned.

Desktop log:

bootstrap start
selected backend port via sequential scan startPort=3773 port=3773
bootstrap resolved backend endpoint baseUrl=http://127.0.0.1:3773
bootstrap ipc handlers registered
bootstrap backend start requested
bootstrap backend readiness warning message=Timed out waiting for backend readiness at http://127.0.0.1:3773.
[desktop] backend readiness check timed out during packaged bootstrap Error: Timed out waiting for backend readiness at http://127.0.0.1:3773.

HTTP check:

curl -v --max-time 3 http://127.0.0.1:3773/
Connected to 127.0.0.1 port 3773
Operation timed out after 3003 milliseconds with 0 bytes received

Server log in failing run:

APP SESSION START ... port=3773
Running all migrations...
Migrations ran successfully

Missing in failing run:

Listening on http://127.0.0.1:3773
provider.session.reaper.started

Server trace reaches provider checks and then never reaches listening:

checkCodexProviderStatus success
opencode.provider.list success
opencode.app.agents success
checkClaudeProviderStatus success

Workaround confirmed:

{
  "enableAssistantStreaming": true,
  "providers": {
    "opencode": {
      "enabled": false
    }
  }
}

After that, the same installed Nightly starts normally:

bootstrap backend ready source=listening
bootstrap main window created
Listening on http://127.0.0.1:3773

Other checks:

  • Reproduced with a clean T3CODE_HOME, so it does not appear to be profile corruption.
  • ~/.t3/userdata/state.sqlite passes PRAGMA integrity_check.

HeeroML avatar Apr 28 '26 12:04 HeeroML

Adding a Linux/Wayland datapoint to confirm this is cross-platform, not macOS-specific.

Environment

  • Arch Linux 6.19.x, Hyprland on Wayland (single-display)
  • Node 25.8.0 (system), Electron bundled
  • T3 Code Stable/Alpha 0.0.21 (AppImage, --no-sandbox)
  • OpenCode CLI: bundled (whichever ships with v0.0.21)
  • Launched both via rofi (.desktop file) and direct CLI with a fully clean env (env -i ... -u OPENCODE -u OPENCODE_PID ...)

Reproduction

Identical to OP and to @HeeroML's macOS report. App launches, no window. Hyprland confirms zero windows ever mapped.

[desktop] backend readiness check timed out during packaged bootstrap
Error: Timed out waiting for backend readiness at http://127.0.0.1:3773.
    at waitForHttpReady (...main.cjs:4027:37)
    at waitForBackendHttpReady (...main.cjs:4969:3)

ss -tlnp shows bin.mjs bound to 127.0.0.1:3773 with LISTEN 0 511 ... users:(("t3code",fd=3)). Raw TCP probes accept the connection and request bytes, but no byte is ever sent back on any path. All 12 worker threads sit in epoll_wait, listen-queue Recv-Q=0.

Effect-TS trace evidence

With T3CODE_LOG_LEVEL=Debug T3CODE_TRACE_FILE=/tmp/t3.trace, all 171 spans (≈55 unique) complete exit:Success, then the trace stops being written and the server idles forever. The fingerprint matches @HeeroML's exactly:

checkCursorProviderStatus      0.36ms   exit=Success
checkCodexProviderStatus     197.07ms   exit=Success
runClaudeCommand             333.75ms   exit=Success
checkClaudeProviderStatus   1558.48ms   exit=Success
opencode.app.agents         1554.99ms   exit=Success
opencode.provider.list      2811.51ms   exit=Success    ← last "interesting" span
runClaudeCommand              88.16ms   exit=Success
checkClaudeProviderStatus    367.80ms   exit=Success
syncProvider / upsertProviders ...      exit=Success
... then silence; no "Listening on http://127.0.0.1:3773"

No span ever errors. No exception is logged. The HTTP-listening Deferred (bin.mjs line 7516) never resolves and the Effect Layer.launch(makeServerLayer) (line 53010) never reaches the .listen() callback even though the OS-level bind()+listen() succeeded.

Workaround confirmation

Same workaround works on Linux:

// ~/.t3/userdata/settings.json
{
  "providers": {
    "opencode": {
      "enabled": false
    }
  }
}

After applying:

  • curl http://127.0.0.1:3773/ → HTTP 200, 3.3 KB HTML, 2.3 ms (was: hang forever)
  • Hyprland reports class='t3code' title='T3 Code (Alpha)' mapped=True
  • App is fully usable

Also moved ~/.t3/caches/{claudeAgent,codex,cursor}.json aside as a defensive measure (no idea if any of those individually mattered, since I applied the workaround at the same time).

Notes

  • Reproduces with completely clean T3CODE_HOME (after wiping ~/.t3 and ~/.config/t3code).
  • Reproduces with no parent OpenCode session inheritance (clean env via env -i).
  • state.sqlite is brand new on the fresh-config repro, so this is not the PersistenceDecodeError/reasoningEffortLevels SchemaError mentioned in #2325 — root cause is upstream of any decode.
  • The fact that opencode.provider.list returns Success (and is consistently the last "real" span before silence) strongly suggests the provider Layer composes successfully but holds an Effect fiber/scope that prevents httpListeningLayer from reaching Deferred.succeed(httpListening, ...) at line 7621.

Happy to attach the full 171-line trace JSON or the main.cjs/bin.mjs line offsets if useful.

putueddy avatar May 04 '26 22:05 putueddy