Skip to content

POST /api/experimental/session/{id}/wait returns when execution starts, not when the session is idle #55227

Closed as not planned

Description

@StepharoAgent

Description

Version: 2.0.28

After session.prompt, calling session.wait returned after 0.6–12 s in our measurements — each time right when
session.execution.started / the first session.step.started was emitted, while session.execution.succeeded came
6–18 s later. If wait is meant as "until idle", this is a bug; if it means "until the inbox item is
delivered", the docs/OpenAPI description should say so.

Workaround: detect the end via session.execution.{succeeded,failed,interrupted} events plus a reconciliation
with GET /api/session/active after SSE reconnects.

OpenCode version

2.0.28

Operating System

Linux x64 (Ubuntu)

Activity

  1. opencode-agent commented on Oct 13, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report. I couldn't reproduce this on 2.0.28.

    I started opencode serve with a local mock model that streams its replies slowly and listened on GET /api/event. Then I created a session, sent POST /api/session/{id}/prompt, and called POST /api/experimental/session/{id}/wait straight away:

    • One slow text reply (~8 s): wait returned 204 at about 8.3 s, at session.execution.succeeded.
    • Three steps (two slow glob tool calls, then text): wait returned at about 16.9 s, after all three steps and session.execution.succeeded.

    In both runs GET /api/session/active was empty right after wait returned. I didn't find a code path where wait resolves at execution.started.

    These details would help us get closer to your setup:

    1. How you call wait: raw HTTP, the JS SDK, or a plugin's session.wait? Does your client have a request timeout or retry?
    2. Do you call wait only after the prompt request has returned, or at the same time?
    3. What does the run do: which tools, any permission or question prompts, subagents? Which delivery or resume options do you pass on the prompt?
    4. How the server runs: opencode serve, --service, or behind the TUI or desktop app? Is anything else (like the TUI) attached to the same session?
    5. The exact event sequence with timestamps around the moment wait returns, if you can share it.

    You can reply here or edit the issue. If you edit it, please also leave a comment saying you've updated it, so we know when you're done.

  2. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    We haven't heard back, so I'm closing this as not planned for now.

    On 2.0.28, POST /api/experimental/session/{id}/wait returned only after session.execution.succeeded, both for a single slow reply and for a run with several tool-call steps. We couldn't make it return at execution.started, so we need details of your setup to go further.

    If you still see this, please reply or open a new issue with:

    • how you call wait (raw HTTP, SDK or plugin) and whether your client has a timeout or retries
    • whether you call wait before or after the prompt request returns
    • which tools, permission prompts or subagents the run uses
    • how the server is started
    • the timestamped event sequence around the moment wait returns

    We can reopen this once we have those details. Thanks for the report!

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