Skip to content

Authenticate eval_claims_pipeline + add request timeout#31

Open
DarrenZal wants to merge 1 commit into
regen-prodfrom
darren/eval-harness-auth
Open

Authenticate eval_claims_pipeline + add request timeout#31
DarrenZal wants to merge 1 commit into
regen-prodfrom
darren/eval-harness-auth

Conversation

@DarrenZal

Copy link
Copy Markdown
Contributor

Why

scripts/eval_claims_pipeline.py predates the claims auth overhaul. It sends no Authorization header, so every write step (create / attest / verify / anchor) now returns 401 against the live service — the harness is currently unusable. It also had no socket timeout, so a slow/hung single-worker backend could make it hold connections open indefinitely (a contributor to asyncpg pool starvation).

What

  • _req() adds Authorization: Bearer $KOI_CLAIMS_SERVICE_TOKEN (matches make_service_token_auth on the /claims write endpoints)
  • explicit urlopen(..., timeout=50) — just under asyncpg command_timeout=60, so the asyncpg timeout is the wall and the socket timeout is a clean fallback
  • fail-fast in main() with a clear message if the token is unset (no silent mid-pipeline 401s)

Pure additive; no behavior change when the token is set and the backend is healthy. py_compile clean.

Note

Running the harness still hits the live single-worker service — run serialized, --runs 1, ideally --skip-anchor for off-chain checks, and not during peak / near a restart.

🤖 Generated with Claude Code

The harness predates the claims auth overhaul: it sent no Authorization header,
so every write step (create/attest/verify/anchor) now 401s. Also had no socket
timeout, so a slow/hung single-worker backend could make it hold connections
open indefinitely (a contributor to pool starvation).

- add `Authorization: Bearer $KOI_CLAIMS_SERVICE_TOKEN` to _req() (matches the
  service-token auth on /claims write endpoints)
- explicit urlopen timeout=50s (just under asyncpg command_timeout=60)
- fail fast in main() with a clear message if the token is unset (no silent 401s)

Pure additive; no behavior change when token is set + backend healthy.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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