Repository navigation
Conversation
|
@i-vainn Could you rebase onto main and add validation notes showing how you tested verbatim_prompt with OpenCode? |
5810173 to
459fb3f
Compare
|
@zyzhou5 Rebased onto main ( |
`opencode run` wraps every message argument that contains a space in double quotes and escapes inner quotes (anomalyco/opencode#43923), so opencode_sandboxed_agent and the local CLI path of opencode_agent deliver `"<prompt>"`, with each `"` as `\"`, instead of the task prompt. A new `verbatim_prompt` flag on both sends the prompt on stdin instead, which `opencode run` uses unchanged, as opencode_agent sandbox sessions already do. It defaults to false, leaving the launched command and every existing workflow exactly as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: i-vainn <[email protected]>
459fb3f to
129b3ae
Compare
|
/ok to test 129b3ae |
|
/review |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
HOLD — one RISK: staged prompts can be unreadable in non-root Docker sandboxes.
Reviewed all six changed files and traced prompt delivery, sandbox uploads, and session routing. Static review only; tests and live rollouts were not executed.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex
…andbox users write_text() creates the staged prompt with mode 0600 under a restrictive umask, and the Docker uploader copies it as root without adjusting the mode, so a non-root execution user got 'Permission denied' on the stdin redirect. chmod it to 0644 before upload and cover it with a umask(077) test. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Signed-off-by: i-vainn <[email protected]> (cherry picked from commit 4c67f25e0e41ecdda6933faac3135f85f37f508c)
Signed-off-by: i-vainn <[email protected]> # Conflicts: # responses_api_agents/opencode_agent/app.py # responses_api_agents/opencode_agent/tests/test_app.py
…im-prompt Signed-off-by: Christian Munley <[email protected]>
|
/ok to test 8456ab1 |
|
@i-vainn can you please address the svcnvidia-nemo-ci comments as well? |
|
Thanks @oyilmaz-nvidia, the bot's finding was addressed in 7fe9303 (see the reply in its thread). Could you re-run CI on the new head ( |
|
/review |
… opened and refuse blank prompts The staged prompt file stayed in /tmp for the sandbox's lifetime, and with the local provider that is the host's shared /tmp. The launch command now opens the file for stdin and removes it before OpenCode starts, best effort and independent of OpenCode's exit status. A whitespace-only prompt, which OpenCode rejects on stdin, is refused up front when verbatim_prompt is on. Tests cover padded prompts, a failing OpenCode, cleanup, and the blank-prompt refusal. Signed-off-by: i-vainn <[email protected]>
|
Thanks @oyilmaz-nvidia! Pushed a follow-up (7389970).
Not run: a real non-root Docker rollout. New head needs |
|
/ok to test 7389970 |
|
/review |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP — the prior permissions finding is resolved; no new findings meet the follow-up escalation threshold.
The staging code now sets mode 0644 before upload, addressing the reported restrictive-umask/non-root Docker failure without changing prompt bytes. The regression assertions cover umask 077, staged permissions, and exact UTF-8 contents.
Compared current source with the previously reviewed head and inspected subsequent cleanup, blank-prompt validation, tests/documentation, and affected local timeout/session paths. Applied the follow-up policy: unresolved prior findings remain eligible; new regressions must exceed the historical moderate-impact ceiling.
Static review only. Tests and live rollouts, including non-root Docker execution, were not run.
Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.
|
@i-vainn could you merge main? It conflicts now, and I'd like to approve once it's green. |
|
@i-vainn could you please resolve the merge conflicts for this PR and re-start the CI ? Thanks |
What does this PR do?
opencode_sandboxed_agentand the local CLI path ofopencode_agentpass the task prompt as the lastopencode runargument.opencode runwraps any argument containing a space in double quotes and escapes inner quotes, so the model sees"<prompt>", with every"as\", instead of the task prompt. Upstream report: anomalyco/opencode#43923, closed as not planned on 2026-10-11 in OpenCode's v1 issue triage; the proposed upstream fix (anomalyco/opencode#50245) was closed unmerged. Gym pins OpenCode 1.17.11, so this will not be fixed upstream for Gym's version.This adds an opt-in
verbatim_promptflag. When enabled, the prompt goes toopencode runon stdin with no message argument, which OpenCode uses unchanged:opencode_sandboxed_agentuploads the prompt to the sandbox and redirects it intoopencode run.opencode_agent(local CLI path) writes it to the subprocess's stdin.opencode_agentsandbox sessions (#3639) already send the prompt on stdin, so the flag does not apply there; with the flag on, the other two paths match them.Example (OpenCode 1.17.11):
Compatibility
Validation
Rebased on
57cfd5140.Unit tests
opencode_agent: 394 passed, 2 skipped.opencode_sandboxed_agent: 64 passed, 1 failed (test_required_mcp_extension, which needs Node >= 20; it fails identically on unmodified main with Node 18).opencodethat records its arguments and stdin, with a prompt containing quotes,$, a newline and a leading--. Flag off: the prompt is the final argument (unchanged). Flag on: it arrives byte-exact on stdin with no message argument. The flag-on cases fail with the fix reverted.pre-commit runon changed files: passed.Live, after the rebase (inference-api.nvidia.com, OpenCode 1.17.11, recording proxy between Gym and the endpoint, comparing the first user message the endpoint received with the dataset prompt):
opencode_sandboxed_agent(Docker sandbox, 3 tool-use tasks with quotes in the prompt)opencode_sandboxed_agent(same)opencode_agentlocal CLI (real_run_opencode, OpenCode in a container)"Solve … \"import primesieve\" …")Benchmark A/B, before the rebase (2026-10-09/12, PR commit cherry-picked onto Gym
6fa86e50, or backported onto1e668906for SWE-bench Pro; Super 3.5 checkpoint, OpenCode sandboxed benchmarks, only the prompts that contain", 4 repeats per arm). We checked on the cluster that flag off delivers the wrapped, escaped prompt and flag on delivers it verbatim. Paired on − off, with 95% CI:No measurable effect on any of them; the reasoning flag-off arms reproduce the earlier OpenCode baselines within about 1 point. 6 of 6,392 reasoning rollouts were lost to sandbox failures, unrelated to the flag. On SWE-bench Pro, 8 of 4,176 rollouts did not finish within the 4-hour job limit, which moves either arm by at most 0.3 points; 153 tasks scored differently between the arms (77 better with the flag on, 76 worse).
🤖 Generated with Claude Code