Skip to content

Studio: Windows — a session ends when its claude.exe exits, even after a resume (#936) #948

Backlog

Description

@danielrispler

Parent

#936

What to build

On Windows a session ends when its agent's process is gone, a reused pid doesn't keep it open, and a resumed session isn't ended by mistake. Replaces 01's always-alive arm.

  • pid_alive gains a Windows arm: OpenProcess and WaitForSingleObject(h, 0), access denied counting as alive.
  • The time the session's current pid was first seen is kept beside session.pid in memory, rebuilt by the replay; no new stored field. On Windows the read loop's end check also requires the process to have started before that time (GetProcessTimes), so a reused pid ends the session and a claude --resume (new claude.exe, same session id) does not.
  • agy_version() does not ask a login shell on Windows (it shares read_loop.rs).

Acceptance criteria

  • Rows: a resumed session whose newer pid started after the session's first event stays alive; a pid whose process started after it was first seen ends the session.
  • A Windows-job test of pid_alive for a live, an exited and an inaccessible process.
  • docs/studio/behaviour/sessions.md says how a Windows session ends.
  • Each Windows-only test row is shown red (an assertion failure), then green, on Windows runs of this ticket's own pushed issue-* branch, x64 and arm64; Daniel approves the push when auto mode stops it (Spec: Windows Phase 1 — Claude Code recorded on native Windows, x64 and arm64 #936 breakdown, Q41; the rule is in docs/agents/issue-tracker.md once 01 lands). Both run links are in the PR.
  • npm run check and npm run check:windows pass.

Reading

Touches

  • Files: hook/src/sys.rs, core/src/studio/take.rs, core/src/studio/replay.rs, server/src/session_view.rs, server/src/read_loop.rs, server/tests/read_loop.rs, docs/studio/behaviour/sessions.md
  • Session: auto mode
  • Route: strong · effort high — persistence: the end check appends end events to the log; an untested edge case: real pid reuse, which tests only simulate

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentwindows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions