Skip to content

update_stack_env: isSecret:false vars are orphaned on GIT stacks — #110's .env routing targets the wrong store (git stacks read env from the DB) #231

Description

@khairulimran-97

Symptom

On a git stack, update_stack_env with isSecret:false variables returns success (env.nonSecretsWritten: N) but the variables:

  • never appear in get_stack_env,
  • leave validate_stack_env reporting them as missing / valid: false,
  • never show in the Dockhand UI's stack env editor,
  • and are not used by deploys.

Secrets (isSecret:true) work fine. Variables entered through the Dockhand UI dialog on the same git stack are immediately visible to get_stack_env, validate_stack_env, and deploys.

Reproduced live on Dockhand v1.0.43 (hawser-edge environment), mcp-dockhand ghcr.io/strausmann/mcp-dockhand:latest (pulled 2026-08-20, ≥ v1.10.0).

Reproduction

  1. Create a git stack with no env vars.
  2. update_stack_env with {key: "FOO", value: "bar", isSecret: false}success: true, env.nonSecretsWritten: 1.
  3. get_stack_envFOO absent. validate_stack_envFOO not in defined. UI env pane → empty.
  4. Enter FOO in the UI stack dialog instead → everything sees it.

Root cause (verified against both sources)

remove_stack_env_vars has the mirrored problem — it removes non-secrets from the file, so it cannot remove a git stack's DB-stored non-secrets.

Contributing cause: upstream OpenAPI is misleading

With FEAT_API_DOCS=true on Dockhand v1.0.43, PUT /api/stacks/{name}/env is documented as "Save a stack's secret env vars to the DB (secrets never hit disk)" and GET as "non-secrets from file" — the git-stack branch is not documented at all. The PUT body schema also declares variables: string[], while the handler requires [{key, value, isSecret}]. Since mcp-dockhand is built to follow this document, the wrong routing follows naturally. Probably worth an upstream Finsys/dockhand doc issue too.

Proposed fix

In update_stack_env (and remove_stack_env_vars): resolve the stack's sourceType first; when git, send non-secrets to PUT /api/stacks/{name}/env (the DB, together with secrets) instead of /env/raw; keep the current /env/raw routing for internal/adopted stacks. Update both tool descriptions to state the per-source-type routing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions