Skip to content

OpenCode 1.15 prompt_async compatibility: new sessions fail with SQLITE_CONSTRAINT_NOTNULL #81

@guyq1997

Description

@guyq1997

Summary

When using the iOS client with OpenCode Server 1.15.12, newly-created sessions can accept a user message in the UI but never produce a response. The server receives the prompt_async request and returns HTTP 204, but the async backend task fails with SQLITE_CONSTRAINT_NOTNULL.

Existing older sessions may continue to work, which makes this look like a session-specific or network issue at first.

Environment

  • OpenCode Server: 1.15.12
  • iOS client: current TestFlight / repository behavior
  • Connection: HTTPS via Tailscale Serve with Basic Auth
  • Model tested: openai/gpt-5.5

Reproduction

  1. Start OpenCode server 1.15.12.
  2. Connect from the iOS client over HTTPS.
  3. Create a new session from the iOS client.
  4. Send a message in that new session.
  5. Observe that the message appears to send, but no assistant response arrives.

Observed Behavior

The client request to POST /session/{sessionID}/prompt_async returns 204 No Content, so the iOS UI treats the send as successful.

The server then logs an async failure similar to:

ERROR service=default session.id=... cause={... "code":"SQLITE_CONSTRAINT_NOTNULL" ...} prompt_async failed

The relevant database table has NOT NULL columns:

CREATE TABLE session_input (
  id text PRIMARY KEY,
  session_id text NOT NULL,
  prompt text NOT NULL,
  delivery text NOT NULL,
  admitted_seq integer NOT NULL,
  promoted_seq integer,
  time_created integer NOT NULL
);

Expected Behavior

New sessions created from the iOS client should be able to send prompts and receive assistant responses on OpenCode Server 1.15.12.

Likely Cause

The iOS client appears to send the older prompt_async payload shape. It sends text parts, agent, and model, but does not send a messageID or per-part id.

The current OpenCode Web client generated API call supports/sends fields including:

  • messageID in the body
  • parts[].id in the body
  • directory query parameter
  • optional variant

The missing messageID is the strongest suspect because OpenCode 1.15.12 now queues async prompts through session_input, whose id is NOT NULL.

Suggested Fix

Update the iOS client request shape to match the current Web client behavior:

  • Generate a server-style user message id, e.g. msg_<uuid>
  • Generate a part id, e.g. part_<uuid>
  • Include messageID in the prompt_async JSON body
  • Include id on text parts
  • Include the active session/project directory as a query parameter on session creation and prompt submission

Approximate body shape:

{
  "messageID": "msg_...",
  "parts": [
    {
      "id": "part_...",
      "type": "text",
      "text": "hello"
    }
  ],
  "agent": "build",
  "model": {
    "providerID": "openai",
    "modelID": "gpt-5.5"
  }
}

Notes

This does not appear to be a transport/auth problem: HTTPS, Basic Auth, and older sessions work. The failure happens after prompt_async is accepted, inside the server async processing path.

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