happy icon indicating copy to clipboard operation
happy copied to clipboard

Self-hosted server missing POST /v1/sessions/:id/messages — mobile app cannot send messages

Open mattissocool opened this issue 8 months ago • 2 comments

Description

When using a self-hosted Happy server with the mobile app (Android), sending messages from the mobile app fails with a 404 error. The mobile app sends a POST /v1/sessions/{sessionId}/messages request, but the self-hosted server only implements GET /v1/sessions/:sessionId/messages — it has no POST handler for that route.

Steps to Reproduce

  1. Set up a self-hosted Happy server using hangox/happy-server:latest Docker image
  2. Connect the Happy mobile app (Android) to the self-hosted server
  3. Open any active Claude Code session in the mobile app
  4. Type a message and tap send

Expected Behavior

Message is sent to the Claude Code session and a response is received.

Actual Behavior

The message fails silently. Server logs show:

404 - Method: POST, Path: /v1/sessions/{sessionId}/messages

Server Logs

INFO: 404 - Method: POST, Path: /v1/sessions/cmn2dzwpa0001p914cgs1ive4/messages,
Headers: {"user-agent":"okhttp/4.12.0", ...}
module: "404-handler"

Analysis

Looking at sources/app/api/routes/sessionRoutes.ts in the server, the only session message route is:

app.get('/v1/sessions/:sessionId/messages', { ... })

There is no corresponding app.post('/v1/sessions/:sessionId/messages', ...) handler.

Environment

  • Server: hangox/happy-server:latest (Docker, self-hosted)
  • CLI: happy-coder v0.13.0
  • Mobile app: Happy Coder (Android, latest from Play Store)
  • Host: macOS (Apple Silicon, M4 Pro)

Notes

  • Reading/viewing conversations from the mobile app works fine (GET endpoint exists)
  • Desktop CLI sessions sync properly via websocket
  • The mobile app can see live updates but cannot send messages back to sessions

mattissocool avatar Mar 31 '26 15:03 mattissocool

you are not getting server images from the latest repo

eugeneYWang avatar Apr 01 '26 06:04 eugeneYWang

This is a good place to separate three receipts instead of treating the mobile POST as one success/failure.

For a self-hosted server path, I would expose:

  • mobile request accepted (POST /v1/sessions/:id/messages)
  • target session resolved (session id, cwd/project, live process owner)
  • message applied to the running Claude session, with output/transcript advancement or stale / rejected / timeout

That would make this failure state precise: mobile_can_read_session_but_write_route_missing, not just a silent send failure.

Disclosure: I maintain Faryo, which is a narrower tmux-first control surface. The v1.0.7 walkthrough shows the receipt shape I mean: phone/browser input, text handoff, and attachment handoff only count after they land back in the same live tmux-backed session. https://github.com/Snailflyer/faryo/releases/download/v1.0.7/faryo-public-redacted-same-session-handoff-walkthrough-20260528-0120.gif

Snailflyer avatar May 28 '26 00:05 Snailflyer

For anyone hitting this on a happy-server-light fork: put up a fix at leeroybrun/happy-server-light#1.

The 30s `Message failed to send in background` error turned out to be two missing routes:

  • `GET /v3/sessions/:id/messages?before_seq=N` — iOS App 1.7.0 switched to v3 with snake_case query params for history polling
  • `POST /v3/sessions/:id/messages` — the new send-message endpoint (body `{messages:[{localId,content}]}`, replaces the socket.io `message` event for outbound)

Both 404 → App gives up after 30s. Adding both v3 routes mirroring the existing v1 handler logic fixes it end-to-end. Tested with iPhone `Happy/144` against a self-hosted instance: history loads, messages send, push notifications fire when Claude responds.

cuiyuxin-gif avatar Jun 15 '26 02:06 cuiyuxin-gif