Skip to content

An open-source, faster Devin alternative

TypeScript

fix(logship): warn loud when AXIOM_INGEST_TOKEN is empty

Igor Zalutski7c340d82a5f6
diff --git a/.agents/work/logship-empty-token-warn.md b/.agents/work/logship-empty-token-warn.md
index d7f26ab7..ddd39683 100644
--- a/.agents/work/logship-empty-token-warn.md
+++ b/.agents/work/logship-empty-token-warn.md
@@ -128,3 +128,7 @@ In prod (after merge + deploy):
- *2026-05-06* — branch + working doc created. No code yet.
Awaiting review before implementation.
+- *2026-05-06* — code changes landed: startup log + spawn-time
+ warning in `cmd/server/main.go`, README rotation note in
+ `deploy/ec2/README.md`. ~15 lines net. `go build ./cmd/server/...`
+ clean. Ready for review.
diff --git a/cmd/server/main.go b/cmd/server/main.go
index 6a8621c8..a6d9db78 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -194,6 +194,15 @@ func main() {
workerRedisURL = strings.ReplaceAll(workerRedisURL, "127.0.0.1", cpIP)
}
+ // Warn loud if we're about to bake an empty AXIOM_INGEST_TOKEN
+ // into a worker. Reachable when the server's cfg was empty at
+ // startup but the secret has since been added to KV and no
+ // restart has happened yet — every worker minted from here will
+ // silently skip log shipping.
+ if cfg.AxiomIngestToken == "" {
+ log.Printf("opensandbox: WARNING: spawning Azure-pool worker with empty AXIOM_INGEST_TOKEN — this worker will not ship sandbox session logs (restart this control plane after the secret is in KV)")
+ }
+
workerEnv := fmt.Sprintf(
"OPENSANDBOX_MODE=worker\n"+
"OPENSANDBOX_VM_BACKEND=qemu\n"+
@@ -407,6 +416,20 @@ func main() {
log.Printf("opensandbox: sandbox session logs read API enabled (dataset=%s)", cfg.AxiomDataset)
}
+ // Worker-bake side: report whether sandboxes spawned by this control
+ // plane will ship logs. The token's value here is whatever cfg.Load
+ // pulled from os.Getenv at startup; it stays frozen until the next
+ // process restart. If a deployment puts the secret in KV but never
+ // restarts this process, every Azure-pool worker baked from here on
+ // will land with an empty AXIOM_INGEST_TOKEN and silently skip
+ // shipping. Logging once at startup turns the silent case into a
+ // paged-on-able journalctl line.
+ if cfg.AxiomIngestToken != "" {
+ log.Printf("opensandbox: workers spawned by this server will ship sandbox session logs to Axiom (dataset=%s)", cfg.AxiomDataset)
+ } else {
+ log.Printf("opensandbox: WARNING: AXIOM_INGEST_TOKEN empty — workers spawned by this server will NOT ship sandbox session logs (set the secret in your secret store and restart this process)")
+ }
+
// Per-sandbox autoscaler. Tier-aligned (1/4/8/16 GB), opt-in per
// sandbox via PUT /api/sandboxes/:id/autoscale.
//
diff --git a/deploy/ec2/README.md b/deploy/ec2/README.md
index 1d577555..5575db02 100644
--- a/deploy/ec2/README.md
+++ b/deploy/ec2/README.md
@@ -80,6 +80,14 @@ token** and a **read/query token**, both scoped to the dataset. The default
dataset name is `oc-sandbox-logs` — override `AXIOM_DATASET` only if you want
isolation from other developers.
+> ⚠️ Rotating any `AXIOM_*` value (ingest token, query token, dataset)
+> requires a **server restart** to take effect — the values are read from
+> the environment once at `config.Load` and frozen for the process lifetime.
+> Workers spawned by a server with a stale `cfg.AxiomIngestToken` silently
+> bake an empty value into their cloud-init. Watch for the
+> `WARNING: AXIOM_INGEST_TOKEN empty` line in `journalctl -u
+> opensandbox-server` after any rotation.
+
### 4. Get WorkOS staging keys + register the redirect URI
From the team WorkOS staging project, grab the API key (`sk_test_...`) and