Skip to main content
← Back to list
01Issue
FeatureShippedSwamp CLI
Assigneesstack72

Relationships

#1505 Auto-detect HA mode and deprecate --detach-runs flag

Opened by stack72 · 8/2/2026· Shipped 8/4/2026

Problem

The --detach-runs flag is scaffolding that gates all HA behaviors. Operators must know to pass it to get run durability. The flag name doesn't communicate what it does, and the behaviors it controls should be automatic based on the deployment stack.

With startup validation shipped (#1488), serve already resolves its durability mode (local vs durable) at startup based on the datastore and vault configuration. The system knows its capabilities. The flag is redundant.

Approach

Stop checking the flag. Enable HA behaviors based on what the infrastructure supports — the mode resolution from #1488 determines what activates:

Filesystem datastore → Phase 1+2 behaviors

Always active, no flag needed:

  • ActiveRunRegistry always created (detached runs, run.attach)
  • Detached task handlers always used (runs survive disconnection)
  • Pending run hooks wired to SQLite (durable intake)
  • reapDeadProcessRuns at boot
  • interrupt() instead of cancel() in reapOrphanedWorkflowRuns
  • Pending run replay from SQLite

Remote datastore with control-plane → Phase 1+2+3 behaviors

Activates automatically when the datastore supports it (syncService.capabilities().controlPlane), no flag needed:

  • Everything from Phase 1+2 above, plus:
  • Control-plane store created from sync service
  • Instance heartbeat started
  • Durable pending runs dual-written to SQLite + control-plane store
  • reconcileRemoteInterruptedRuns at boot
  • Continuous reconciliation timer
  • Startup cache hydration
  • Pending run replay merged from SQLite + remote

This is exactly how it works today WITH --detach-runs. The change is: remove the flag gate so it happens automatically.

Flag deprecation

If --detach-runs is passed, log a deprecation warning:

[WRN] serve: The --detach-runs flag is deprecated and has no effect. HA mode is determined automatically by your datastore configuration. See startup mode log for details.

Keep the flag on the CLI definition so existing scripts, systemd units, and Kubernetes manifests don't break on the next upgrade. If detach-runs: true appears in serve.yaml, accept it with the same deprecation warning. Remove the flag entirely in a later release.

What NOT to change

  • Do NOT remove the fallback code paths (the if (!registry) branches in the handlers). They become dead code but removing them is a separate cleanup once the always-on behavior is proven in production.
  • Do NOT change any HA behavior — this is purely about removing the flag gate, not changing how the features work.
  • Do NOT change the mode resolution logic from #1488 — reuse it as-is.

Testing

  1. Verify serve starts with Phase 1+2 behaviors active on filesystem datastore WITHOUT --detach-runs
  2. Verify serve starts with Phase 1+2+3 behaviors active on S3 datastore WITHOUT --detach-runs
  3. Verify --detach-runs logs deprecation warning
  4. Verify all existing tests pass without the flag
  5. Run all three binary verification suites (normal serve, detached runs, safe restarts) — all should pass regardless of whether --detach-runs is provided
  6. Verify the mode log output matches the activated behaviors

Files to modify

  • src/cli/commands/serve.ts — remove all if (detachRuns) gates, replace with capability-based checks where needed. Add deprecation warning when flag is present.
  • src/cli/commands/serve.ts — the --detach-runs option stays in the CLI definition but is ignored.
  • src/serve/handlers/workflow_handlers.ts — the if (!registry) fallback paths become dead code but are NOT removed.
  • src/serve/handlers/model_handlers.ts — same.

Parent issue: #1448

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 7 MOREREVIEW+ 4 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

8/4/2026, 9:10:42 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack728/4/2026, 6:58:43 PM

Sign in to post a ripple.