Skip to content

fix(compose): the stdio token the gateway never got - #32

Merged
blakebauman merged 1 commit into
mainfrom
fix/compose-shim-token
Aug 11, 2026
Merged

blakebauman merged 1 commit into
mainfrom
fix/compose-shim-token

Conversation

@blakebauman

Copy link
Copy Markdown
Member

The bug

The documented --profile stdio flow (docs/deploy.md) could not work as shipped.

The shim's bearer is resolved by the gateway, not the shim — auth/upstream.go:91 reads the upstream's secretRef from fold's own environment. But compose.yaml passed SHIM_TOKEN only to the stdio service and left it commented out for fold, so the upstream failed to authenticate on every start.

Now passed as ${SHIM_TOKEN:-}, which preserves the file's deliberate property of having no compose-level required variables (the :- default keeps docker compose up clean for anyone not running the profile).

Also

  • make compose-up / compose-down / compose-logs, with a PROFILES variable — defaults to stdio observability, PROFILES= for the gateway alone. SHIM_TOKEN is generated into .env once rather than per invocation: a fresh value on every up would leave the running shim rejecting the gateway until both restart.
  • gitignore fold.config.json, .env, data/. The docs tell operators to copy the example config to the repo root, which then sat untracked in git status.
  • Docs: docs/deploy.md gains the make targets and the both-services explanation; README "Deploying" now lists all three profiles (it still said "an optional Redis profile", predating the stdio and observability profiles).

No Go code changed; no config fields, schema, or defaults touched.

Verification

Ran the full stack on a local host — all four services up, files upstream connected, the fold Prometheus target scraping without the 403, the packaged Grafana dashboard loaded, and an MCP initialize + tools/list through the gateway returning 14 tools correctly namespaced as files__*.

🤖 Generated with Claude Code

The documented `--profile stdio` flow could not work. The shim's bearer is
resolved by the *gateway* — auth/upstream.go:91 reads secretRef from fold's
own environment — but compose passed SHIM_TOKEN only to the shim service,
leaving it commented out for fold. So the upstream failed to authenticate on
every start. Passed as ${SHIM_TOKEN:-}, which keeps the file's deliberate
property of having no compose-level required variables.

Also:

- make compose-up / compose-down / compose-logs, with a PROFILES variable
  (default "stdio observability", PROFILES= for the gateway alone).
  SHIM_TOKEN is generated into .env once rather than per invocation: a fresh
  value on every `up` would leave the running shim rejecting the gateway
  until both restart.
- gitignore fold.config.json, .env, and data/. The docs tell operators to
  copy the example config to the repo root, which then sat untracked in
  git status.
- Document both in docs/deploy.md and the README.

Verified end to end on this host: all four services up, the fold Prometheus
target scraping (no 403), the packaged dashboard loaded, and an MCP
initialize + tools/list through the gateway returning 14 tools namespaced
as files__*.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@blakebauman
blakebauman merged commit 5b25048 into main Aug 11, 2026
6 checks passed
@blakebauman
blakebauman deleted the fix/compose-shim-token branch August 11, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant