Skip to content

Add deterministic session restore support for Gemini CLI tabs #339

@danshapiro

Description

@danshapiro

Problem

Gemini CLI tabs are not covered by the deterministic session restore work. In /home/user/code/freshell/.worktrees/deterministic-cli-session-identity-impl/server/terminal-registry.ts, Gemini has no resumeArgs, so Freshell treats it as a live-only provider. That means after a server restart, or after a tab has to be recreated, Freshell cannot reliably reconnect the browser tab to the same Gemini conversation.

This is a real user-facing gap: Freshell should not imply durable restore for a provider unless it has a proven provider-owned session identity and a deterministic way to resume that identity.

Current Evidence

  • The current resilience pass proved durable behavior for OpenCode, Codex, and Claude Code through real-provider contracts or isolated smoke tests.
  • Gemini launched in manual smoke, but did not produce a clean prompt/response/restore proof in that pass.
  • The extension manifest at /home/user/code/freshell/extensions/gemini/freshell.json only provides command launch metadata.
  • The fallback command spec in /home/user/code/freshell/server/terminal-registry.ts does not define Gemini session creation or resume arguments.
  • Existing unit tests explicitly expect modeSupportsResume('gemini') to be false.

Required Work

  1. Research Gemini CLI session persistence deterministically, using official docs/source and direct experiments.
  2. Identify whether Gemini CLI exposes a canonical session id, transcript path, database row, or other provider-owned durable identity.
  3. Identify the exact resume command, if one exists.
  4. Add a real-provider contract that proves:
    • fresh tab launch reaches an interactive ready state,
    • a real prompt gets a response,
    • close/reopen reuses the live terminal while the server is still running,
    • server restart can resume the same Gemini conversation using only the provider-owned durable identity.
  5. Implement Freshell resume support only if the proof exists.
  6. Do not match by cwd, wall-clock time, tab title, or creation ordering.
  7. If Gemini CLI does not support deterministic resume, make that explicit in code, tests, and user-facing behavior rather than silently pretending restore is supported.

Acceptance Criteria

  • Gemini tabs either restore deterministically after server restart, or are clearly classified as non-resumable/live-only with intentional fresh-create behavior.
  • The sidebar status for live Gemini tabs is accurate.
  • New Gemini tabs appear in the sidebar when live.
  • Restore failures emit structured server logs and client-visible errors where appropriate.
  • There is no cwd/time/title heuristic for session identity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions