Skip to content

Long-running shell commands (e.g. Gradle build) hang even after “BUILD SUCCESSFUL” #25038

Closed

Description

@universe-st

Description

Image

Describe the bug
When executing a long-running shell command (e.g., an Android Gradle build), the process frequently hangs even after the command has completed successfully. The output clearly shows BUILD SUCCESSFUL, yet the task remains stuck and never returns control. It stays in this state for a long time until I manually pause the execution and ask the model to continue.

To Reproduce

  1. Issue a time-consuming shell command, such as ./gradlew assembleDebug.
  2. Wait for the build to finish normally.
  3. Observe that the final output confirms success, but the process does not exit – it just hangs.

Expected behavior
Once the shell command finishes, the process should exit immediately and control should be returned to the conversation so that the workflow can proceed without manual intervention.

Environment:

  • opencode version: v1.14.30
  • OS: Windows 11
  • Shell: powershell
  • Command type: long-running build tasks (Android Gradle, but likely reproducible with other long commands)

Additional context
This happens very consistently with time-consuming shell commands and severely interrupts the flow, requiring a manual pause every time. It is not specific to a single project or build command.

Plugins

No response

OpenCode version

v1.14.30

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    perfIndicates a performance issue or need for optimization
    on Apr 30, 2026
  2. github-actions commented on Apr 30, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • The OS and Shell fields in the description still contain unfilled placeholder text ([please fill in, e.g. macOS 14 / Ubuntu 22.04] and [e.g. zsh, bash]). Please replace these with your actual OS and shell information.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    This issue might be a duplicate of existing issues. Please check:

    If you believe this was flagged incorrectly, please let a maintainer know.

  3. added
    needs:complianceThis means the issue will auto-close after 2 hours.
    and removed
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Apr 30, 2026
  4. github-actions commented on Apr 30, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! It now includes all the required information — a clear description, reproduction steps, expected behavior, and environment details. Everything looks good.

  5. removed
    bugSomething isn't working
    perfIndicates a performance issue or need for optimization
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  6. SkipXS commented on May 4, 2026

    @SkipXS

    I have the same issue in 1.14.33.

    Windows 11 Pro
    PowerShell 7.6.1
    Git for Windows MSYS tools

    If you need a log or something I'd be happy to provide whats needed.

  7. gnahz77 commented on May 14, 2026

    @gnahz77

    I encountered the same issue, and it doesn't only occur in opencode.
    Some related information I found: Troubleshooting "Too long with no output" on Windows with gradlew.bat

    Besides terminating opencode, there is a temporary workaround for this problem: kill the Java process in Task Manager

  8. GotKiCry commented on May 21, 2026

    @GotKiCry

    Same issue. Pressing Esc to stop and ask something else still continue run .\gradlew.bat assembleDebug task

  9. gnahz77 commented on May 21, 2026

    @gnahz77

    I fixed this in WSL by changing opencode to use the command cmd.exe /d /s /c ".\\gradlew :app:assembleDebug".
    Maybe this would work on Windows too?

  10. Hona commented on May 29, 2026

    @Hona
    Member

    Possibly fixed by #29831. The Gradle daemon inherits the build's stdout/stderr pipe, so when gradlew exits after "BUILD SUCCESSFUL" the shell tool was waiting on close (all stdio closed), which never fires while the daemon holds the pipe. #29831 resolves completion on exit instead. If you can run against that branch, please confirm whether ./gradlew assembleDebug now returns promptly on Windows.

  11. SkipXS commented on May 31, 2026

    @SkipXS

    I fixed this in WSL by changing opencode to use the command cmd.exe /d /s /c ".\\gradlew :app:assembleDebug". Maybe this would work on Windows too?

    I can confirm this works on Windows too until the fix is merged. Thank you 👍

  12. jamhour1g commented on May 31, 2026

    @jamhour1g

    This needs to be fixed ASAP because it's unbearable to keep manually ending the task in Task Manager or interrupting the Agent.

  13. jamhour1g commented on Jun 10, 2026

    @jamhour1g

    @kitlangton Could you provide any updates on this issue? It completely ruined OpenCode for me, and I had to switch to a different harness.

  14. futureisAJASU commented on Jul 24, 2026

    @futureisAJASU

    I am experiencing the same issue on Windows, but it is not limited to Gradle or long-running commands.

    I have intermittently seen the shell tool remain in the running state after apparently completed commands including:

    • .\gradlew.bat assembleDebug, after either BUILD SUCCESSFUL or BUILD FAILED
    • git status
    • git diff
    • rg
    • PowerShell Get-Content

    In each case, the expected output appears to be complete, but OpenCode does not continue to the next agent step until I manually interrupt it. Re-running the same command often completes normally, so the issue appears intermittent.

    The short commands are especially notable because git status, rg, and ordinary Get-Content calls normally terminate immediately and do not leave persistent daemon processes.

    Environment:

    • OpenCode: [VERSION]
    • OS: Windows 11 [BUILD IF AVAILABLE]
    • Shell: PowerShell [VERSION]
    • Terminal: [WINDOWS TERMINAL / OTHER]
    • Installation method: [NPM / BUN / SCOOP / OTHER]

    I saw that #29831 changes process completion from close to exit. I am reporting these additional command types because this may be broader than Gradle descendants retaining stdout/stderr handles. I can test the PR branch or provide debug logs and process-tree information if that would help.

  15. zhuzhutai commented on Aug 11, 2026

    @zhuzhutai

    opencode 1.18.16 ,This bug still isn't fixed

  16. SMFDrummer commented on Aug 26, 2026

    @SMFDrummer

    opencode 1.18.23 ,This bug still isn't fixed

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions