Skip to content

fix(coding-agent): preserve task background services - #242

Merged
Pepps233 merged 5 commits into
mainfrom
fix/environment-owned-background-processes
Sep 20, 2026
Merged

Pepps233 merged 5 commits into
mainfrom
fix/environment-owned-background-processes

Conversation

@Pepps233

@Pepps233 Pepps233 commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

An explicit environment lifetime now transfers those services at shell completion so they remain reachable after CLI or subagent exit, including later failures and interruptions.

Session-owned cleanup remains the default.

Reasoning

Ownership must transfer before the next provider response, not only after successful CLI completion.

Diffex atomically publishes process identities and ownership records before releasing both session and global cleanup registrations, allowing an environment supervisor to recover after forced CLI death.

Active, failed, and timed-out commands remain session-owned.

Changes

  • Add CLI lifetime and ownership-directory flags and SDK policy options, propagated to root, replacement, and child sessions.
  • Add durable handoff records, identity checks, cancellation ordering, and bounded draining of inherited output for environment-owned jobs.
  • Make print-mode signal disposal awaitable and idempotent, including SIGINT.
  • Add real TCP-service CLI regressions in text and JSON modes, plus faux-provider coverage for subagent failure, deadlines, direct bash, and runtime replacement.
  • Preserve the two existing local commits updating Terminal-Bench to Diffex 0.3.0 and its subagent allowlist.

Testing

  • Reproduced the original failure through the actual CLI with a local mock provider and real TCP server.
  • npm run check passed.
  • ./test.sh passed, including 2,942 coding-agent tests.
  • Focused macOS regressions passed: 48 tests across six files.
  • Linux amd64 container regressions passed as root (34 tests) and non-root (37 tests), using the actual CLI and no paid provider calls.

Keep successful background groups alive only after publishing environment ownership. Preserve session cleanup by default and verify identities before later group termination.
- Keep process identities stable across supervisor timezones and retain ownership when publication fails.

- Verify cancellation ordering and preserve default shell timeout behavior.
- Expose environment ownership through CLI and SDK sessions, including child and replacement sessions.

- Keep successful services alive across print-mode shutdown and later failures while terminating active work.

- Cover text and JSON CLI execution, signals, subagent deadlines, and repeated disposal with real TCP-service regressions.
@Pepps233 Pepps233 added bug Something isn't working coding-agent labels Sep 20, 2026
@Pepps233 Pepps233 self-assigned this Sep 20, 2026
@Pepps233
Pepps233 added this pull request to stack #244 September 20, 2026 19:40
@Pepps233
Pepps233 merged commit a40b127 into main Sep 20, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working coding-agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant