Skip to content

Not working on OpenCode V2+ #2

Closed

Description

@zanodor

Any chance to have a look at it?

This wrap is essentially incompatible with OpenCode V2 as-is. Apparently, it would need to:

  • Capture the password from the spawned serve’s stdout
  • Pass that password in every subsequent API request

Activity

  1. veerareddyvishal144 commented on Oct 15, 2026

    @veerareddyvishal144
    Contributor

    Yeah let me take a look since v2 just got released I havent yet tried it

  2. bkutasi commented on Oct 15, 2026

    @bkutasi

    Second, I would love this to be updated. I'm currently rolling my over opencode-compat shim but its kinda flaky.

  3. veerareddyvishal144 commented on Oct 15, 2026

    @veerareddyvishal144
    Contributor

    I have added compatibility with Opencode V2 do check it out

  4. zanodor commented on Oct 15, 2026

    @zanodor
    Author

    No, not there yet, buddy.
    Tried on Win11 Git Bash and Linux Mint.

    Claude says the core issue is that opencode serve V2 changed its health check endpoint from /global/health to /api/health (or similar), and the wrap is still polling the old path. So it spawns successfully but never sees "healthy".

    opencode serve starts successfully (port 4100, password printed) but opencode-wrap times out with "did not become healthy in 20s" on both Windows and Linux Mint.

    The wrap appears to be polling /global/health but OpenCode V2 returns HTML (the web UI) at that path. The actual API is at /api/health and requires an auth header — but the password is only known after the serve process starts and prints it to stdout.

    Two things needed:

    1. Update the health check path from /global/health to /api/health (or whatever the correct V2 path is)
    2. Capture the password from opencode serve stdout and pass it as an auth header on all subsequent requests including the health check
  5. veerareddyvishal144 commented on Oct 15, 2026

    @veerareddyvishal144
    Contributor

    I was using it on mac
    We have a open pr for windows support let me check

  6. veerareddyvishal144 commented on Oct 15, 2026

    @veerareddyvishal144
    Contributor

    Thanks for the detailed report. Both points you listed are implemented on main now:

    • V2 API + auth landed in 9cdab76 (Oct 15, 07:33 UTC). Health is probed via GET /api/info with HTTP basic auth, sessions/prompts use the /api/* routes, streaming reads session.text.delta.
    • Password handling: the wrapper generates a password and passes it to the spawned opencode serve through OPENCODE_SERVER_PASSWORD, so it never has to scrape stdout. If you point OPENCODE_BASE at a server you started yourself, export the same OPENCODE_SERVER_PASSWORD before starting the wrapper.
    • Windows fixes from fix: Windows support for opencode.exe resolution, health check, WRAP_CWD #1 are merged (4ef3915): opencode.exe / npm opencode.cmd resolution and a temp-dir default for WRAP_CWD.
    • --version flag + version in /health (81aafcc, v0.4.1) so we can tell which build a report comes from.

    About the "not there yet" test: the symptoms match the pre-V2 binary. A password printed by opencode serve means that server was not spawned by the new wrapper (when the wrapper passes the password, the server only prints server listening on ...), and the /global/health polling you mention comes from the old source. There were no tagged releases and no version flag, so there was no way to tell — sorry about that.

    Please rebuild from current main and confirm the version:

    cargo install --git https://github.com/Fast-Editor/OpenCode-Wrap.git --force
    opencode-wrap --version        # expect: opencode-wrap 0.4.1
    WRAP_CWD=/tmp opencode-wrap    # log should show: opencode serve v2.0.x ready
    curl -s http://127.0.0.1:8000/health   # includes "version":"0.4.1"

    Verified end to end (health, models, non-stream, stream, tool calls, attachments, session cleanup) on macOS with OpenCode 2.0.28 and 2.0.30, and in a clean Debian container with 2.0.30 installed via curl -fsSL https://opencode.ai/v2/install | bash (spawn, health, models, chat). Windows is covered by #1 but only compile-tested on our side, so a Win11 result would be welcome.

    If it still fails on 0.4.1, please paste opencode-wrap --version, opencode --version, and the wrapper's startup log.

  7. zanodor commented on Oct 16, 2026

    @zanodor
    Author

    Working on Win11 with opencode-wrap 0.4.1 and opencode 2.0.28. Working on Linux.
    Working in Obsidian Agent Client/Console plugins via acp bridge.


    Health check passes, models endpoint responds, Hermes connects successfully via provider: custom, base_url: http://127.0.0.1:8000/v1. No manual patching needed as we tried before.
    Awesome. Thanks for the quick fix from Hungary.

  8. veerareddyvishal144 commented on Oct 17, 2026

    @veerareddyvishal144
    Contributor

    Cool I am closing this issue

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

Metadata

Metadata

Assignees

No one assigned

    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