Skip to content

fix(proxy): inject S3-scoped endpoint vars so s5cmd is captured too#242

Draft
christophergeyer wants to merge 1 commit into
rc/0.4.1from
cg/proxy-s3-endpoint-vars
Draft

fix(proxy): inject S3-scoped endpoint vars so s5cmd is captured too#242
christophergeyer wants to merge 1 commit into
rc/0.4.1from
cg/proxy-s3-endpoint-vars

Conversation

@christophergeyer

Copy link
Copy Markdown
Member

Problem

The per-run S3 proxy injected only AWS_ENDPOINT_URL. Two issues surfaced while validating fast S3 staging (s5cmd) for a campaign:

  1. s5cmd bypasses the proxy. s5cmd doesn't honor AWS_ENDPOINT_URL — it reads --endpoint-url / $S3_ENDPOINT_URL. So roar run -- s5cmd cp s3://… goes straight to real S3 and the object is never recorded as a lineage input — silently losing the source, and with it the AI-BOM downloadLocation that derives from source_url.
  2. AWS_ENDPOINT_URL is service-agnostic. It redirects every AWS service (STS, EC2, CloudWatch…) at an S3-only proxy. A workload that does an S3 read plus an sts:AssumeRole under roar run would send the STS call into the proxy.

Fix

Inject the S3-scoped SDK override AWS_ENDPOINT_URL_S3 (honored by boto3 / aws CLI / aws-sdk-go-v2; does not touch non-S3 services) plus S3_ENDPOINT_URL for s5cmd. Drop the global AWS_ENDPOINT_URL. Upstream-endpoint detection and the roar proxy start hint use the same two vars.

Verification

Unit: tests/unit/test_proxy_runtime_resource.py updated (7 pass; 19 pass across the proxy/tracer suites). ruff clean.

End-to-end against real S3 (ModelSandbox, botocore 1.43), proxy enabled, no manual endpoint var set:

Fetch before (only AWS_ENDPOINT_URL) after (this PR)
roar run -- python …boto3… download ✅ captured ✅ captured (via AWS_ENDPOINT_URL_S3)
roar run -- s5cmd cp s3://… not captured captured (via S3_ENDPOINT_URL)

Both record source_type=s3 + full source_url; the child process sees AWS_ENDPOINT_URL unset (so non-S3 calls are no longer hijacked).

Scope / follow-up

Deliberately limited to the non-Ray roar run path (proxy_resource.py) — the tested path. The Ray backend has a parallel AWS_ENDPOINT_URL injection (backends/ray/submit_context.py, roar_worker.py) with worker-coordination logic keyed on the var name; it wants the same treatment but needs the multi-node path to validate, so it's left for a follow-up rather than shipped untested.

Per direction: no backward-compat alias for the old AWS_ENDPOINT_URL — if any existing setup relied on roar exporting the global var, it will need AWS_ENDPOINT_URL_S3 instead.

🤖 Generated with Claude Code

The per-run S3 proxy injected only `AWS_ENDPOINT_URL`. Two problems:

1. **s5cmd bypassed the proxy.** s5cmd does not honor `AWS_ENDPOINT_URL`; it
   reads `--endpoint-url` / `$S3_ENDPOINT_URL`. So `roar run -- s5cmd cp s3://…`
   went straight to real S3, and the object was NOT recorded as a lineage input —
   silently losing the source (and the AI-BOM `downloadLocation` derived from it).
   Verified against real S3: boto3 captured, s5cmd did not, until s5cmd was
   pointed at the proxy explicitly.

2. **`AWS_ENDPOINT_URL` is service-agnostic** — it redirects *every* AWS service
   (STS, EC2, CloudWatch, …) at an S3-only proxy. A workload doing an S3 read and
   an `sts:AssumeRole` under `roar run` would send the STS call into the proxy.

Fix: inject the S3-*scoped* SDK override `AWS_ENDPOINT_URL_S3` (honored by boto3 /
aws CLI / aws-sdk-go-v2, does not touch non-S3 services) plus `S3_ENDPOINT_URL`
for s5cmd. Drop the global `AWS_ENDPOINT_URL`. Upstream-endpoint detection and the
`roar proxy start` hint use the same two vars.

Verified end-to-end against real S3 (ModelSandbox, botocore 1.43): with no manual
endpoint var, both `roar run -- python …boto3…` and `roar run -- s5cmd cp …` now
record `source_type=s3` + full `source_url`; the global `AWS_ENDPOINT_URL` is
unset in the child.

NOTE: the Ray backend has a parallel `AWS_ENDPOINT_URL` injection
(`backends/ray/submit_context.py`, `roar_worker.py`) with worker-coordination
logic keyed on the var name. Left untouched here — same treatment wanted as a
follow-up, but it needs the multi-node path to validate.

Co-Authored-By: Claude Opus 4.8 (1M context) <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.

2 participants