Skip to content

fix(tui): open wake/remote cards lazily when the wire stamp is missed - #67

Merged
jkyberneees merged 1 commit into
mainfrom
fix/wake-card-resilience
Sep 3, 2026
Merged

fix(tui): open wake/remote cards lazily when the wire stamp is missed#67
jkyberneees merged 1 commit into
mainfrom
fix/wake-card-resilience

Conversation

@jkyberneees

Copy link
Copy Markdown
Contributor

Problem

Field report (v0.20.0 ↔ odek v1.40.0): after a background job completed and the wake turn started, the transcript showed nothing of the LLM loop — the busy line stuck at thinking / ● running delegate_tasks, and sub-agent logs surfaced only as transient notes.

Root cause: the wake card opens from exactly one frame (the session frame stamped system_initiated). If that frame is missed, the turn streams with no open card — thinking/token/tool_call drop silently while m.status still mutates unconditionally, and subagent_state/subagent_log degrade to transient notes.

Fix

In bodek every operator turn starts with a local send, so idle + incoming stream proves a server-initiated turn. ensureWireTurn now lazily opens the card from the first streamed event:

  • wake-marked (⬡ odek · wake) when bg_wake armed it — the wake keeps its identity even without the stamp
  • plain remote card otherwise (e.g. a turn started from another client on this session) — visible instead of dropped
  • heals the normally-unreachable busy-without-card state instead of deadlocking
  • stamped-frame behavior and live-operator suppression unchanged (TestWakeCardSuppressedWhileBusy stays)
  • wakeArmed retires at turn end and on local sends — no stale mislabeling

Tests (RED-first)

New wake_resilience_test.go: idle+stream opens a card (with/without bg_wake), full lifecycle finalizes to ready, corrupt busy heals, no card stacking on live operator turns, wake-arm retire/re-arm. Confirmed RED before the fix (4/5 failing), GREEN after.

Verification

  • go test -race -count=1 ./... — 7/7 packages ok
  • go vet ./... clean, go fmt clean (golangci-lint via CI)
  • AGENTS.md + README wake sections updated in the same commit

Follow-up (odek-side, out of scope here)

TEMP_ODEK_TURN_STARTED_TASKS.md (local, untracked) drafts a turn_started wire frame spec so clients can reconcile cards explicitly instead of heuristically.

A wake turn whose stamped session frame is lost (reconnect race, wire
quirk) streamed with no open card: thinking/token/tool_call dropped
silently while m.status still mutated, leaving a phantom running-tool
line over an empty transcript and sub-agent frames degraded to
transient notes.

Idle-plus-stream now proves a server-initiated turn (every operator
turn starts with a local send), so the first streamed event opens the
card: wake-marked when bg_wake armed it, a plain remote card otherwise.
The normally unreachable busy-without-card state heals instead of
deadlocking. Stamped-frame behavior and live-operator suppression are
unchanged.
@jkyberneees
jkyberneees merged commit 0d20a0f into main Sep 3, 2026
7 checks passed
@jkyberneees
jkyberneees deleted the fix/wake-card-resilience branch September 3, 2026 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant