Skip to content

opencode2 support? #205

Closed
Closed

Description

@RayBB

Does this work with opencode2?

I followed the steps to set this up pretty simply, but it seems to give me an error when I try to connect. I can post sanitized logs later, but I'm doing this from my phone so it's not easy.

My first thought was maybe it's because I have OpenCode 2 set up, and I didn't see any mention of it in other issues.

Thanks!

Activity

  1. curleyscreek commented on Sep 13, 2026

    @curleyscreek

    I reproduced this with OpenCode Mobile 0.4.15 on Android against the OpenCode 2 preview (opencode2 v0.0.0-beta-19296) over Tailscale. The network path itself is working.

    Server command:

    opencode2 serve --hostname 0.0.0.0 --port 4096
    

    The OpenCode 2 process is confirmed listening on 0.0.0.0:4096. With valid Basic Auth credentials:

    GET /global/health
    HTTP/1.1 200 OK
    content-type: text/html
    

    That route falls through to the OpenCode web SPA (<!doctype html>...), so OpenCode Mobile reports HEALTH-FAILED because it probes /global/health.

    However:

    GET /api/health
    HTTP/1.1 200 OK
    content-type: application/json
    
    {"healthy":true,"version":"0.0.0-beta-19296","pid":44736}
    

    So at least the initial connection failure appears to be an OpenCode 1 vs OpenCode 2 API compatibility issue, not Tailscale/firewall/authentication. I haven't established yet whether changing the health probe alone is sufficient; the session/message/event endpoints may also differ in v2.

    Android diagnostic details: Pixel 10 Pro, Android 37, OpenCode Mobile 0.4.15. Tailscale server address was reachable and the OpenCode 2 /api/health endpoint was verified from the host.

  2. bluetoe-99 commented on Sep 25, 2026

    @bluetoe-99

    v2 server support is implemented in #209 — the app now probes the server at connect time (by response content type, since unknown routes on both server generations answer 200 text/html through the web SPA) and speaks whichever API the server does.

    The connection error you hit is the old client talking v2 routes that fall through to the SPA — that is exactly what #209 fixes, for v2 and keeps v1 (≤ 1.18.x, still what npm install -g opencode-ai installs) working. Would appreciate a test if you get a chance once it lands (or from the bluetoe-99:feat/opencode-v2 branch).

  3. wanlyg commented on Oct 2, 2026

    @wanlyg

    Awesome app! Please consider adding support for OpenCode v2.

  4. Solomag commented on Oct 6, 2026

    @Solomag

    As I was eager to get v2 support, I ended up building the APK from the fork manually, and I can confirm that everything works. Please merge the PR and publish an update as soon as possible.

  5. blancqua commented on Oct 11, 2026

    @blancqua

    Another data point in favor of merging #209: reproduced against the stable release line, not just the preview.

    • Server: opencode serve --hostname 0.0.0.0 --port 4096, version 2.0.26 (auto-updated from 2.0.18), behind a reverse proxy with TLS.
    • OpenCode Mobile 0.4.15 (Play) — connection diagnostics report OK (health endpoint responds), but the app then fails to list sessions: it calls the v1 routes (/session, /experimental/session) which the v2 server answers with 200 text/html (SPA fallback), so there is nothing to parse.
    • With the v2 routes the same server is fine: GET /api/session → 401 without auth, 200 JSON with Basic auth.

    From the app source (v0.4.15/current main) I see no /api/* routes at all, so this is purely v1-only. Happy to test an APK from the bluetoe-99:feat/opencode-v2 branch against 2.0.26 if that helps.

  6. wc4440222 commented on Oct 14, 2026

    @wc4440222

    Same issue here, with details that may help narrow it down:

    • App: v0.4.15 (fdroid build), Android (HarmonyOS NEXT via Android compat layer)
    • Server: opencode Desktop 2.0.29 background service, reached via HTTPS tunnel
    • The in-app connection diagnostic passes (health endpoint 200, server root 200)
    • But login with correct Basic-auth credentials (verified working via curl: HTTP 200 on /api/info) fails in the app
    • Server-side logs show no auth failures at all, so the app seems to fail before/without completing the V2 handshake

    This looks like the V1/V2 protocol gap tracked in #209 rather than a credentials problem.
    Also related: #211 (the diagnostic misleadingly reports password errors).
    Happy to test a V2-support build when one is available.

  7. guteseele20-design commented on Oct 23, 2026

    @guteseele20-design

    Confirmed on current builds — the app (v0.4.15, Android) fails against any OpenCode v2 server I can obtain (desktop background service v2.1.2, then v2.1.3 after the desktop auto-update, Windows):

    • Manual Add Connection (IP + port + password): Connection Failed — Error: JSON Parse error: Unexpected character: <. The app's diag shows "OK 200" for /global/health — it appears to check only the HTTP status, while v2 serves the web SPA shell there (200 text/html) on all non-/api/*//auth/* paths.
    • Pasting a one-time pair link (opencode pair → http://<LAN-IP>:<port>/auth/connect/<code>) into the server-address field: asks for the password → 401 despite correct credentials → "404 api error".
    • /api/health existed in server v2.1.2 (auth-gated, 401 application/json unauthenticated) and was removed in v2.1.3 (404) — worth knowing if any probe still references it.

    Content-type observations from the OpenCode team's angle:

    The OpenCode team confirmed the app targets the v1 HTTP API (/global/health returned JSON in v1, and everything outside /api/*//auth/* falls through to the SPA) — see anomalyco/opencode#58145

    The browser workaround works well today: opencode pair → open the LAN link in the phone's browser → full v2 web UI, 30-day session. Really hoping #209 or #218 lands so the app itself can speak v2!

  8. dzianisv commented on Nov 14, 2026

    @dzianisv
    Owner

    Closing as completed — verified 2026-11-14: OpenCode v2 server support shipped in v0.4.16, commit 66ad0da ('feat: OpenCode v2 server support (v0.4.16)'), an ancestor of both the v0.4.16 and v0.4.17 tags. The v0.4.16 changelog (distribution/changelogs/43.txt) states v2 servers are now supported with connect-time API detection, and main carries src/lib/api-detect.ts + src/lib/v2-shape.ts (with tests) while v1 servers keep working through the legacy client. The original PR #209 closed unmerged — the work landed as direct commit 66ad0da. If you still hit a connection failure on v0.4.16+, please open a new issue with the app version and server version.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions