Skip to content

ci(temporal): cache test-server binary to fix temporal.download 429 flakes#382

Merged
Abhijeet Prasad (AbhiPrasad) merged 2 commits intomainfrom
ci-cache-temporal-test-server
May 1, 2026
Merged

ci(temporal): cache test-server binary to fix temporal.download 429 flakes#382
Abhijeet Prasad (AbhiPrasad) merged 2 commits intomainfrom
ci-cache-temporal-test-server

Conversation

@starfolkai
Copy link
Copy Markdown
Contributor

@starfolkai starfolkai Bot commented May 1, 2026

Summary

  • Temporal integration shards have been failing CI intermittently with RuntimeError: Failed starting test server: HTTP status client error (429 Too Many Requests) when fetching temporal-test-server_*.tar.gz from temporal.download. Every CI run downloads ~80 MB per shard, and the CDN rate-limits GitHub Actions IP space.
  • Cache the temporalio SDK's binary download directory across CI runs so each shard reuses the binary instead of re-downloading. The temporalio SDK already keys cached binaries by Python SDK version (temporal-test-server-sdk-python-<version>) and reuses them when download_dest_dir is set, so this is just plumbing — no manual version pin or curl/extract logic.
  • Local default is preserved: when BRAINTRUST_TEMPORAL_TEST_SERVER_DIR is unset (the local default), the SDK falls back to its built-in temp-dir download behavior.

Changes

  • .github/workflows/checks.yaml: on Linux runners only, actions/cache@v5.0.5 restores ~/.cache/braintrust/temporal-test-server. Cache key includes hashFiles('py/pyproject.toml') so any matrix bump invalidates cleanly, with a restore-keys: prefix fallback so most cache restores still hit. A small step exports BRAINTRUST_TEMPORAL_TEST_SERVER_DIR for the nox shard.
  • py/src/braintrust/integrations/temporal/test_temporal.py: the temporal_env fixture honors BRAINTRUST_TEMPORAL_TEST_SERVER_DIR. When set it passes download_dest_dir=... plus test_server_download_ttl=365d to ensure existing binaries are reused. When unset, original behavior unchanged.

Windows runners aren't affected — they weren't failing on the original PR and the time-skipping binary path is Linux/macOS-oriented.

Test plan

Verified locally on this devbox:

  • Cold cache (empty download_dest_dir): full nox -s "test_temporal(latest)" passes; binary lands at temporal-test-server-sdk-python-1.27.0. Setup ~1.4s.
  • Warm cache (binary already in dir): same suite passes. Setup ~0.1s. With HTTPS_PROXY=http://127.0.0.1:1 black-holed, start_time_skipping still completes in 0.11s — proves the SDK reuses the cached binary without any network call.
  • Env var unset (local-dev default): full suite still passes via the SDK's built-in temp-dir download path.
  • Pre-commit hooks (ruff, codespell, etc.) and nox -s pylint clean.

PR-time CI will exercise the cache restore/save cycle across the real shard matrix.

🤖 Generated with Claude Code

starfolkbot and others added 2 commits May 1, 2026 19:18
The temporal_env fixture calls WorkflowEnvironment.start_time_skipping(),
which downloads the Java test-server binary from temporal.download on every
run. GitHub Actions runners regularly hit 429 there, flaking the temporal
nox shards. Cache the binary across CI runs and pass it via
test_server_existing_path. The fixture honors a new
BRAINTRUST_TEMPORAL_TEST_SERVER_PATH env var; when unset (the local default),
the SDK's normal download behavior is preserved.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replace the manually-pinned test-server version + curl/extract bash with
the temporalio SDK's native download_dest_dir caching. The SDK keys cached
binaries by Python SDK version (e.g. temporal-test-server-sdk-python-1.27.0)
and reuses them on subsequent start_time_skipping calls, so CI just needs
to persist the directory across runs and let each temporalio matrix entry
populate the binary it wants. Cache key now hashes py/pyproject.toml so any
matrix bump invalidates cleanly. Verified locally: cold cache setup ~1.4s,
warm cache setup ~0.1s with HTTPS proxy black-holed (no re-download).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) enabled auto-merge (squash) May 1, 2026 19:31
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) merged commit 25ec266 into main May 1, 2026
82 checks passed
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) deleted the ci-cache-temporal-test-server branch May 1, 2026 19:36
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.

2 participants