Skip to content

fix(serving): send X-DGem-Key on entrypoint self-warmup requests - #58

Merged
ghchinoy merged 1 commit into
GoogleCloudPlatform:mainfrom
ghchinoy:fix/entrypoint-warmup-server-key
Nov 9, 2026
Merged

ghchinoy merged 1 commit into
GoogleCloudPlatform:mainfrom
ghchinoy:fix/entrypoint-warmup-server-key

Conversation

@ghchinoy

@ghchinoy ghchinoy commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes startup self-warmup authentication in the serving container (deploy/cloudrun/entrypoint.sh) when DGEM_SERVER_KEY (or API_KEY) is configured:

  • Send X-DGem-Key on self-warmup requests (deploy/cloudrun/entrypoint.sh): Extracts the first non-empty key from DGEM_SERVER_KEY and sends it as X-DGem-Key (plus Authorization: Bearer when API_KEY is set), targeting SS_PORT so both ROLE=default and ROLE=decision-index warm structured_server.py.
  • Truthful warmed state (warmup_state.json): Records "warmed": true only when all self-warmup requests succeed ("warmed": false if any warmup request fails, instead of unconditionally marking "warmed": true after 401 errors).
  • Unit tests (deploy/cloudrun/server/test_server_key.py): Adds EntrypointSelfWarmupKeyTest executing entrypoint.sh's PYWARM and PYSTATE blocks against an in-process structured_server.py with comma-separated DGEM_SERVER_KEY rotation keys, API_KEY, SS_PORT, and negative 401 error cases.

Closes #57

@ghchinoy
ghchinoy merged commit 676455f into GoogleCloudPlatform:main Nov 9, 2026
12 checks passed
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.

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

1 participant