Simulated user and ACP target agent share environment variables
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start in src/harbor/trial/trial.py, where exec_env merges the user agent, bridge and target environment variables, then read src/harbor/bridges/acp.py to see how the acpx config is written to .acpxrc.json. Done means each agent gets only its own variables and the config moves to ~/.acpx/config.json. This is blocked on openclaw/acpx#1050 being merged and released, and on bumping the pinned acpx version from 0.11.2.
Written by the indexing model from the issue text.
Description
Problem
When a trial runs a simulated user, Harbor's ACP bridge (src/harbor/bridges/acp.py) uses acpx to connect it to the target agent. Environment variables reach the two agents as follows:
- Harbor runs the simulated user with a set of environment variables.
- The simulated user runs
acpx, andacpxruns the target. - Each process inherits its parent's environment variables, so the target gets the simulated user's.
The acpx CLI config has no way to give the target its own environment variables, so Harbor adds the target's variables to the simulated user's in step 1 (src/harbor/trial/trial.py):
exec_env = {
**self.user_agent.extra_env,
**self.bridge.env(),
**self.agent.extra_env_for_bridge(self.config.user_agent.bridge.kind),
}
This happens in shared bridge and trial code, so it affects all ACP targets. Each agent's variables can change how the other runs, in both directions:
- Target → simulated user. The simulated user runs with the target's variables. When both agents use the same variable name, the target's value replaces the simulated user's. For example, with Claude Code as both the simulated user and the target, the simulated user authenticates with the target's credentials.
- Simulated user → target. The target inherits the simulated user's variables, including keys, tokens and flags the target was not configured with.
Some targets work around the second direction on their own:
- Claude Code starts its ACP server with
env -u CLAUDECODE. - Copilot CLI starts its ACP server through a shell script that unsets every inherited
COPILOT_*variable, then loads the target's variables from an env file in a private home directory.
Other targets have no such workaround.
Proposed fix
openclaw/acpx#1050 proposes three optional keys for an agent's entry in the acpx config:
envAllow: limit the inherited variables to the listed names.envBlock: drop the listed inherited variables.env: give the agent its own values.
With these keys, the target's variables no longer need to be in the simulated user's environment. Harbor would write them to the target's env in the acpx config instead, and list the simulated user's variable names in envBlock so the target does not inherit them. Each agent would then run with only its own variables, and the target-specific workarounds above would no longer be needed.
The cost is that the acpx config would then contain the target's credentials. Harbor currently writes it to .acpxrc.json in the task workspace, where the credentials could end up in anything committed, diffed or graded. Harbor would want to write it to ~/.acpx/config.json instead.
This does not stop either agent from reading the other's credentials. Both agents run as the same Linux user in the same sandbox, so the simulated user could read ~/.acpx/config.json, and each agent can already read the other's environment variables from its running process. This is an existing limitation that the fix neither causes nor addresses.
Status
I have drafted a change to Harbor that would address this. I haven't yet opened a PR because it is blocked on:
- openclaw/acpx#1050 being accepted and merged;
- an
acpxrelease that includes it; - bumping Harbor's pinned
acpxversion (currently0.11.2).
Related
- #3626 and #1647 cover a similar problem for sidecar containers: credentials meant for a sidecar service reaching the agent.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 1.9k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 156
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from harbor-framework/harbor
-
Trial runs the agent's `populate_context_post_run` on the event loop, so trials that end together stall the orchestrator for secondsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
harbor-framework/harbor#4652 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
harbor-framework/harbor#4494 · 1 comment ·
Maintainers usually reply within 1 day
-
step workdir upload resets the work folder's owner and permissions in ModalPossibly taken @Sauvi72 claimed this 8 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
harbor-framework/harbor#4487 · 3 comments ·
Maintainers usually reply within 1 day
-
Docker: verifier log mounts are chmod 777 (no sticky), so rewardkit sandboxed graders die before writing a rewardPossibly taken @yuyz-cyber claimed this 6 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
harbor-framework/harbor#4469 · 1 comment ·
Maintainers usually reply within 1 day
-
Compare and Pareto hide total token usage when the cached token count is missingPossibly taken @Aafimalek claimed this 10 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
harbor-framework/harbor#4448 ·
Maintainers usually reply within 1 day
All issues in harbor-framework/harbor
Similar issues
-
soup prune-prompt exits 1 after writing its output on a file over 100,000 rows, and reports a capped row count otherwisePossibly taken @abdulwaarith0 claimed this today. Openneeds-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
MakazhanAlpamys/Soup#3690 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug data-types native-format
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
ClickHouse/clickhouse-connect#1320 ·
Maintainers usually reply within 1 day
-
accepted
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
future-agi/future-agi#6392 ·
Maintainers usually reply within 1 day