Worker: inject the egress proxy variables into strict task environments

Open
#68 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start with client/src/orcaster_worker/task_env.py, especially build_scrubbed_base_env and the proxy reservation and passthrough logic; then trace its use in client/src/orcaster_worker/venv_manager.py. Read client/tests/test_task_env.py and client/tests/test_venv_manager_env.py to see the expected environment behavior. Done means the acceptance cases pass, the requested warnings and source reporting are covered, and the listed user manual, README, troubleshooting, and changelog text is updated.

Written by the indexing model from the issue text.

Description

client enhancement P2

Problem

With egress isolation on, the worker container gets the proxy as HTTPS_PROXY, HTTP_PROXY and NO_PROXY (Makefile:466-473). The worker uses the same signal to detect a proxy at startup (client/src/orcaster_worker/main.py:789).

A task that declares task_env runs with a scrubbed environment: a fixed passthrough base plus the names it declares (client/src/orcaster_worker/task_env.py:50-63, task_env.py:307-359). The proxy variables are not in the base. They are reserved and owned by the worker (task_env.py:170-174), so a task gets them only if it lists them in task_env. The same scrubbed environment is used for uv pip install during venv setup (client/src/orcaster_worker/venv_manager.py:102).

A strict task that forgets the three names has no route out of the --internal network. It fails within seconds with a DNS error (Could not resolve host, dns error), which reads like a network outage and not like a configuration error. The behavior is documented as a known limit (docs/user-manual.md:1155-1173, client/README.md:659-665, client/README.md:722-730), and every task author must learn it.

Some clients read only the lowercase names (http_proxy, https_proxy, no_proxy). The Makefile never sets them, so declaring them in task_env usually has no effect today. An operator can still add them to the worker environment through EXTRA_ENV, which the fleet scripts copy into every worker env file (setup-scripts/debian13-worker/run-fleet.sh:174).

Proposed change

  1. When the worker runs with egress isolation (the worker environment has HTTPS_PROXY or HTTP_PROXY), add the proxy variables to every strict task environment, whether or not the task declared them:
    • HTTPS_PROXY, HTTP_PROXY, NO_PROXY with the worker values;
    • https_proxy, http_proxy, no_proxy with the same values as the uppercase worker names.
      The lowercase values come from the uppercase worker values, not from a lowercase name in the worker environment. On a host with several workers, each worker has its own proxy (Makefile:372, Makefile:469-470), while EXTRA_ENV is the same for every worker. A lowercase value from EXTRA_ENV could send a task to the proxy of another worker, which applies another allowlist. When a task declares a lowercase name in task_env, it gets the lowercase worker value if the worker environment has one (as today). If the worker environment has no lowercase value, it gets the uppercase worker value, like an undeclared task. Today such a declared name is not injected at all (client/src/orcaster_worker/task_env.py:347-350), which leaves lowercase-only clients without a proxy.
  2. Apply it in one place so that the task commands and the venv setup get the same environment (build_scrubbed_base_env, or its callers in venv_manager.py:102 and venv_manager.py:164).
  3. At startup, log one WARNING for each lowercase proxy name in the worker environment whose value differs from its uppercase name. The line names the variable, never the value.
  4. Log a warning, once per execution and with the task id, when a strict task declared none of the proxy names. The warning is informative only: the task still runs with the injected values.
  5. Do not inject anything when egress isolation is off (no proxy in the worker environment). Do not change legacy tasks without task_env: they already inherit the worker environment.
  6. Do not inject ALL_PROXY or any GIT_* variable.
  7. Keep the per-task environment source line accurate: injected names are reported as coming from the worker environment (docs/user-manual.md:2605).
  8. Update the docs: replace "The known limit" section (docs/user-manual.md:1155-1173), the troubleshooting row (docs/user-manual.md:2783), the note at docs/user-manual.md:1780, and client/README.md:659-665 and client/README.md:722-730.

Compatibility

  • Tasks that already declare HTTPS_PROXY, HTTP_PROXY and NO_PROXY get the same values as today.
  • Tasks that declare a lowercase proxy name keep today's value for it when the worker environment has one. Otherwise they now get the uppercase worker value instead of no value. Tasks that did not declare one get the lowercase names from the uppercase worker values, even if EXTRA_ENV sets other lowercase values.
  • Tasks that did not declare them now reach the proxy. The proxy still applies each task's egress allowlist, so they reach only allowed hosts.
  • Workers without egress isolation and legacy tasks without task_env see no change.
  • Server values for these names are still refused, because the names stay reserved.
  • No server change, no protocol change and no configuration step. Task definitions can keep declaring the names.

Acceptance criteria

  • With HTTPS_PROXY, HTTP_PROXY and NO_PROXY in the worker environment, a strict task that declares none of them gets all six names (both cases) with the worker values, in the task commands and in the venv setup.
  • A strict task that declares the uppercase names gets the same values as before the change.
  • On a host with two workers and lowercase proxy names in EXTRA_ENV, a strict task that does not declare them gets lowercase values equal to the uppercase values of its own worker.
  • A strict task that declares a lowercase proxy name gets the worker value for that name, as today.
  • On a worker with no lowercase proxy names in its environment, a strict task that declares http_proxy gets the value of HTTP_PROXY.
  • A worker whose lowercase proxy value differs from its uppercase value logs one startup WARNING that names the variable and not the value.
  • Without a proxy in the worker environment, no proxy variable is injected.
  • A legacy task without task_env gets the same environment as before.
  • A server secret named like a proxy variable (any case) is still refused.
  • A strict task that declares none of the proxy names produces one warning per execution with the task id. The log line contains no variable value.
  • Tests cover each case above in client/tests/test_task_env.py and client/tests/test_venv_manager_env.py.
  • Existing deployments keep working without config changes, and existing task definitions do not need edits.
  • The user manual and the client README no longer tell task authors to declare the proxy variables.
  • CHANGELOG entry under Unreleased.
Dominant language
Python
Stars
0
Forks
0
Avg merge
1d 1h
Merged PRs (30d)
10

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AInvirion/orcaster

All issues in AInvirion/orcaster

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.