#3552·Archon

Interrupted foreground run can leave bash child alive and duplicate side effects on resume

Author: Emini-TraderCreated Sep 30, 2026Updated Sep 30, 2026
Labelsbug

Problem

When a foreground workflow run is terminated with SIGTERM while a bash node is running, Archon correctly records the run as failed and resumable, but the subprocess executing the in-flight node can continue running after the Archon owner process exits.

If the same run is then resumed, Archon retries the interrupted node from the beginning while the original subprocess may still be running.

In a deterministic reproduction, both the original attempt and the resumed attempt completed and produced side effects: BEFORE_CRASH CRASH_ATTEMPT CRASH_WINDOW_COMPLETED CRASH_ATTEMPT CRASH_WINDOW_COMPLETED AFTER_RESUME

The previously completed node was correctly skipped on resume. The problem is specifically that the original process for the interrupted node remained alive and completed after the foreground Archon process had terminated.

Why

This can make workflow resume unsafe for nodes with side effects.

For example, a build, repair, test, deployment, or other command may continue modifying the same worktree or external resource after Archon has recorded the run as interrupted.

If the workflow is resumed before that old process exits, Archon can start a second execution of the same node while the first execution is still active.

This can cause:

  • concurrent writes to the same worktree;
  • duplicate external side effects;
  • race conditions between the original and resumed attempts;
  • resumed workflows operating under the assumption that the interrupted attempt has stopped when it has not.

This matters for unattended or remotely controlled workflows where interruption and later resume are expected recovery mechanisms.

Desired outcome

When a foreground workflow owner is interrupted by SIGINT or SIGTERM, any process tree belonging to the currently running node should no longer be executing before the run can be safely resumed.

After resume:

  • nodes completed before the interruption should remain skipped;
  • the interrupted node may be retried from the beginning;
  • no process from the previous attempt should still be running concurrently with the resumed attempt.

Acceptance

  • Interrupting a foreground workflow during a long-running bash node terminates that node's complete process tree.
  • After the run reaches its resumable failed state, no process from the interrupted node continues producing side effects.
  • workflow resume skips nodes that completed before the interruption.
  • The interrupted node is executed once after resume, with no overlapping execution from the previous attempt.
  • The reproduction below produces exactly one CRASH_WINDOW_COMPLETED entry after resume.
  • Existing interruption metadata remains correct, including stop_reason.reason = process_terminated and the received signal.

Evidence

The issue was reproduced deterministically with a workflow containing only bash nodes. No AI provider behavior is required to trigger it.

Reproduction

  1. Create the following workflow: name: crash-resume-repro description: Reproduce subprocess survival across foreground interruption. interactive: false nodes:
  • id: before_crash bash: | set -eu printf '%s\n' 'BEFORE_CRASH' >> "$ARTIFACTS_DIR/lifecycle.log"
  • id: crash_window depends_on: [before_crash] timeout: 180000 bash: | set -eu printf '%s\n' 'CRASH_ATTEMPT' >> "$ARTIFACTS_DIR/lifecycle.log" sleep 60 printf '%s\n' 'CRASH_WINDOW_COMPLETED' >> "$ARTIFACTS_DIR/lifecycle.log"
  • id: after_resume depends_on: [crash_window] bash: | set -eu printf '%s\n' 'AFTER_RESUME' >> "$ARTIFACTS_DIR/lifecycle.log"
  1. Start it as a normal foreground CLI workflow and record the Archon process PID: archon workflow run crash-resume-repro
    --cwd /path/to/repo
    --branch spike/crash-resume
    "Validate crash and resume." & ARCHON_PID=$! Wait until the output shows: [crash_window] Started Then terminate the Archon process: kill -TERM "$ARCHON_PID"

  2. Inspect the run. Observed state: status: failed error: Process terminated (SIGTERM) stop_reason: reason: process_terminated signal: SIGTERM before_crash: completed crash_window: running after_resume: pending

  3. Then resume the same run: archon workflow resume <RUN_ID> Archon correctly reports: Resuming workflow crash-resume-repro — skipping 1 already-completed node(s). [before_crash] Skipped (prior_success) [crash_window] Started

  4. After the resumed run progresses, inspect: $ARTIFACTS_DIR/lifecycle.log Observed result: BEFORE_CRASH CRASH_ATTEMPT CRASH_WINDOW_COMPLETED CRASH_ATTEMPT CRASH_WINDOW_COMPLETED AFTER_RESUME The first CRASH_WINDOW_COMPLETED was written by the original subprocess after the foreground Archon process had already been terminated. The second was written by the resumed execution of the same node.

Environment

  • Archon version or commit: v0.11.1, CLI reports git commit aa095446
  • Platform or adapter: CLI, foreground workflow, external git worktree
  • Database: SQLite
  • OS: macOS 27.0, Build 26A428, Apple Silicon (arm64)

Logs or screenshots

Immediately after interruption, workflow get <RUN_ID> --json --verbose reported: { "status": "failed", "metadata": { "error": "Process terminated (SIGTERM)", "stop_reason": { "reason": "process_terminated", "signal": "SIGTERM" } }, "terminal_record": { "nodes": [ { "node_id": "before_crash", "state": "completed" }, { "node_id": "crash_window", "state": "running" }, { "node_id": "after_resume", "state": "pending" } ] } }

Resume output: Resuming workflow crash-resume-repro — skipping 1 already-completed node(s). [before_crash] Skipped (prior_success) [crash_window] Started

Persisted lifecycle log after resume: BEFORE_CRASH CRASH_ATTEMPT CRASH_WINDOW_COMPLETED CRASH_ATTEMPT CRASH_WINDOW_COMPLETED AFTER_RESUME

No AI provider behavior is required to reproduce the issue. The workflow uses only deterministic bash nodes.

Constraints and related work

  • Must remain true: interrupted foreground runs remain resumable, nodes completed before interruption are not re-executed, interruption reason and signal remain persisted and visible to the operator.
  • Known prerequisites or blockers: none known.
  • Related issues or PRs: #1242 / #1248 appear related to process-tree handling for bash/script node timeouts; #3502 covers persisted interruption reasons and resumable foreground runs; #3446 covers stopping an active owner before releasing lifecycle ownership in abandon/cancel paths.
  • Solution steering: Hint — Archon already has process-tree termination behavior in other lifecycle paths. A similar invariant may be relevant here, but this report does not assume the implementation cause.

Additional notes

The workflow-state recovery itself behaved correctly.

The completed predecessor node remained completed, the interrupted node was selected for retry, and downstream execution continued after the retry.

The issue is specifically that the original in-flight subprocess remained capable of completing after the foreground Archon owner process had terminated, allowing the original and resumed executions of the same node to overlap.