fix(tui): open wake/remote cards lazily when the wire stamp is missed - #67
Open
jkyberneees wants to merge 1 commit into
Open
fix(tui): open wake/remote cards lazily when the wire stamp is missed#67jkyberneees wants to merge 1 commit into
jkyberneees wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
sessionframe stampedsystem_initiated). If that frame is missed, the turn streams with no open card —thinking/token/tool_calldrop silently whilem.statusstill mutates unconditionally, andsubagent_state/subagent_logdegrade to transient notes.Fix
In bodek every operator turn starts with a local send, so idle + incoming stream proves a server-initiated turn.
ensureWireTurnnow lazily opens the card from the first streamed event:⬡ odek · wake) whenbg_wakearmed it — the wake keeps its identity even without the stampTestWakeCardSuppressedWhileBusystays)wakeArmedretires at turn end and on local sends — no stale mislabelingTests (RED-first)
New
wake_resilience_test.go: idle+stream opens a card (with/withoutbg_wake), full lifecycle finalizes toready, 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 okgo vet ./...clean,go fmtclean (golangci-lint via CI)Follow-up (odek-side, out of scope here)
TEMP_ODEK_TURN_STARTED_TASKS.md(local, untracked) drafts aturn_startedwire frame spec so clients can reconcile cards explicitly instead of heuristically.