Skip to content

Windows: show and end orphaned processes left in a session after an agent command times out #1915

Done

Description

@amrmelsayed

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.

  1. Show them. afx status and codev doctor list, 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).
  2. End them on request. A new afx subcommand 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

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

  1. added
    area/tower
    on Nov 17, 2026
  2. changed the title [-]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[/+] on Nov 22, 2026
  3. amrmelsayed commented on Nov 22, 2026

    @amrmelsayed
    CollaboratorAuthor

    On it! Working on this with the PIR protocol (plan + dev-approval gates before PR).

  4. added 12 commits that reference this issue on Nov 22, 2026
  5. 1 remaining item

  6. added 13 commits that reference this issue on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/tower

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions