Skip to content

requirements_test: make uv pip compile work in Claude Code containers via auth proxy#814

Open
agentydragon-agent wants to merge 2 commits intoagentydragon:develfrom
agentydragon-agent:claude/fix-requirements-test-9Dy9F
Open

requirements_test: make uv pip compile work in Claude Code containers via auth proxy#814
agentydragon-agent wants to merge 2 commits intoagentydragon:develfrom
agentydragon-agent:claude/fix-requirements-test-9Dy9F

Conversation

@agentydragon-agent
Copy link
Copy Markdown
Contributor

Summary

  • Patch rules_python lock rule to inherit --action_env (via dicts.add(ctx.configuration.default_shell_env, ctx.attr.env)) — without this patch, the lock rule's explicit env = ctx.attr.env prevents --action_env from reaching the action
  • Force PyRequirementsLockUv actions to run locally (not RBE) in Claude Code sessions via --strategy=PyRequirementsLockUv=local in bazelrc.mako
  • Pass https_proxy=http://127.0.0.1:18081 and SSL_CERT_FILE as explicit --action_env values in bazelrc.mako, routing uv through the session auth proxy
  • Regenerate requirements_bazel.txt (was stale, causing the test to fail)

Design: Claude Code sessions force the lock action local (where auth proxy is available); CI/RBE uses exec_properties dockerNetwork:bridge for direct internet access — the two code paths are independent.

Test plan

  • bazel test //:requirements_test --config=nolint passes locally in Claude Code container
  • bazel build //:requirements runs as 1 local action (confirming --strategy=PyRequirementsLockUv=local works)
  • CI will validate requirements lockfile is up-to-date and patch applies cleanly

https://claude.ai/code/session_01Hfvcxxg9i18tP2NYzqbXpw

claude added 2 commits March 9, 2026 12:28
…Code sessions

The uv pip compile action in the requirements lock rule fails in Claude Code
containers because DNS is blocked — all egress must go through the session
auth proxy (localhost:18081).

Three-part fix:

1. Patch rules_python lock.bzl to inherit --action_env
   The lock() rule hardcodes env = ctx.attr.env in ctx.actions.run_shell(),
   which prevents --action_env from reaching the action. The patch changes
   it to dicts.add(ctx.configuration.default_shell_env, ctx.attr.env), so
   --action_env values are included while explicit lock rule env overrides
   take precedence. Applies via single_version_override in MODULE.bazel.

2. Add --strategy=PyRequirementsLockUv=local to session bazelrc template
   Forces the lock action to run locally (not on RBE) in Claude Code sessions,
   where the auth proxy is available. In CI/RBE, the lock rule uses
   exec_properties dockerNetwork:bridge for direct internet access instead.

3. Add --action_env proxy vars to session bazelrc template
   Sets https_proxy=http://127.0.0.1:18081 and SSL_CERT_FILE to the session
   CA bundle with explicit values. The lock rule (patched) inherits these
   via default_shell_env. UV_NATIVE_TLS=1 (already in lock rule env) makes
   uv use OpenSSL to respect SSL_CERT_FILE.

Also regenerates requirements_bazel.txt (was stale, causing test failures).

https://claude.ai/code/session_01Hfvcxxg9i18tP2NYzqbXpw
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