Skip to content

fix(manifest): bridge database_url credential to DATABASE_URL env; require it#7

Open
mgoldsborough wants to merge 1 commit into
mainfrom
fix/manifest-env-mapping
Open

fix(manifest): bridge database_url credential to DATABASE_URL env; require it#7
mgoldsborough wants to merge 1 commit into
mainfrom
fix/manifest-env-mapping

Conversation

@mgoldsborough
Copy link
Copy Markdown
Contributor

@mgoldsborough mgoldsborough commented May 14, 2026

Summary

The manifest declared user_config.database_url but didn't declare a mcp_config.env mapping to bridge it to the DATABASE_URL env var the Python code reads. Setting the URL via Configure UI wrote to the workspace credential store but never reached the bundle subprocess.

In production this manifested in tenant-ipsdi — the bundle only worked because the operator had also set DATABASE_URL on the platform process env via K8s Secret + allowedEnv: ["DATABASE_URL"] passthrough. That's the wrong primary path: per-tenant ops config instead of per-workspace user config.

Changes

  • Add mcp_config.env: { "DATABASE_URL": "${user_config.database_url}" } so the Configure-UI value flows through mpak's prepareServer env substitution at spawn time.
  • Mark database_url as required: true. Pre-fix the bundle would silently start and fail at first tool call with a stack trace; post-fix it fails at prepareServer with the canonical "missing required configuration" message and the nb config set hint.
  • Update the user-facing description: drop the host-env-passthrough workaround language.

Bump 0.4.2 → 0.4.3.

Operator action required (breaking for misconfigured installs)

Existing workspaces with the field unset will fail at next bundle spawn after upgrading. Affected operators set the credential via Configure UI or nb config set @nimblebraininc/synapse-db-query database_url=... -w <wsId>.

Workspaces that already have the credential saved continue to work — set_user_config already auto-respawns the bundle, and v0.4.3 makes that respawn actually meaningful.

Test plan

  • make check — 12 passing
  • Manual: install in a workspace, set database_url via Configure UI, run a query end-to-end
  • Manual: remove the credential, restart bundle, verify the failure message names database_url and includes the nb config set hint

…quire it

The manifest declared `user_config.database_url` but did not declare
`mcp_config.env: { DATABASE_URL: "${user_config.database_url}" }`, so
setting the URL via the Configure UI wrote to the workspace credential
store but never reached the bundle subprocess. The Python code only
reads `DATABASE_URL` from `os.environ`; without the env-substitution
mapping there was no path from credential file to env var.

In practice the bundle only worked when operators bypassed the
Configure flow entirely and set `DATABASE_URL` on the platform process
env (via K8s Secret + `allowedEnv: ["DATABASE_URL"]` passthrough),
which is the wrong primary path — it's per-tenant ops config instead
of per-workspace user config.

This commit:

- Adds the missing `mcp_config.env` mapping so the Configure UI value
  flows through `prepareServer` env substitution at spawn time.
- Marks `database_url` as `required: true` in `user_config`. Existing
  installs with the field unset will fail `prepareServer` at next
  spawn with a clear "missing required configuration" error and the
  `nb config set` hint — much better than the silent "DATABASE_URL is
  not set" stack trace at first tool call.
- Drops the manifest description's reference to the
  host-env-passthrough workaround. Configure UI is now the canonical
  path.

Operators who currently rely solely on host-env passthrough on
production tenants need to set the credential via Configure UI (or
`nb config set ... database_url=...`) for affected workspaces. The
platform's set_user_config handler already auto-respawns the bundle
after a credential write — surfaced in v0.4.3 because the credential
now actually does something.

Bump 0.4.2 → 0.4.3.
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