Skip to content

Serving image: startup self-warmup gets HTTP 401 when DGEM_SERVER_KEY is set #57

Closed

Description

@ghchinoy

What happens

When DGEM_SERVER_KEY is configured on the serving container, structured_server.py requires a matching X-DGem-Key header on every POST request (401 otherwise).

In deploy/cloudrun/entrypoint.sh, the startup self-warmup loop (SELF_WARMUP=1) posts samples=1, vision, and samples=4 warmup requests to http://127.0.0.1:${PORT}/v1/chat/completions with only content-type: application/json (no X-DGem-Key header, no Authorization: Bearer header when API_KEY is set, and targeting $PORT rather than $SS_PORT when ROLE=decision-index).

As a result, when DGEM_SERVER_KEY is set:

  • Every self-warmup request fails with [warmup] failed samples=1: <HTTPError 401: Unauthorized>.
  • warmup_state.json still writes "warmed": true, even though no request reached vLLM and the first live decision request pays the full cold kernel/JIT warmup penalty.

Suggested fix

  1. In deploy/cloudrun/entrypoint.sh, send the first non-empty entry of DGEM_SERVER_KEY in the X-DGem-Key header (and API_KEY as Authorization: Bearer when set) to SS_PORT on startup self-warmup requests.
  2. Record "warmed": false in warmup_state.json if any self-warmup request fails.
  3. Add a unit test in deploy/cloudrun/server/test_server_key.py verifying that entrypoint.sh's self-warmup succeeds with DGEM_SERVER_KEY rotation lists and records "warmed": false on 401.

Activity

  1. added a commit that references this issue on Nov 9, 2026
    d113952
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions