Skip to content

Respect CODEX_HOME and CLAUDE_CONFIG_DIR for writing config.#10870

Merged
liliwilson merged 4 commits into
masterfrom
lili/remote-1421-support-harnesses-for-self-hosted-worker-on-direct-backend
May 17, 2026
Merged

Respect CODEX_HOME and CLAUDE_CONFIG_DIR for writing config.#10870
liliwilson merged 4 commits into
masterfrom
lili/remote-1421-support-harnesses-for-self-hosted-worker-on-direct-backend

Conversation

@liliwilson
Copy link
Copy Markdown
Contributor

@liliwilson liliwilson commented May 14, 2026

Description

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

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.

  • I have manually tested my changes locally with ./script/run

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

@cla-bot cla-bot Bot added the cla-signed label May 14, 2026
@liliwilson liliwilson force-pushed the lili/remote-1421-support-harnesses-for-self-hosted-worker-on-direct-backend branch 2 times, most recently from 6f66619 to 2c20695 Compare May 14, 2026 00:54
@liliwilson liliwilson marked this pull request as ready for review May 14, 2026 01:23
@liliwilson liliwilson requested a review from abhishekp106 May 14, 2026 01:23
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 14, 2026

@liliwilson

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR updates the Claude and Codex harness setup to honor CLAUDE_CONFIG_DIR and CODEX_HOME when seeding config files, with tests covering the new config locations.

Concerns

  • No blocking concerns found.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

return Ok(PathBuf::from(home_dir));
// This function is used specifically for determining where to land `.claude.json`.
fn claude_global_config_path() -> Result<PathBuf> {
if let Ok(dir) = std::env::var("CLAUDE_CONFIG_DIR") {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh interesting, I thought .claude.json didn’t respect the env vars, only the directory did

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I originally did too... I did test this though and fortunately it does respect the env var

@liliwilson liliwilson force-pushed the lili/remote-1421-support-harnesses-for-self-hosted-worker-on-direct-backend branch from 2c20695 to 28d36f0 Compare May 16, 2026 19:40
@liliwilson liliwilson enabled auto-merge (squash) May 16, 2026 19:58
@liliwilson liliwilson force-pushed the lili/remote-1421-support-harnesses-for-self-hosted-worker-on-direct-backend branch from c9d5533 to 5706061 Compare May 17, 2026 05:13
@liliwilson liliwilson force-pushed the lili/remote-1421-support-harnesses-for-self-hosted-worker-on-direct-backend branch from 5706061 to 8803a2c Compare May 17, 2026 05:27
@liliwilson liliwilson merged commit 9131240 into master May 17, 2026
25 checks passed
@liliwilson liliwilson deleted the lili/remote-1421-support-harnesses-for-self-hosted-worker-on-direct-backend branch May 17, 2026 05:45
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants