Skip to content

fix(harness-agent): let explicit agent_kwargs keep their working directory - #5051

Merged
marcromeyn merged 1 commit into
mainfrom
cmunley1/harness-agent-explicit-workdir
Oct 26, 2026
Merged

marcromeyn merged 1 commit into
mainfrom
cmunley1/harness-agent-explicit-workdir

Conversation

@cmunley1

@cmunley1 cmunley1 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

harness_agent writes the task working directory into the harness's workdir key (cwd, repo_dir, or workspace_root) and overwrites any value set in agent_kwargs, so an explicit setting cannot take effect.

This blocks DeepAgents through NeMo Fabric. Fabric uses that directory as the DeepAgents workspace, which is also the root of its virtual filesystem. With the task directory /app, an absolute answer path such as /logs/agent/answer.txt is written to /app/logs/agent/answer.txt and never collected. On SWE Atlas Codebase Q&A (#4777) every DeepAgents rollout scored 0 with no rubric judged.

With this change an explicit agent_kwargs value wins. DeepAgents can set cwd: / while the runner still starts in the task directory. Configs that do not set the key keep the current behavior.

Validation

  • pytest responses_api_agents/harness_agent/tests: 33 passed.
  • The new test fails on main for the explicit value and passes with this change.
  • pre-commit on the changed files: passed.

Rollouts

DeepAgents through harness_agent and OpenSandbox on three SWE Atlas Q&A tasks (#4777) with this change and agent_kwargs.cwd: /, DeepSeek-V4.1-Flash as the policy and Claude Opus 4.5 as the judge:

Task Answer collected Rubrics passed Reward
Scapy yes 11/11 1
kitty yes 6/7 0
k6 (Alpine) yes 11/13 0

Without the change, the same tasks collected no answer and scored 0 with no rubric judged, because the answer landed at /app/logs/agent/answer.txt. With it, /app stayed clean in every sandbox. DeepAgents' own state directory also moved from inside the repository to /artifacts.

Compatibility and benchmark impact

Only configs that set the workdir key in agent_kwargs are affected. On main those are benchmarks/job_bench/codex.yaml and benchmarks/workspace_bench/codex.yaml, which set cwd: /workspace, the same directory as their task workdir, so their behavior is unchanged.

Checklist

  • I have read the contributing guidelines.
  • The change is focused.
  • Tests added and pass locally.
  • Documentation updated.
  • Pre-commit checks pass locally.
  • New source files include the required Apache-2.0 SPDX header (no new files).
  • All commits have DCO sign-off.

@copy-pr-bot

copy-pr-bot Bot commented Oct 24, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@cmunley1

Copy link
Copy Markdown
Contributor Author

/ok to test c8d4ee9

@github-actions

Copy link
Copy Markdown
Contributor

@cmunley1 /claude review has been retired. Pull-request reviews now run through /review; comment this instead:

/review

Add model=claude to keep a Claude reviewer (the default is model=codex). mode=light|strict selects the review depth. Comment /review help for all options.

@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 24, 2026 17:01
@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:agent Agent harnesses and Responses API agent behavior bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer labels Oct 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@cmunley1

Copy link
Copy Markdown
Contributor Author

/review

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

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.

SHIP

LGTM — no reliability concerns.

Reviewed all three changed files and traced working-directory propagation into the runner and Fabric workspace. Both branches in HarnessAgent.responses preserve explicit agent settings while retaining the task directory as the runner’s cwd. Missing settings retain the previous behavior. The new regression test checks both default and explicit-root cases.

Static review only; I could not execute tests or verify the live rollout results.

Note: formal approval is not available for this request, so this review is posted as a comment only.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

@cmunley1 cmunley1 mentioned this pull request Oct 24, 2026
7 tasks done

@marcromeyn marcromeyn left a comment

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.

LGTM. setdefault lets an explicit agent_kwargs working directory win on both paths, the runner still runs in the task workdir, and agent_config is a fresh copy per request so nothing leaks between tasks.

@marcromeyn
marcromeyn added this pull request to the merge queue Oct 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/40302105918

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/40310193617

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Oct 26, 2026
@marcromeyn
marcromeyn added this pull request to the merge queue Oct 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/40346066185

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/40346234602

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/40350654853

Merged via the queue into main with commit 97cea2a Oct 26, 2026
83 of 90 checks passed
@marcromeyn
marcromeyn deleted the cmunley1/harness-agent-explicit-workdir branch October 26, 2026 16:00

This branch was previously deployed

1 inactive deployment
public — c8d4ee97 Deployed Oct 24, 2026 by copy-pr-bot[bot] via release / finalize / notify #7093
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent harnesses and Responses API agent behavior bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants