Skip to content

Add harness environment variables to self-hosted worker with direct backend#72

Merged
liliwilson merged 1 commit into
mainfrom
lili/remote-1421-support-harnesses-for-self-hosted-worker-on-direct-backend
May 15, 2026
Merged

Add harness environment variables to self-hosted worker with direct backend#72
liliwilson merged 1 commit into
mainfrom
lili/remote-1421-support-harnesses-for-self-hosted-worker-on-direct-backend

Conversation

@liliwilson
Copy link
Copy Markdown
Contributor

Description

This PR sets the CLAUDE_CONFIG_DIR and CODEX_HOME environment variables for the self-hosted worker with direct backend to be workspaceDir/.claude and workspaceDir/.codex respectively on a per-task basis.

Since we don't have filesystem isolation for the direct backend worker, we want to be able to set harness config on a per-task basis, and cannot rely on the default claude/codex config directories (otherwise, concurrent tasks would clobber each other, we wouldn't clean up their state when done, etc.).

The client-side support for these environment variables is implemented in warpdotdev/warp#10870.

Testing

Ran the oz-local script with my self-hosted direct backend worker, nuked my global claude config at ~/.claude, and verified that the agent was able to run to completion anyways. Confirmed that the config files were written to workspaceDir/.claude.

@liliwilson liliwilson marked this pull request as ready for review May 15, 2026 08:02
@liliwilson liliwilson requested a review from ianhodge May 15, 2026 08:02
Copy link
Copy Markdown
Member

@ianhodge ianhodge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this makes sense to me !

@liliwilson liliwilson merged commit c7575d8 into main May 15, 2026
7 of 8 checks passed
@liliwilson liliwilson deleted the lili/remote-1421-support-harnesses-for-self-hosted-worker-on-direct-backend branch May 15, 2026 16:26
liliwilson added a commit to warpdotdev/warp that referenced this pull request May 17, 2026
## Description
<!-- Please remember to add your design buddy onto the PR for review, if
it contains any UI changes! -->
Update the implementations for claude and codex harnesses to
consistently respect the environment variables `CLAUDE_CONFIG_DIR` and
`CODEX_HOME` respectively.

While `.claude.json` gets written to `~` (not `~/.claude`) when the
`CLAUDE_CONFIG_DIR` is unset, we need to make sure that we set it to
`CLAUDE_CONFIG_DIR/.claude.json` when the environment variable is set.

This is important for the self-hosted worker direct backend, to make
sure that we can seed per-task config in worker-scoped repos. Associated
`oz-agent-worker` PR:
warpdotdev/oz-agent-worker#72

## Testing
<!--
How did you test this change? What automated tests did you add? If you
didn't add any new tests, what's your justification for not adding any?

Manual testing is required for changes that can be manually tested, and
almost all changes can be manually tested. If your change can be
manually tested, please include screenshots or a screen recording that
show it working end to end.

You can run the app locally using `./script/run` - see WARP.md for more
details on how to get set up.
-->

Ran with `./script/oz-local` and passed in `-e CODEX_HOME` and `-e
CLAUDE_CONFIG_DIR`. Nuked my local `~/.claude` and `~/.codex`
directories and then confirmed agents could run to completion and seed
the correct config files.

Also ran without setting the env vars and confirmed that we run to
completion.

- [x] I have manually tested my changes locally with `./script/run`

## Agent Mode
- [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode
stupidloud pushed a commit to stupidloud/warp-cn that referenced this pull request May 21, 2026
## Description
<!-- Please remember to add your design buddy onto the PR for review, if
it contains any UI changes! -->
Update the implementations for claude and codex harnesses to
consistently respect the environment variables `CLAUDE_CONFIG_DIR` and
`CODEX_HOME` respectively.

While `.claude.json` gets written to `~` (not `~/.claude`) when the
`CLAUDE_CONFIG_DIR` is unset, we need to make sure that we set it to
`CLAUDE_CONFIG_DIR/.claude.json` when the environment variable is set.

This is important for the self-hosted worker direct backend, to make
sure that we can seed per-task config in worker-scoped repos. Associated
`oz-agent-worker` PR:
warpdotdev/oz-agent-worker#72

## Testing
<!--
How did you test this change? What automated tests did you add? If you
didn't add any new tests, what's your justification for not adding any?

Manual testing is required for changes that can be manually tested, and
almost all changes can be manually tested. If your change can be
manually tested, please include screenshots or a screen recording that
show it working end to end.

You can run the app locally using `./script/run` - see WARP.md for more
details on how to get set up.
-->

Ran with `./script/oz-local` and passed in `-e CODEX_HOME` and `-e
CLAUDE_CONFIG_DIR`. Nuked my local `~/.claude` and `~/.codex`
directories and then confirmed agents could run to completion and seed
the correct config files.

Also ran without setting the env vars and confirmed that we run to
completion.

- [x] I have manually tested my changes locally with `./script/run`

## Agent Mode
- [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode
lawsmd pushed a commit to lawsmd/cortex that referenced this pull request May 22, 2026
…dev#10870)

## Description
<!-- Please remember to add your design buddy onto the PR for review, if
it contains any UI changes! -->
Update the implementations for claude and codex harnesses to
consistently respect the environment variables `CLAUDE_CONFIG_DIR` and
`CODEX_HOME` respectively.

While `.claude.json` gets written to `~` (not `~/.claude`) when the
`CLAUDE_CONFIG_DIR` is unset, we need to make sure that we set it to
`CLAUDE_CONFIG_DIR/.claude.json` when the environment variable is set.

This is important for the self-hosted worker direct backend, to make
sure that we can seed per-task config in worker-scoped repos. Associated
`oz-agent-worker` PR:
warpdotdev/oz-agent-worker#72

## Testing
<!--
How did you test this change? What automated tests did you add? If you
didn't add any new tests, what's your justification for not adding any?

Manual testing is required for changes that can be manually tested, and
almost all changes can be manually tested. If your change can be
manually tested, please include screenshots or a screen recording that
show it working end to end.

You can run the app locally using `./script/run` - see WARP.md for more
details on how to get set up.
-->

Ran with `./script/oz-local` and passed in `-e CODEX_HOME` and `-e
CLAUDE_CONFIG_DIR`. Nuked my local `~/.claude` and `~/.codex`
directories and then confirmed agents could run to completion and seed
the correct config files.

Also ran without setting the env vars and confirmed that we run to
completion.

- [x] I have manually tested my changes locally with `./script/run`

## Agent Mode
- [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode
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