Skip to main content
← Back to list
01Issue
FeatureOpenSwamp CLI
AssigneesNone

Relationships

#937 swamp serve: eliminate wrapper scripts via @vault= secret refs and native startup hooks

Opened by stack72 · 7/3/2026

Context

Downstream operators run `swamp serve` under a service manager (launchd, systemd, etc.). Two things force every deployment to wrap swamp in a shell script today:

  1. Secrets have to be materialised. Webhook signing secrets and any observability keys (Honeycomb ingest, OTEL exporter headers) live in `swamp vault`, but plist / unit files can't run `swamp vault read-secret`. `--webhook :@env=VAR` and `--webhook :@file=/path` exist, but VAR / file still need to come from somewhere — a wrapper or a materialisation step.
  2. Startup housekeeping has to run. Our factory driver needs `reconcileOrphanedDispatches` to fire N seconds after boot so it can catch dispatches killed with the previous instance. That's a detached background job in the wrapper.

Our current wrapper is 100 lines that read two vault entries, export three OTEL env vars, background a reconcile call, and `exec` swamp. Every deployment writes the same wrapper.

Ask

Two features that together let us delete the wrapper:

1. Native vault reference for secret args

Extend the `@env=` / `@file=` indirection used by `--webhook` to also accept:

``` --webhook '/hooks/linear:linear-webhook:@vault=linear/webhook-secret:linear' ```

Semantics: `@vault=/` resolves via the same code path as `swamp vault read-secret `, at serve start (and on config reload if that lands). Same idea for arbitrary flags that carry secrets, if any grow later.

Rationale: the vault is already the platform-blessed secret store; forcing operators to also maintain `chmod 600` files that mirror the vault duplicates state and drifts on rotation. This closes the gap.

2. Startup hooks / `--on-start` action

Let a serve instance run a swamp method or workflow once, N seconds after the listener comes up. Two shapes worth considering:

  • `--on-start '::[:--input k=v ...]'`, repeatable.
  • `--on-start-workflow ':[:--input …]'`.

Rationale: today every operator that wants a "resume in-flight work after restart" behaviour has to background a `sleep 30 && swamp model method run …` in their wrapper. The retry / logging story is on them. If the runtime owns this, the wrapper collapses.

Anti-goals

  • Not asking for full systemd-esque post-start ordering — just one or two invocations with a delay.
  • Not asking for arbitrary shell in the flag; the invocation should be a swamp method or workflow, not a shell command.

Prior art

  • `--webhook :@env=` and `--webhook :@file=` set the precedent for indirection in flag values.
  • `--no-schedule` already gates a class of background behaviour, so there's precedent for serve owning its own periodic work.

Impact

Every downstream that runs `swamp serve` under a supervisor. Concretely: our factory serve wrapper drops from 100 lines to zero; the plist calls swamp directly.

  • Existing docs work: #1690 (document `@env=` / `@file=`), #1699 (`--ws-idle-timeout`), #1714 (phase-2 `--server`).

Automoved by swampadmin from https://github.com/swamp-club/swamp/issues/1738

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED

Open

7/3/2026, 11:16:05 AM

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.