Skip to content

wn-opencode: terminate descendant tool processes on invocation cleanup #831

Description

@agent-p1p

Problem

wn-opencode timeout and stream-failure cleanup kills and reaps only the immediate OpenCode child PID. OpenCode can launch shell commands, test runners, language servers, and other descendants. Those processes can survive after the harness reports that the invocation was killed and may continue mutating the workspace.

Current evidence: integrations/opencode/marmot/src/opencode.rs spawns the child without a dedicated process group, while kill_and_reap calls start_kill/wait only on that Child. The timeout fixtures use exec sleep, so they do not exercise a non-exec descendant.

Expected behavior

Run each invocation in an isolated process group (or equivalent supported containment) and terminate/reap the whole invocation tree on idle timeout, total timeout, stream failure, and harness cancellation. Add a regression fixture that spawns a distinct descendant and proves it is gone after cleanup.

Scope note

Found while reviewing #830. This cleanup limitation predates that PR, so it should not block the idle-timeout change itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    MEDIUMagent-okThis marks an issue ok to be worked on autonomously by PipbugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions