Skip to content

Add deterministic session restore support for Kimi CLI tabs #340

@danshapiro

Description

@danshapiro

Problem

Kimi 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, Kimi 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 Kimi 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.
  • Kimi was not exercised in the final manual provider smoke matrix.
  • The extension manifest at /home/user/code/freshell/extensions/kimi/freshell.json only provides command launch metadata.
  • The fallback command spec in /home/user/code/freshell/server/terminal-registry.ts does not define Kimi session creation or resume arguments.
  • Existing unit tests explicitly expect modeSupportsResume('kimi') to be false.

Required Work

  1. Research Kimi CLI session persistence deterministically, using official docs/source and direct experiments.
  2. Identify whether Kimi 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 Kimi 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 Kimi 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

  • Kimi 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 Kimi tabs is accurate.
  • New Kimi 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