Skip to content

Incoming intercom message aborts parallel subagents (exit 143) #8

@ssyram

Description

@ssyram

AI-analysis but actually reproduced.

Summary

When pi-subagents runs parallel foreground tasks, an incoming message handled by pi-intercom can abort the parent tool call and terminate all child agents with SIGTERM (exit code 143).

This appears when the session is busy (!ctx.isIdle()), graceful detach is not accepted, and pi-intercom calls ctx.abort().

Repro Steps

  1. Start session A with both plugins enabled: pi-intercom + pi-subagents.
  2. In session A, run a parallel call such as subagent({ tasks: [...] }).
  3. Start session B connected to the same intercom broker.
  4. Send an intercom message from session B to session A while A is still running parallel tasks.
  5. Observe child subagents in A getting terminated.

Actual Result

  • Aggregated run can show 0/N succeeded.
  • Individual tasks fail with exit code 143.
  • Some workers may already have produced valid output before termination.

Expected Result

  • Incoming intercom messages should not hard-abort unrelated parallel subagent work.
  • Busy-session intercom handling should defer or non-destructively queue messages unless explicitly user-aborted.

Suspected Root Cause

In pi-intercom, when busy and detach is not accepted, the handler calls ctx.abort():

  • third-party-plugins/pi-intercom/index.ts (busy message handling branch)

In pi-subagents, foreground parallel child processes inherit the parent abort signal:

  • third-party-plugins/pi-subagents/subagent-executor.ts (runForegroundParallelTasks, passing input.signal)
  • third-party-plugins/pi-subagents/execution.ts (abort listener kills child with SIGTERM)

Detach is often rejected for normal built-in agents because allowIntercomDetach is gated by system prompt content and accepted depends on intercomStarted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions