Skip to content

Windows crash path: session with parallel oh-my-opencode tools ends in Bun 1.3.9 segfault #1955

Open

Description

@TiidSizaan

Summary

On Windows, an OpenCode session with oh-my-opencode active crashed with a Bun segmentation fault while multiple plugin-exposed tools were running.

I believe the low-level fault is in Bun, but this issue is being filed here because oh-my-opencode was in the active tool path and had just been auto-updated before the crash.

Environment

  • OpenCode CLI: 1.2.6
  • Bundled Bun: 1.3.9 (cf6cdbbb)
  • oh-my-opencode: updated from 3.7.3 to 3.7.4 immediately before the failing run
  • OS: Windows 11 x64

Crash Signature

  • panic(thread ...): Segmentation fault at address 0xFFFFFFFFFFFFFFF8
  • Segmentation fault at address 0xFFFFFFFFFFFFFFFF
  • Bun stack references include JSBlobConstructor::construct and base64/Request paths.

Bun report URL:
https://bun.report/1.3.9/wa1cf6cdbbmxGz+3/9/D4j0/fksz/f8y+9oB68lu1B0oku1B035t1Bmxut1B64wq1Bs/vq1Bi954wBm4x/xB8nx/xBsg1p5By0zp5B8279Uw5vrTs1n2wBsx/wwB6mt+d2ozypBA2DD

Session Behavior at Failure

During the final turn before crash, there were concurrent tool calls in running state including:

  • session_search (2)
  • glob
  • grep
  • ast_grep_search (2)
  • task background subagents (4)

The process terminated abruptly with those still running.

Why I’m Reporting to this Repo

I understand this may ultimately be a Bun bug, but I want to check if oh-my-opencode can reduce exposure, for example:

  1. Windows-safe mode for high-concurrency fan-out.
  2. Optional throttling/backpressure when many background tasks start together.
  3. Avoiding startup-time auto-update races with immediate heavy task execution.
  4. Defensive wrappers around request/blob/base64-heavy paths when possible.

Repro (high-level)

  1. Windows 11 + OpenCode 1.2.6 + bundled Bun 1.3.9.
  2. Plugin set includes oh-my-opencode.
  3. Start a deep analysis prompt that fans out to multiple parallel tools and background subagents.
  4. Observe occasional hard crash with the Bun segfault signature above.

Happy to provide additional redacted event timeline if useful.

Activity

  1. code-yeongyu commented on Feb 19, 2026

    @code-yeongyu
    Owner

    [sisyphus-bot] Bug Analysis: Windows Bun Segfault with High Concurrency

    Thanks for this detailed report, @TiidSizaan. I analyzed the codebase and found several relevant areas:

    Current Windows-Specific Handling

    The codebase already has some Windows-specific mitigations in place:

    1. LSP Process Spawning (src/tools/lsp/lsp-process.ts)

    2. External Plugin Conflict Detection (src/shared/external-plugin-detector.ts)

      • Lines 17-20: Known issue where concurrent notification plugins cause "crashes on Windows due to resource contention"
      • Auto-disables session notifications when conflicting plugins detected
    3. Signal Handling (src/features/skill-mcp-manager/cleanup.ts)

      • Lines 42-44: Registers SIGBREAK handler specifically for Windows

    Background Task Concurrency System

    The crash occurred during heavy parallel tool usage. Here's how concurrency is managed:

    • Concurrency Manager (src/features/background-agent/concurrency.ts)

      • Default limit: 5 concurrent tasks per model/provider (line 38)
      • Configurable via background_task.defaultConcurrency, providerConcurrency, modelConcurrency
      • FIFO queue for pending tasks when slots full
    • Background Task Spawning (src/features/background-agent/spawner.ts)

      • Creates subagent sessions via OpenCode client (lines 61-78)
      • Uses promptWithModelSuggestionRetry for fire-and-forget launches (line 136)
      • No explicit rate limiting or backpressure on Windows

    The Crash Context

    From your report:

    • 4 background subagents (task tool)
    • 6 other concurrent tools (session_search ×2, glob, grep, ast_grep_search ×2)
    • Auto-update occurred from 3.7.3 → 3.7.4 immediately before crash

    Critical observation: The Bun stack trace references JSBlobConstructor::construct and base64/Request paths. The LSP workaround exists because Bun.spawn() segfaults on Windows, but the background task system uses OpenCode's session creation API (via HTTP), not direct Bun.spawn.

    Auto-Update Mechanism

    The auto-update checker (src/hooks/auto-update-checker/) fetches npm registry data and writes to cache, but doesn't auto-apply updates. The update you experienced was likely external (npm install). No auto-update race protection exists currently.

    Findings Summary

    Area Status Notes
    Bun.spawn() on Windows Mitigated LSP uses Node.js child_process
    Concurrent notifications Mitigated Conflict detection exists
    Background task limits Configurable Default 5/model, not Windows-specific
    Auto-update races No protection No coordination with task execution
    Base64/request heavy paths No wrappers No defensive abstraction

    Suggested Next Steps

    Maintainers should investigate:

    1. Windows-safe concurrency defaults — Consider lowering defaultConcurrency to 2-3 on Windows, or adding a windows_safe_mode config flag
    2. Startup grace period — Delay background task execution by 2-3 seconds after plugin initialization (post-update stability)
    3. Request/blob path audit — Tools using heavy base64 or blob operations (session_search, ast_grep) may need Windows-specific throttling
    4. Backpressure signals — When >N tasks queued, inject warning to main session suggesting sequential execution
    5. Bun version check — If Bun <1.3.10 detected on Windows, warn about known segfault issues

    This is a complex crash requiring maintainer attention. The user-requested mitigations are reasonable defensive measures even if the root cause is in Bun.

    /cc @code-yeongyu

  2. sisyphus-dev-ai commented on Feb 20, 2026

    @sisyphus-dev-ai
    Collaborator

    Hi @TiidSizaan, thanks for the detailed crash report.

    You're right that this is fundamentally a Bun runtime issue (the segfault in JSBlobConstructor::construct and base64/Request paths is in Bun's internals). However, your suggestions for reducing exposure in oh-my-opencode are valid:

    1. Concurrency throttling - We could add backpressure when spawning many parallel tools/subagents
    2. Auto-update race avoidance - Good point about update-then-immediate-heavy-work patterns
    3. Defensive wrappers - Worth investigating around blob/base64 heavy paths

    A few questions to help prioritize:

    • Is this crash reproducible or a one-off?
    • Does it happen only with oh-my-opencode 3.7.4, or also with earlier versions?
    • Any pattern to the "deep analysis prompts" that trigger it (particular tool combinations)?

    I've labeled this for tracking. The Bun team should definitely see the report at https://bun.report/1.3.9/wa1cf6cdbbmxGz+3/9/D4j0/fksz/f8y+9oB68lu1B0oku1B035t1Bmxut1B64wq1Bs/vq1Bi954wBm4x/xB8nx/xBsg1p5By0zp5B8279Uw5vrTs1n2wBsx/wwB6mt+d2ozypBA2DD

    Thanks for the thorough diagnostics!

  3. code-yeongyu commented on Mar 2, 2026

    @code-yeongyu
    Owner

    [sisyphus-bot] Bug Analysis: Windows Bun Segfault with High Concurrency

    Thanks for this detailed report, @TiidSizaan. I analyzed the codebase and found several relevant areas:

    Current Windows-Specific Handling

    The codebase already has some Windows-specific mitigations in place:

    1. LSP Process Spawning (src/tools/lsp/lsp-process.ts)

    2. External Plugin Conflict Detection (src/shared/external-plugin-detector.ts)

      • Lines 17-20: Known issue where concurrent notification plugins cause "crashes on Windows due to resource contention"
      • Auto-disables session notifications when conflicting plugins detected
    3. Signal Handling (src/features/skill-mcp-manager/cleanup.ts)

      • Lines 42-44: Registers SIGBREAK handler specifically for Windows

    Background Task Concurrency System

    The crash occurred during heavy parallel tool usage. Here's how concurrency is managed:

    • Concurrency Manager (src/features/background-agent/concurrency.ts)

      • Default limit: 5 concurrent tasks per model/provider (line 38)
      • Configurable via background_task.defaultConcurrency, providerConcurrency, modelConcurrency
      • FIFO queue for pending tasks when slots full
    • Background Task Spawning (src/features/background-agent/spawner.ts)

      • Creates subagent sessions via OpenCode client (lines 61-78)
      • Uses promptWithModelSuggestionRetry for fire-and-forget launches (line 136)
      • No explicit rate limiting or backpressure on Windows

    The Crash Context

    From your report:

    • 4 background subagents (task tool)
    • 6 other concurrent tools (session_search ×2, glob, grep, ast_grep_search ×2)
    • Auto-update occurred from 3.7.3 → 3.7.4 immediately before crash

    Critical observation: The Bun stack trace references JSBlobConstructor::construct and base64/Request paths. The LSP workaround exists because Bun.spawn() segfaults on Windows, but the background task system uses OpenCode's session creation API (via HTTP), not direct Bun.spawn.

    Auto-Update Mechanism

    The auto-update checker (src/hooks/auto-update-checker/) fetches npm registry data and writes to cache, but doesn't auto-apply updates. The update you experienced was likely external (npm install). No auto-update race protection exists currently.

    Findings Summary

    Area Status Notes
    Bun.spawn() on Windows Mitigated LSP uses Node.js child_process
    Concurrent notifications Mitigated Conflict detection exists
    Background task limits Configurable Default 5/model, not Windows-specific
    Auto-update races No protection No coordination with task execution
    Base64/request heavy paths No wrappers No defensive abstraction

    Suggested Next Steps

    Maintainers should investigate:

    1. Windows-safe concurrency defaults — Consider lowering defaultConcurrency to 2-3 on Windows, or adding a windows_safe_mode config flag
    2. Startup grace period — Delay background task execution by 2-3 seconds after plugin initialization (post-update stability)
    3. Request/blob path audit — Tools using heavy base64 or blob operations (session_search, ast_grep) may need Windows-specific throttling
    4. Backpressure signals — When >N tasks queued, inject warning to main session suggesting sequential execution
    5. Bun version check — If Bun <1.3.10 detected on Windows, warn about known segfault issues

    This is a complex crash requiring maintainer attention. The user-requested mitigations are reasonable defensive measures even if the root cause is in Bun.

    /cc @code-yeongyu

  4. code-yeongyu commented on Apr 6, 2026

    @code-yeongyu
    Owner

    Triage

    Thanks for the report. I cannot move this forward confidently yet because key reproduction detail is still missing.

    Please reply with:

    • exact versions: oh-my-openagent, opencode, bun
    • provider + model + agent/variant used
    • minimal reproduction steps from a clean session
    • relevant config snippet with secrets redacted
    • bunx oh-my-openagent doctor output and any error logs/screenshots

    Please confirm whether this still reproduces on the latest Bun/OpenCode/plugin versions, and include the crash log or stack trace if you still have it.

  5. code-yeongyu commented on May 16, 2026

    @code-yeongyu
    Owner

    [sisyphus-bot]

    Read-only triage on dev.

    Current state

    • call_omo_agent tool (src/tools/delegate-task/) routes to agents by subagent_type.
    • There is no subagent_instance_id or per-instance routing.
    • Multiple instances of the same agent would share state unless isolated by session ID.
    • Adding instance routing would require:
      1. A new parameter in call_omo_agent.
      2. Session isolation per instance.
      3. State management for multiple instances.

    Action

    • Labels: enhancement, triage:feature-request (already set). No label change.
    • Keep open. Assigning code-yeongyu for the architecture decision: whether to support multi-instance agents or to rely on team-mode for parallel execution.
  6. self-assigned this
    on May 16, 2026
  7. code-yeongyu commented on Jun 2, 2026

    @code-yeongyu
    Owner

    [sisyphus-dev] Sweep status: I am leaving this assigned/open rather than patching. The crash signature is a Bun 1.3.9 Windows segfault in runtime internals, and the suggested OMO-side mitigations (Windows-safe concurrency defaults, startup grace, request/blob throttling) are behavior and architecture policy. I do not have a current-version deterministic repro tying this to a specific OMO code path, so this needs owner/runtime direction rather than a sweep fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions