Harness owns env_vars; rlm harness keeps only sandbox-plumbing defaults#1161
Draft
Harness owns env_vars; rlm harness keeps only sandbox-plumbing defaults#1161
Conversation
Adds an ``env_vars: dict[str, str]`` field to ``Harness``; ComposableEnv merges ``harness.env_vars`` into the sandbox env with the lowest precedence, so values passed via ``CLIAgentEnv(environment_vars=...)`` or by the task still win. The rlm harness now owns its sandbox defaults (``OPENAI_API_KEY=intercepted``, ``RLM_MAX_TURNS``) via this field and exposes an ``env_vars`` override kwarg to ``rlm_harness(...)``. The former ``RLM_SYSTEM_PROMPT_VERBOSITY=heavy`` default is dropped (rlm never read it) as is the redundant ``RLM_MAX_TURNS_IN_CONTEXT=-1`` (matches rlm's own default). Remaining rlm-side knobs (exec timeout, enabled tools, …) stay with rlm's own defaults and are set only when the caller explicitly overrides them. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
27cf9d3 to
8416ab8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restructures how harness-level env vars reach the sandbox so there's one source of truth per concern:
`Harness` dataclass gains `env_vars: dict[str, str]` — harnesses declare their own defaults instead of downstream envs re-declaring them.
`ComposableEnv.build_env_vars` merges `harness.env_vars` with lowest precedence (via `setdefault`), so values passed via `CLIAgentEnv(environment_vars=...)` or by the task still win.
`rlm_harness(env_vars=...)` accepts overrides and bakes the resulting dict into the returned `Harness`.
`DEFAULT_RLM_ENV_VARS` shrinks to only what the harness genuinely needs to set:
Other rlm-side knobs (`RLM_EXEC_TIMEOUT`, `RLM_ENABLED_TOOLS`, ...) are now left to rlm's own defaults. Callers override via `rlm_harness(env_vars={...})`.
Motivation
Before this PR, `rlm-swe` re-declared its own `DEFAULT_RLM_ENV_VARS` and passed the merged dict via `environment_vars=` — a second plumbing path parallel to the harness. With the `Harness.env_vars` field, there's one source per concern: rlm's defaults inside rlm, sandbox-plumbing inside the harness, user overrides in a single pass-through.
See matching research-environments#282 which becomes a thin pass-through once this lands.
Test plan