Skip to content

TUI exits but process hangs (no shell return) when opencode.json is present #1717

Closed

Description

@V4G4X

Summary:

Exiting the TUI closes the UI but the opencode process doesn’t return control to the shell.
I have to Ctrl+C to regain the prompt.

This does not occur if I remove my opencode.json, but it consistently reproduces when I restore it.

Steps to reproduce

  1. Use opencode with the config below.
  2. Open the TUI, then /exit
  3. Observe that the terminal does not return to the shell; process appears suspended until Ctrl+C.

Behaviour

  • Expected behavior: After exiting the TUI, opencode should terminate and return control to the shell.
  • Actual behavior: TUI closes, but the opencode command hangs and requires Ctrl+C.
  • Workaround: Remove opencode.json (issue no longer reproduces).

Environment

  • OS: Darwin Varuns-MacBook-Pro.local 24.5.0 Darwin Kernel Version 24.5.0: Tue Apr 22 19:48:46 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T8103 arm64
  • Shell: zsh 5.9
  • sst-opencode version: 0.4.1
  • Install method: YOLO (Curl + Bash)
  • Additional context
    • The issue seems tied to the config below.
      Notably, MCP providers are launched via docker run -i which may be keeping stdin open after the TUI exits.

Config:

{
  "$schema": "https://opencode.ai/config.json",
  "share": "disabled",
  "permission": {
    "bash": {
      "git commit": "ask",
      "git status*": "allow",
      "git log*": "allow",
      "git diff*": "allow",
      "git push": "deny",
      "git reset": "ask",
      "git rebase": "ask",
      "git merge": "ask",
      "git cherry-pick": "ask",
      "sudo": "ask",
      "rm": "ask",
      "mv": "ask",
      "chmod": "ask",
      "chown": "ask"
    }
  },
  "mcp": {
    "memory": {
      "type": "local",
      "command": [
        "docker",
        "run",
        "-i",
        "-v",
        "claude-memory:/app/dist",
        "--rm",
        "mcp/memory"
      ],
      "enabled": true
    },
    "sequentialthinking": {
      "type": "local",
      "command": [
        "docker",
        "run",
        "--rm",
        "-i",
        "mcp/sequentialthinking"
      ],
      "enabled": true
    }
  },
  "provider": {
    "openai": {
      "models": {
        "gpt-5": {
          "name": "OpenAI GPT-5 (high reasoning)",
          "options": {
            "reasoningEffort": "high"
          }
        },
        "o3": {
          "name": "OpenAI o3 (high reasoning)",
          "options": {
            "reasoningEffort": "high"
          }
        }
      }
    }
  }
}

Activity

  1. self-assigned this
    on Aug 11, 2025
  2. thdxr commented on Aug 11, 2025

    @thdxr
    Member

    can you try with mcp disabled?

  3. V4G4X commented on Aug 12, 2025

    @V4G4X
    Author

    Yup, deleting the MCPs from the config removed the hangup.

    Also I should add that the hangup happens after there's something in the conversation.
    I typically send a "hi" to recreate the issue.

  4. wlecki commented on Aug 12, 2025

    @wlecki

    I can confirm it happens to me as well, even with no MCP servers or no providers. When I quit the opencode, sometimes I can't even Ctrl+C again and I have to quit the whole terminal. I honestly don't know what more information I can provide. It's very "generic"?

  5. added
    bugSomething isn't working
    and removed on Aug 12, 2025
  6. arthur404dev commented on Aug 12, 2025

    @arthur404dev

    I've noticed my hangs happened after I've added mcps to opencode @thdxr , maybe that's the source of it ?

  7. veracioux commented on Oct 10, 2025

    @veracioux
    Contributor

    Fixed by #3083.
    Try it out if you feel so inclined.

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

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions