Skip to content

raw-events: accept per-event session IDs when top-level id is msg_* #8

Description

@kunickiaj

Problem

POST /api/raw-events rejects the whole batch if the top-level opencode_session_id starts with msg_, even when every event in events[] includes a valid opencode_session_id.

This breaks backwards-compat for clients that send a wrapper-level msg_* id while also including per-event session IDs.

Expected

  • If events[] contains valid opencode_session_id values, the request should be accepted regardless of the top-level opencode_session_id value.

Actual

  • The request returns 400 when the top-level opencode_session_id starts with msg_.

Proposed fix

  • Only validate/reject a msg_* session id when it is actually used as the default session id for an event.
  • Add a regression test covering:
    • top-level opencode_session_id = msg_*
    • per-event opencode_session_id = sess-*
    • request is accepted and events are recorded.

Acceptance criteria

  • The scenario above returns 200 and records events.
  • Test added.

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