Skip to content

Consume odek turn_started frame as primary streaming-card trigger (supersede lazy-open heuristic) #69

Description

@jkyberneees

Context

odek PR BackendStack21/odek#180 ships the turn_started wire frame (v1.42.0): emitted for every turn immediately after the session frame and before the first streamed frame.

{ "type": "turn_started", "turn_id": "t_<hex>", "session_id": "", "initiated": "operator" | "system", "model": "" }

Streamed frames (thinking / token / tool_call / tool_result / done / error) now carry the same turn_id while the turn is active. Docs: odek docs/WEBUI.md (frame table + compatibility matrix).

Task

Make bodek consume turn_started as the primary trigger for opening the streaming card, superseding the lazy-open heuristic shipped as the client-side mitigation on 2026-09-02.

  1. Primary path: open/upsert the streaming card on turn_started, keyed by turn_id. Idempotent: a replayed or duplicate turn_started must never open a second card.
  2. Supersede the heuristic: the lazy-open (first inbound stream while idle) drops to belt-and-suspenders — keep it, but it should no longer be load-bearing.
  3. Wake turns: rely on initiated: "system" from turn_started instead of the session frame's system_initiated stamp (the stamp remains for old clients but is deprecated as a signal).
  4. Reconnect attribution (optional polish): on reconnect mid-turn, use turn_id on streamed frames to attach strays to the existing card instead of guessing from idle state.

Acceptance

  • Card opens from turn_started on both operator and system-initiated (wake) turns.
  • Duplicate/replayed turn_started is a no-op (upsert by turn_id).
  • Lazy-open heuristic retained only as fallback.
  • Old-odek compatibility: if the server never sends turn_started, behavior degrades to today's (heuristic path still works).

Activity

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