#335

Fix/example process group timeout

Openability-specwants to merge intofrom

Problem

The Bash subprocess helpers in the example applications only terminate the parent Bash process when a timeout occurs.

If a command spawns child processes that inherit stdout, those children keep the pipe open. As a result, communicate() or wait() can remain blocked even after the configured timeout has expired.

Fix

  • Start subprocesses in a new session using start_new_session=True.
  • Terminate the entire process group with os.killpg() and SIGKILL.
  • Handle ProcessLookupError when the process group has already exited.
  • Apply the same cleanup to the coding agent when its output limit is reached.

Affected files

  • examples/apps/durable_agent_workflows/backend/app/worker.py
  • examples/apps/durable_agent_temporal/backend/app/worker.py
  • examples/apps/coding_agent/main.py

Verification

Manually reproduced on Linux using:

bash -c 'sleep 1 & wait'

With a 0.1-second timeout:

  • Previous behavior: approximately 1.0 second.
  • Fixed behavior: approximately 0.1 second.

The full repository test suite has not been run.

Scope

This is a targeted fix for subprocess cleanup in examples. It does not change the SDK's public API or runtime behavior.

Activity

4
vercel[bot]11d ago

@ability-spec is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.