Skip to content

Event client does not implement the current OpenCode message contract; question events stall headless turns #28

Description

@TheRealDinghyDog

SSE client parses an obsolete/invented event shape; questions are never answered (H-03 + M-02)

Surfaced by the gpt-5.6-sol final review, verified locally against the OpenCode 1.17.15 OpenAPI document.

The real contract (confirmed from /doc):

  • message.updated carries message metadata in properties.info (no parts).
  • Parts arrive via message.part.updatedproperties.part (plus message.part.delta).
  • session.created/session.updated carry session metadata in properties.info.
  • question.asked / question.v2.asked events exist with /question/{requestID}/reply and /reject endpoints.

applyOpenCodeEvent() (opencode.mjs) only handles message.updated and looks for message.parts/properties.parts arrays; it never handles message.part.updated, never reads properties.info.id/sessionID/parentID (so turnId can become the evt_… envelope id and child sessions are missed), and has no question branch — a plan-agent question waits out the full 30-minute turn timeout. The fake fixture (tests/fake-opencode-fixture.mjs) emits an invented flat shape ({type:"message.updated", sessionID, message:{id, parts}}), so tests reinforce the bug.

Fix:

  • Implement message.part.updated (accumulate/replace parts by part id, respect deltas); treat message.updated as metadata via properties.info.
  • Register child sessions from properties.info; take message ids from properties.info.id.
  • Reject questions immediately with a useful message (deterministic headless policy) instead of stalling.
  • Regenerate fixture event shapes from a version-pinned /doc schema; add contract tests.

Source: gpt-5.6-sol final review H-03 and M-02 (opencode-plugin-cc-analysis.md).

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