feat(runtime): Grok Build multi-turn session resume

Author: DoGMaTiiCCreated Jul 21, 2026Updated Sep 17, 2026
Labelsenhancementhelp wantedneeds-product-direction

Parent

https://github.com/nexu-io/open-design/issues/5946

What to build

Add multi-turn Grok Build sessions in Studio using Grok's native session resume, so follow-up design directions keep context without re-sending the full web transcript every turn.

End-to-end path:

  1. Depends on streaming runtime (#5948): each completed Grok turn emits an end event with sessionId.
  2. Daemon captures that id (capture-style resume) and stores it for the (conversation, agent) pair using the existing agent session resume machinery and invalidation guards (model change, cwd change, conversation advanced).
  3. On a later turn with a valid stored session, spawn Grok with --resume <sessionId> and only the latest user turn as the composed user payload (no double-packed transcript).
  4. Do not use Grok's -c / continue-most-recent-in-cwd (ambiguous across projects).
  5. If resume fails (expired/missing session), clear the stale handle and reseed with a full transcript path consistent with other capture-style adapters—without flashing a misleading hard failure when transparent recovery is intended.

Product decisions (from parent PRD):

  • resumesSessionViaCli + capture-from-stream for grok-build.
  • Resume is a vertical slice on top of streaming; do not re-litigate stream parsing except as needed to emit/persist sessionId.
  • Skills still stage per OD's shared skill composition rules; first turn establishes context in Grok's session memory.

Acceptance criteria

  • After a successful Grok turn, a session id from end is stored for that conversation/agent
  • Second turn in the same Studio conversation passes --resume <sessionId> in the spawned argv (visible in daemon log)
  • Follow-up brief such as "change the hero copy" continues prior design context without pasting the full prior transcript into the prompt
  • Resume is skipped/invalidated when model or project cwd changes (or other existing resume guards fire); a fresh session is used
  • Resume failure clears stale handle and recovers via reseed rather than leaving the conversation permanently stuck
  • Unit or focused tests cover buildArgs/resume wiring and/or session id capture from a fixture end event
  • Agent-adapter docs mention Grok resume (--resume, capture-style, no -c)
  • Manual E2E: two-turn design session described in the PR body

Blocked by