Repository navigation
Conversation
A headless Claude Code run ends when the CLI exits, and the CLI first waits for every background task. When the model sets Bash's run_in_background on a long command, the CLI keeps waiting on it after the final answer, so the run holds its sandbox and model slot until the agent timeout. On an HLE run with Claude Code 2.1.108, a rollout that answered and ended its turn stayed open until its job was cancelled, because 9 of its 47 Bash commands had been sent to the background. Set CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1 for host and sandbox runs. The CLI then drops run_in_background from the Bash tool, and each command runs in the foreground under the Bash tool's own timeout. Signed-off-by: gwarmstrong <[email protected]>
|
/ok to test 6b91462 |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM — no concerns found.
I reviewed all four changed files and traced the setting through the host and sandbox launch paths, including sandbox staging and the shared runner. Both paths pass the flag as "1", and the updated tests assert that value at their execution boundaries. The README documents the new default, and the PR supplies compatibility notes and representative smoke-rollout evidence.
This was a read-only source review. I didn't execute tests or independently verify the external CLI's interpretation of the flag.
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.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41796700026 |
What does this PR do?
claude_code_agentsetsCLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1in the CLI's environment for host and sandbox runs. The README's limitations list now says so.Why. A headless Claude Code run ends when the CLI exits, and the CLI first waits for every background task. When the model sets Bash's
run_in_backgroundon a long command, the CLI keeps waiting on it after the final answer, and the run holds its sandbox and model slot until the agent timeout.In an internal HLE run with Claude Code 2.1.108, a rollout answered and ended its turn, then stayed open until its job was cancelled. 9 of its 47 Bash commands had been sent to the background (long brute-force loops, whose output the model then polled with
sleep 2; cat <output file>).In 2.1.108 the variable removes
run_in_backgroundfrom the Bash and agent tools, the prompt text that suggests it, and the Ctrl+B shortcut. Commands then run in the foreground, bounded by the Bash tool's own timeout. A model can still start a shell-levelcmd &; the CLI does not track that, so it does not hold the run open.Part of #5552. Found while validating Claude Code on HLE Diamond.
Validation
gym env test +entrypoint=responses_api_agents/claude_code_agent +should_validate_data=true: 171 passed.pre-commit run --all-files: clean.run_in_backgroundparameter, its prompt text and the Ctrl+B shortcut.Rollouts
Internal HLE Diamond text run with this change (Nemotron 3.5 Super on vLLM, 5 tasks, Claude Code 2.1.108 in OpenSandbox): 5/5 rollouts completed and healthy, and none ran on after its final answer (131 to 923 s per rollout). The Bash tool schema had no
run_in_background, and 0 of 103 calls returned a background-task result. Before this change, one of the 5 rollouts in the same setup stayed open after its final answer until its job was cancelled.Compatibility and benchmark impact
Behavior change for every Claude Code run through this adapter: the model can no longer background Bash commands through the CLI. A task that relied on
run_in_background, for example to start a server and keep working, must use a shell-level background process instead. Before this change, such a run also held the rollout open until timeout after its answer.Checklist
pre-commit run --all-files).git commit -s).