Skip to content

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

@V4G4X

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"
          }
        }
      }
    }
  }
}

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