Repository navigation
Description
Goal
Make a mecatui session reload/reconnect an authoritative reconciliation, not a selective merge that leaves client-derived server facts ahead of GetSession. The server owns session metadata; the client owns view state (draft input, focus, scroll position, overlays). This is batch 1 of 2, before early live title generation.
Scope
- On reconnect, resume, and session adoption, apply the authoritative server snapshot to session-derived display state, including title/provenance/revision, mode, resolved model and effort, context window, occupancy and cumulative usage when supplied, state, placement, and capabilities. Preserve explicit older-server compatibility for absent fields rather than treating absence as a value.
- Retire stale requests/events from the prior live-stream generation. Order the new snapshot with the reopened live feed so a stale snapshot response cannot erase a newer live event; guard same-session concurrent refetches.
- Keep unsent prompts, queue, navigation, scroll anchors, and other view-only state local. Do not silently abandon an in-flight operator action; reconcile it against the server result.
- Preserve permission/approval recovery through its existing durable replay rather than fabricating approval state from the session snapshot.
- Tests for a snapshot whose title revision decreases after reconnect, a same-ID model with changed effort or smaller window, corrected occupancy/usage, absent legacy fields, stale responses, and a live event racing the snapshot.
Context
Today GetSession refetch goes through a title revision guard (cmd/mecatui/ui/title_ux.go) and a same-model context-window-only merge (cmd/mecatui/ui/surface.go). The reconnect path batches live re-arm and refetch (cmd/mecatui/ui/update.go). The session snapshot is available through cmd/mecatui/client/session.go, but an ordinary refetch applies only a subset.
Delivery
Use a human-reviewed acceptance plan and a separate implementation PR. This issue is the prerequisite for the early title-generation issue (batch 2).
Activity