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

Relationships

#1528 Authenticated users must re-login after swamp serve restart

Opened by stack72 · 8/5/2026· Shipped 8/5/2026

Description

When swamp serve restarts (upgrade, crash recovery, instance replacement), all authenticated users must re-authenticate. Their existing tokens/sessions are invalidated because the server state that validated them is lost.

This breaks the seamless restart experience that the HA work delivers — pending runs are replayed, interrupted workflows are reconciled, but the user is kicked out and has to re-login before they can interact with the server again.

Steps to reproduce

  1. Start swamp serve with --auth-mode token or --auth-mode oauth
  2. Authenticate via swamp auth login --server
  3. Run a command: swamp workflow search --server (works)
  4. Restart serve (kill -TERM, then start again)
  5. Run the same command: swamp workflow search --server
  6. Authentication fails — user must re-login

Expected behavior

After serve restarts, previously authenticated users can continue using the server without re-authenticating. Their credentials should survive the restart.

Analysis

The issue depends on the auth mode:

Token auth (--auth-mode token)

Server tokens are minted via swamp/server-token model and stored as swamp data. The token secret was recently moved to the encrypted control-plane store (#1511). The token data record (name, state, bindings) is in the datastore.

On restart, the server should be able to re-validate tokens from the datastore — the token name and secret are durable. The issue may be that the server-token model's in-memory state isn't rehydrated on restart, or that the vault/control-plane store read path isn't exercised during token validation on a fresh process.

OAuth auth (--auth-mode oauth)

OAuth-minted tokens go through the device authorization flow, which mints a swamp/server-token. The flow stores:

  • OAuth client credentials in the vault (oauth-client-id, oauth-client-secret)
  • The minted server token in the datastore + encrypted secret in control-plane store
  • Collective snapshots on the token record

After restart, the same analysis as token auth applies — the token should be re-validatable from durable state.

Client-side credential storage

The CLI stores server credentials in ~/.config/swamp/servers.json via ServerCredentialRepository. These survive serve restarts — the client still has its token. The question is whether the server can still validate it.

What needs to happen

  1. Investigate: on a fresh serve process, does authenticateServerToken successfully validate a token that was minted by the previous process? If not, what state is missing?
  2. The token secret is in the encrypted control-plane store — does the new process read the encryption key and decrypt successfully?
  3. The token data record (swamp/server-token model) is in the datastore — is it loaded on startup before the first authentication attempt?
  4. Fix whatever gap prevents re-validation so that tokens survive restart seamlessly.

Impact

This affects every authenticated deployment. The HA system handles everything else seamlessly on restart — runs recover, pending work replays, heartbeats re-register. But the user has to re-login, which breaks the "zero-disruption restart" promise.

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

Shipped

8/5/2026, 3:03:33 AM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack728/5/2026, 1:09:50 AM

Sign in to post a ripple.