iiRecord
Agentic AI Atlas · GAP-TOOLS-030: Effect Cancellation
page:docs-harness-features-backlog-gaps-tools-capabilities-gap-tools-030a5c.ai
II.
Page reference

page:docs-harness-features-backlog-gaps-tools-capabilities-gap-tools-030

Reading · 2 min

GAP-TOOLS-030: Effect Cancellation reference

Cancel or stop a running effect mid-execution. CC's TaskStopTool can cancel

Pagewiki/docs/harness-features-backlog/gaps/tools-capabilities/GAP-TOOLS-030.mdOutgoing · 0Incoming · 1

GAP-TOOLS-030: Effect Cancellation

FieldValue
Categorytools-capabilities
PriorityHigh
EffortM
StatusMissing

Description

Cancel or stop a running effect mid-execution. CC's TaskStopTool can cancel background tasks. Babysitter has no cancellation mechanism -- once an effect is dispatched, it runs to completion or timeout.

Current State

Effects are dispatched via ctx.task() and executed by the harness operator. BABYSITTER_TIMEOUT (default 2min) and BABYSITTER_NODE_TASK_TIMEOUT (15min) are the only guards. The invokeHarness() function spawns a child process with a timeout but the operator cannot cancel individual effects. If a harness hangs, the entire run blocks until timeout.

No journal event for cancellation. No EFFECT_CANCELLED type.

Target State

``javascript try { await ctx.task(longRunningTask, args); } catch (e) { if (e instanceof EffectCancelledError) { // handle graceful cancellation } } ``

  • New EFFECT_CANCELLED journal event type
  • task:cancel <runId> <effectId> CLI command
  • Cancel signal propagated to running harness process (SIGTERM then SIGKILL)
  • Effect result marked as status: 'cancelled' with cancellation reason
  • Process code receives cancellation as a thrown error that can be caught:
  • Embedded SDK dashboard shows cancel button for running effects
  • Timeout-based auto-cancellation configurable per task

Dependencies

None (core cancellation is standalone).

**Optional enhancement**: GAP-SUBOBS-004 -- health monitoring can trigger auto-cancel (future integration, not a prerequisite)

Key Files

ComponentPath
Harness invokerpackages/sdk/src/harness/invoker.ts
Runtime exceptionspackages/sdk/src/runtime/ (EffectRequestedError etc.)
Storage eventspackages/sdk/src/storage/ (event types)
Task CLIpackages/sdk/src/cli/ (task:post)

Recommendation

Phase 2. High priority for production use -- runaway effects are a real operational issue. Start with CLI cancellation, then add embedded SDK dashboard button.