Skip to content

v0.8.68: persist stateful terminal identity and restart limitations safely #4355

Description

@Hmbown

Problem

Stateful terminal sessions preserve shell state for the lifetime of the current Codewhale process, but the persisted contract is not yet honest or safe across a Codewhale restart. A restarted client must not mistake a reused PID or stale local record for a live shell.

Evidence

The current terminal-session implementation keeps process-local identity, working-directory state, sentinel parsing, cancellation, reset, and approval gating. What is missing is a durable summary and an explicit stale/lost state after restart.

Expected behavior

  • Persist a workspace-scoped terminal identity and a useful last-known cwd/environment summary.
  • Record enough host/process/session fingerprinting to reject PID reuse.
  • After restart, represent an unavailable prior shell as stale/lost rather than silently claiming it was reattached.
  • Offer a clear recovery path that starts a new shell without erasing the historical summary.
  • Keep reset, cancellation, and approval behavior consistent with live sessions.

Likely files

  • crates/tui/src/tools/terminal_session.rs
  • crates/tui/src/session_manager.rs
  • focused terminal-session persistence tests

Acceptance criteria

  • Terminal identity and last-known cwd are saved per workspace.
  • Restart cannot reattach based on PID alone.
  • Stale/lost sessions are surfaced distinctly from running, canceled, and failed sessions.
  • Starting a replacement session preserves an honest historical summary.
  • Tests cover normal persistence, process restart, PID-reuse rejection, reset, and cancel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyBody is self-sufficient per docs/AGENT_RUNNER.md; a remote agent may claim itbugSomething isn't workingenhancementNew feature or requestreliabilityReliability, flaky behavior, retries, fallbacks, and robustnesstoolsTool execution, tool schemas, tool UX, and built-in tool behaviortuiTerminal UI behavior, rendering, or interactionv0.8.68Targeting v0.8.68

    Projects

    Status
    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions