Skip to content

fix(runner): track Windows session trees with Job Objects - #349

Draft
techotaku39 wants to merge 1 commit into
heavygee:feat/live-work-by-generationfrom
techotaku39:feat/windows-job-containment-2660
Draft

techotaku39 wants to merge 1 commit into
heavygee:feat/live-work-by-generationfrom
techotaku39:feat/windows-job-containment-2660

Conversation

@techotaku39

Copy link
Copy Markdown

Summary

  • Have Runner-spawned Windows wrappers join a private Job Object before loading the CLI or launching an agent. Preserve detached sessions when the Runner exits, and reopen the Job after restart only when the original wrapper generation can prove membership.
  • Use verified Job membership for StopSession while protecting shared session roots. Record exit evidence by PID and process start marker only after the entire Job is empty.
  • Let Archive consume that evidence through ProbeSessionExit. Keep contained generations unconfirmed when evidence is missing, and retain guarded cleanup for legacy sessions without Job containment.

Validation

  • bun typecheck, bun run build, and bun run --cwd cli build:exe:allinone passed on Windows 10 x64.
  • CLI targeted Vitest suite: 110 passed, covering Job ownership, native Windows behavior, StopSession, and legacy cleanup. From hub/, bun test src/sync/syncEngineArchiveSession.test.ts src/sync/rpcGateway.test.ts: 80 passed. Four of the five new Windows Archive cases failed on the dependency baseline; all five passed with this change.
  • Invoke-HapiTaskPlaywright.ps1 -Name windows-job-containment-2660 -Suite Root terminal-wrap-fidelity.spec.ts --retries=0: 3 passed. Isolated Full acceptance with real Codex sessions also verified that the first Archive returned HTTP 200 after an unexpected wrapper exit, without a prior StopSession.
  • The packaged hapi.exe acceptance verified graceful Runner shutdown, forced Runner termination, and restart. Both original sessions retained their process identity and Job membership. The restarted Runner stopped the recovered target Job and recorded full-tree exit; Archive succeeded and the other session stayed online.

Related Issues

Refs tiann#2660. Depends on tiann#2659. Related: tiann#2035.

AI Disclosure

Implementation and validation were assisted by OpenAI Codex (GPT-6).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant