Skip to content

fix(agent): requestAbort() must cascade to active RLM child runs #25

Description

@rynfar

Part of #22 (Meridian reliability umbrella). P1.

Problem

AgentSession.requestAbort() (packages/coding-agent/src/core/agent-session.ts) aborts retry, compaction, bash, refine, and agent.abort() — but does not cancel active RLM child runs. Only abort() calls _cancelActiveRlmChildRuns(). Every user-facing cancel path uses requestAbort(): in-process-agent-connection.ts (both call sites), daemon abort and abort_and_clear_queue, and interactive Ctrl-C. So when a user cancels a parent turn, in-flight RLM children keep running — holding proxy concurrency slots and consuming the Claude Max subscription until they finish or idle out. This is the Prime-side half of Meridian's documented "incomplete parent-to-child cancellation" failure mode; per-child cancel machinery already exists (cancelRlmChildRun, _cancelRlmChildRun) but nothing user-facing invokes it.

Proposed shape

  • requestAbort() cancels (or explicitly quiesces, for children intentionally detached as background work) active RLM child runs, or a cascade option threaded from the user-facing call sites — decide the default deliberately: retained/background children may need to survive a parent turn abort, but interactively cancelled foreground work should not leave orphans.
  • The fork's correlated prompt lifecycle (packages/coding-agent/src/core/prompt-lifecycle.ts, currently pre-delivery only via cancelPromptLifecycle) is the natural home for scoped, recursive post-delivery cancellation — it already owns per-prompt ownership and request fingerprints.
  • Pairs with proxy-side work (umbrella Meridian reliability: make concurrent RLM subagents production-safe over Claude Max #22): once children carry a parent linkage in metadata.user_id, Meridian can also tear down child SDK subprocesses when the parent's request aborts.

Acceptance

  • Ctrl-C / connection abort on a parent with running foreground RLM children terminates the children's provider streams (verify no further child requests hit a stub provider after the abort).
  • Retained/background children behavior is explicitly specified and tested, not incidental.

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions