Repository navigation
Description
Summary
mecatui today has no "open an existing session by ID and view its transcript" path. The conversation view is built exclusively from a live Converse stream — it never loads persisted history. client.GetSession returns metadata-only (Mode + ResolvedModel); the proto Session message carries no conversation messages; and the only event-replay RPC (EventLogService) lives in the driver protocol, not the public HarnessService mecatui consumes.
This blocks #235 (Scheduled tasks Phase 3b: jump-to-fire-transcript), which wants to open a past fire's sched-- session rendered as a normal conversation view. #235's premise — "reuse the existing session-open path" — does not match the code as shipped: there is no such path to reuse.
Scope
Add the capability for mecatui to open a past session by ID and render its prior conversation (transcript) as the normal conversation view, then allow continued interaction.
Two layers:
1. Server: a public event-replay RPC on HarnessService
Add a streaming RPC backed by the existing port.EventLog.Read (already a durable seam, ADR 0027 Phase 3a; the relay persists events; nothing model-facing). This is the honest path: the events already exist in the log; mecatui just needs to read them back.
- New proto RPC on
HarnessService(e.g.StreamSessionEvents(session_id)→ streamEvents) incontracts/proto/mecatl/v1/. - Server
Servicemethod over the existingEventLog.Readiter.Seq2[session.Event, error]. task generateto regeneratecontracts/gen.- This RPC touches the public proto surface →
task api:update+engine/CHANGELOG.mdnote may apply if it crosses the engine port (likely not, since it's a server-only RPC, not anengine/porttype — confirm during implementation).
2. Client + TUI: translate replayed events → conversation view
cmd/mecatui/client/wrapper translating the streamed events → the existingtea.Msgtypes (reuse the sameEventToMsgmapping the liveConversestream uses).- A model path that seeds the conversation view from replayed events, then enters idle (read-only transcript view → can be continued interactively on the next prompt; server-side
loadAndReopenreplays persisted history to the model). - The session-id rebind seam: reuse the
/worktreesswitch template (switchToWorktree) —endRun+resetSession+ adopt the target session id — but replace theCreateSessioncall with an adopt-id + fetch-transcript step.
Decisions to make
- Streaming vs batch. A streaming RPC mirrors
Converse(consistent) but a simpleGetSessionEvents(id)batch RPC may suffice for transcripts that fit in memory. Streaming is likely the right call for parity + unbounded transcripts. SessionSnapshotlacksState. To block opening a still-running session (or to live-tail it),client.SessionSnapshot+ its mapper need aStatefield (the protoSession.statealready exists). One-field client + mapper addition, no proto change.- Still-running sessions. Block opening a running/awaiting session (simplest), or support live-tail (attach to the in-flight run's event channel)? Live-tail is a larger option — likely out of scope for mecatui: open an existing session by ID (view its transcript) #245, defer.
m.capsafter adopt.GetSessiondoes not returnServerCapabilities. AfterresetSessionclearsm.caps, caps-driven affordances (like/scheduleitself) would vanish. Minimal fix: preservem.capsacross the jump (caps are server-wide anyway).
References
- Blocks: Scheduled tasks — Phase 3b: jump-to-fire-transcript #235 (Phase 3b jump-to-fire-transcript).
- Part of: Scheduled tasks: fire an agent run on a cron schedule or at a future time, autonomously and durably #189 (scheduled tasks umbrella).
- Design: ADR 0027 (cloud-native — the durable
port.EventLogthis builds on), ADR 0059 (scheduled tasks). - Phase 3a (the
/scheduleoverlay + inspect view that surfaces fire session ids): Scheduled tasks — Phase 3a: mecatui /schedule slash command + overlay #234 / PR feat(mecatui): scheduled tasks Phase 3a — /schedule slash command + overlay #239. - Code seams (from the Scheduled tasks — Phase 3b: jump-to-fire-transcript #235 architect investigation):
cmd/mecatui/ui/update.go:287(applySessionReady— the session-id bind seam)cmd/mecatui/ui/worktrees.go:171(switchToWorktree— the restart-handoff template)cmd/mecatui/ui/update.go:1768(submitPrompt— the live Converse stream path, never loads history)cmd/mecatui/client/session.go:45(GetSession— metadata-only)cmd/mecatui/client/stream.go:64(ReadLoop— events→msgs, the translation to reuse)internal/adapter/server/service.go:1560(StartRunContent),:1417(loadAndReopen)contracts/proto/mecatl/v1/harness.proto:457(Session— no conversation messages)contracts/proto/mecatl/driver/v1/event_log.proto:58(EventLogService— driver-only today)engine/port/eventlog.go(port.EventLog.Read— the durable seam)
Activity
fix(mecatui): 5 review findings on session-open replay (#245)
feat(server): public StreamSessionEvents + ListSessions RPCs (#245 Ph…
feat(mecatui/client): StreamSessionEvents + ListSessions wrappers (#245…
feat(mecatui): /sessions picker overlay + session-adopt handoff (#245 …
feat(mecatui): transcript rendering for replayed sessions (#245 Phase…
feat(mecatui): still-running state gate + jump-to-fire-transcript (#245…
fix(mecatui): 5 review findings on session-open replay (#245)
feat(session): continue-by-default, MetaLister, replay coalescing + r…
feat(mecatui): direct-open sessions + load history on continue (#245)
feat: open existing sessions, continue by default, fast picker (#245, #…
feat(server): public StreamSessionEvents + ListSessions RPCs (#245 Ph…
feat(mecatui/client): StreamSessionEvents + ListSessions wrappers (#245…
feat(mecatui): /sessions picker overlay + session-adopt handoff (#245 …
feat(mecatui): transcript rendering for replayed sessions (#245 Phase…
feat(mecatui): still-running state gate + jump-to-fire-transcript (#245…
fix(mecatui): 5 review findings on session-open replay (#245)
feat(session): continue-by-default, MetaLister, replay coalescing + r…
feat(mecatui): direct-open sessions + load history on continue (#245)