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

Relationships

#1488 Validate swamp serve deployment stack on startup

Opened by stack72 · 7/31/2026· Shipped 8/3/2026

Problem

swamp serve has multiple levels of run durability depending on the deployment stack — filesystem datastore (local only), remote datastore without control-plane support (local only), and remote datastore with control-plane support (cross-machine HA). Today, the operator has no visibility into which level their deployment actually provides. They configure a datastore and vault, start serve, and hope for the best.

Mismatches are silent. An operator running S3 datastore with a file-based vault gets durable runs but secrets that vanish on instance replacement — workflows that depend on secrets will fail on the replacement instance with no warning at startup.

Desired Outcome

On startup, serve probes its deployment stack (datastore type, control-plane capability, vault type), resolves the durability mode, logs it clearly, and warns about mismatches. The operator sees exactly what their deployment supports without reading docs.

This is informational only — no behavior change. The --detach-runs flag stays as-is. Flag deprecation and auto-detection of HA mode are tracked separately.

What to implement

Mode resolution logic

Serve checks three things at startup:

  1. Datastore type — filesystem or remote (custom extension)?
  2. Control-plane support — does the sync service advertise controlPlane capability?
  3. Vault type — none, local/file-based, or remote (AWS SM, etc.)?

These resolve to a durability mode:

# Datastore Control-plane Vault Mode Notes
1 Filesystem n/a none/local local Developer laptop. Runs survive disconnection + same-machine restart.
2 Filesystem n/a remote (AWS SM) local Vault doesn't affect run durability. Machine death loses runs.
3 Remote (S3) no (old extension) any local Warn: update extension for cross-machine durability.
4 Remote (S3) yes none durable Warn: no vault configured — workflows requiring secrets will fail.
5 Remote (S3) yes local/file durable (limited) Warn: secrets won't survive instance replacement.
6 Remote (S3) yes remote (AWS SM) durable Full HA. Everything survives instance death.

Startup log output

The mode and warnings are logged after the datastore and vault are initialized, before the server starts accepting traffic.

Scenario 6 — fully durable: [INF] serve: Datastore: @swamp/s3-datastore (control-plane: available) [INF] serve: Vault: @swamp/aws-sm-vault [INF] serve: Mode: durable — runs survive instance replacement

Scenario 1 — local filesystem: [INF] serve: Datastore: filesystem [INF] serve: Mode: local — runs survive process restart

Scenario 5 — mismatch warning: [INF] serve: Datastore: @swamp/s3-datastore (control-plane: available) [WRN] serve: Vault is file-based — secrets will not be available after instance replacement [INF] serve: Mode: durable (limited) — runs survive but secret-dependent workflows may fail

Scenario 3 — extension needs updating: [INF] serve: Datastore: @swamp/s3-datastore (control-plane: not available) [WRN] serve: Update @swamp/s3-datastore for cross-machine durability [INF] serve: Mode: local — runs survive process restart only

Scenario 4 — no vault: [INF] serve: Datastore: @swamp/s3-datastore (control-plane: available) [WRN] serve: No vault configured — workflows requiring secrets will fail after instance replacement [INF] serve: Mode: durable — runs survive instance replacement

JSON mode output

The listening event should include the resolved mode: {"status":"listening","host":"127.0.0.1","port":9090,"mode":"durable",...}

/ready endpoint

New endpoint that returns 200 only after startup validation, reconciliation, replay, and heartbeat registration are complete. The ALB/k8s health check targets /ready so traffic isn't routed to an instance that's still recovering state.

/health continues returning 200 immediately (liveness check, unchanged).

How to detect vault type

The vault configuration is in .swamp.yaml under the vaults/ directory. Each vault has a type field (e.g. "file", "@swamp/aws-sm-vault"). Check whether any configured vault uses a remote type. If no vaults are configured at all, that's the "none" case.

The detection doesn't need to be exhaustive — classify as:

  • "none" — no vaults directory or no vault definitions
  • "local" — all vaults use the built-in file type
  • "remote" — at least one vault uses a custom extension type (e.g. @swamp/aws-sm-vault)

How to detect datastore type and control-plane support

The datastore config is already resolved by the time serve starts. Check:

  • datastoreConfig.type === "filesystem" → filesystem
  • Otherwise it's a custom/remote datastore → check syncService.capabilities?.().controlPlane

This logic already exists in serve.ts for creating the control-plane store — reuse it for the mode resolution.

Scope

This issue is ONLY the informational logging and /ready endpoint:

  • Probe datastore and vault configuration
  • Resolve and log the durability mode
  • Warn about mismatches
  • Add /ready endpoint
  • Include mode in JSON listening output

This issue does NOT include:

  • --detach-runs deprecation (separate issue)
  • Auto-detection of HA mode / removing the flag (separate issue)
  • Any behavior changes — all existing behavior stays exactly as-is

Files to modify

  • src/cli/commands/serve.ts — mode resolution logic, startup logging, /ready endpoint, JSON output

Testing

  • Unit test: mode resolution for each of the 6 scenarios
  • Binary test: verify startup logs show the correct mode for filesystem vs S3 datastore
  • Binary test: /ready returns 503 during startup, 200 after completion
  • Binary test: /health returns 200 immediately

Parent issue: #1448

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

Shipped

8/3/2026, 11:05:08 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack728/3/2026, 9:27:05 PM

Sign in to post a ripple.