Repository navigation
Description
Problem
On native Windows, a command started by an agent's tool call keeps running after that tool call times out, until the whole session ends.
Observed on the owner's machine during Spec 1658 (finding M14, cause 2, in codev/reviews/1658-windows-native-non-wsl-support.md) and again on 2026-11-20: several CPU-heavy file-search processes from Git Bash, each with no living parent, still running long after the agent that started them had moved on.
Cause
When an agent's shell command times out, the agent's own tooling ends the shell. On macOS and Linux that ends the command's children too. On Windows it does not, so each child runs on. In Git Bash the filesystem root spans every drive, so a root-wide file search runs for a very long time.
#1910 removes the main trigger (prompts that send agents hunting for framework files). It does not close the gap: any long-running child of a timed-out command has the same fate.
Fix (Codev-side only)
Every session already runs inside a per-session Job Object that Tower owns (Spec 1658), so Tower can tell which processes belong to a session.
- Show them.
afx statusandcodev doctorlist, per session, the processes whose parent has exited: process name, age and CPU time. Windows only. Command lines are not printed (they can carry secrets). - End them on request. A new
afxsubcommand ends the orphaned processes of one session, or of every session in the workspace, after listing what it will end. It never touches a process outside a Codev session's job, and never the session's own shellper, launch loop or agent.
This needs a way to list a job's processes with their parents. The Job Object helper creates and terminates jobs today and has no listing request; add one there. Share the mechanism with any cheaper process snapshot introduced for the liveness sweep.
Out of scope
- Ending orphans automatically. A background process a user deliberately started from an agent's shell also has no living parent, so Tower must not end processes on its own judgment in this change. Revisit, off by default, only if orphans keep appearing after Prompts name framework paths that do not exist in adopter workspaces; agents fall back to find / (Spec 1658 finding M14) #1910.
- Changing how agents' tooling handles timeouts.
- macOS and Linux behaviour.
Verification
- A Windows test that starts a session, plants a child whose parent then exits, and shows it listed by the new status output and ended by the new subcommand, while the session's shellper and agent keep running.
- A test that a process outside any session job is never listed or ended.
- The on-demand Windows workflow dispatched on the branch and linked in the PR.
- Document the behaviour and the new subcommand in the Windows section of
DEPENDENCIES.md, both trees, kept identical.
Related: #1910, Spec 1658 (M14).
Activity
[-]windows: children of a timed-out agent command keep running until the session ends (Spec 1658 finding M14, cause 2)[/-][+]Windows: show and end orphaned processes left in a session after an agent command times out[/+]amrmelsayed commentedon Nov 22, 2026
On it! Working on this with the PIR protocol (plan + dev-approval gates before PR).
[PIR #1915] Plan draft
[PIR #1915] Thread: job breakaway finding
[PIR #1915] Plan revised: drop session-job breakaway first, guards fo…
[PIR #1915] Session jobs allow no breakaway
[PIR #1915] Keep Tower and other sessions out of a session's teardown
[PIR #1915] Show and end orphaned processes per session (Windows)
[PIR #1915] Never list a console host; real-session Windows tests
[PIR #1915] Mirror the afx skill into the Codex trees; regenerate ski…
[PIR #1915] Thread: suite, Windows run and real-session check results
[PIR #1915] Drop the manual ending path: orphans end with their session
[PIR #1915] Thread: ending path dropped, reruns and flakes
[PIR #1915] Teardown guard fails closed; one job listing, one helper …
1 remaining item
[PIR #1915] Guarded teardown ends only the root's tree; tests kill on…
[PIR #1915] Prevent instead of guard: Tower refuses to run inside any…
[PIR #1915] Thread: prevent design, results, boot cost
[PIR #1915] windows-job.windows: never terminate a job holding the te…
[PIR #1915] Thread: worker-death and lost-runner evidence
[PIR #1915] Thread: two consecutive green Windows runs
[PIR #1915] Thread: merged origin/main
[PIR #1915] Review + retrospective
[PIR #1915] Consultation follow-ups: exact flag assertion, openBrowse…
[PIR #1915] Thread: review, PR, consultation
[PIR #1915] Windows tests kill a leftover pid only if it is still the…
[PIR #1915] Review: tracked-pids in all Windows test cleanup, final r…
Merge pull request #1959 from cluesmith/builder/pir-1915
release notes: Windows preview label removed, session jobs, afx statu…