Repository navigation
Preserve interrupted OpenCode tool outcomes - #5198
Conversation
|
/review |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
One correctness RISK: an interrupted task can invalidate the entire observation bundle, as detailed inline.
RISK — Record representative real smoke-rollout validation. The supplied PR description contains no validation results or rollout evidence. Trusted AGENTS.md requires representative real model rollouts for behavior-changing agent work and requires recording that evidence. The added tests construct persisted states; they do not establish what the installed OpenCode runtime actually records.
Could you run representative model-backed smoke rollouts through both affected adapters and record the commands/configuration, OpenCode version, and inspected results? Include interrupted shell execution with partial output, invocation cancellation/timeout, and an ordinary successful tool. Compare native artifacts with normalized outcomes/output and inspect the resulting agent/verifier behavior. Preserve integer-exit handling, native terminal outcomes, and the compacted-output marker. Acceptance: recorded results demonstrate correct stop attribution and retained partial output without altering ordinary tool results or verifier behavior. This is a validation-evidence request, not a claim that those runs failed.
Completed static inspection of all six changed files and their directly affected parsing, lifecycle, observation-schema, and regression-test paths. No tests or rollouts were executed in this read-only review.
Inline comments (escaped v1):
-
responses_api_agents/opencode_agent/artifacts.pyline 304: RISK — Normalize tool outcomes before using them as invocation statusesFailure: Given root/child session rows, a child containing only its user message, and a root
tasktool with:{"status":"error","error":"Tool execution aborted","metadata":{"interrupted":true,"sessionId":"child","output":"partial"}}the new helper returns
status="cancelled". This assignment copies it intochild_status, and the invocation fallback passes it intoAgentInvocation.status. That contract permits only completed/failed/incomplete/unknown, so validation rejects the entire bundle instead of preserving the interrupted task and child. The capture handler then replaces valid transcript/tool evidence with capture-failure gaps. The sibling assignment has the same problem. Before this change, the errored task supplied the valid fallbackfailed.Correction: Could you replace this assignment and its sibling with the following, verifying it before adoption?
child_status[child_id] = {"timeout": "incomplete", "cancelled": "incomplete"}.get(status, status)The invariant is that tool observations keep their precise outcomes while invocation fallbacks satisfy the narrower invocation-status contract.
Preservation: Keep the parent tool cancelled/tool_aborted with output
partial; do not normalize the tool observation itself. Leave completed, failed, incomplete, and unknown fallbacks unchanged. Preserve the existing precedence of a child's own message-derived outcome over its parent-tool fallback.Acceptance — proposed tests, not executed: Parameterize both parsers with the root/child setup above. Assert parsing succeeds, the child invocation is incomplete, and the parent tool remains cancelled/tool_aborted with output
partial. Also assert ordinary error→failed, completed→completed, and running/pending→incomplete fallbacks; a child with its own completed assistant message must retain its message-derived status. Retain the existing interrupted-output assertions in test_interrupted_tools_keep_only_the_output_opencode_recorded; its root-only setup does not exercise this fallback.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
Signed-off-by: Frederic Lafrance <[email protected]>
6df5215 to
75b763d
Compare
|
The child-invocation fallback now maps cancelled and timeout tool outcomes to Fresh model-backed acceptance used OpenCode 1.17.11 and gpt-5.5 on this source. Both adapters executed an ordinary shell command and a shell command with a 1,000 ms timeout. Native artifacts showed completed/exit-zero for the ordinary command and completed/null-exit plus a timeout trailer for the interrupted command; normalized results were completed and timeout/tool_timeout respectively, with partial stdout preserved. The legacy adapter’s verifier received both results and returned an unmasked reward. Its explicit caller-cancellation case preserved a running tool’s partial stdout as incomplete, propagated cancellation, and never invoked the verifier. Native session cancellation was also exercised after a real long-running shell started: its retained native database showed the running tool and partial stdout; session close reported the tool as cancelled/invocation_cancelled and the invocation as incomplete, with cleanup confirmed. The native fixture exercises session APIs directly and does not fabricate verifier results. All successful cases stopped their owned sandbox and revoked their dependency lease. The legacy whole-invocation timeout attempt produced no exported tool evidence, so it is not counted as interrupted-tool qualification. Pre-model fixture startup failures are also excluded from the successful evidence. This is targeted adapter acceptance, not full-benchmark qualification. |
|
/review |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM — no remaining eligible concerns in this follow-up.
- The prior child-invocation validation failure is fixed in both artifact parsing and the sandboxed adapter. Cancelled/timeout tool outcomes map to incomplete only for invocation fallbacks; precise parent-tool outcomes, partial output, and child-message precedence remain intact. The regression cases assert those behaviors across both parsers.
- The author-reported model-backed checks address the earlier missing-validation-evidence finding, covering ordinary commands, shell timeouts with partial output, cancellation, verifier behavior, and cleanup. Their stated qualification limits are explicit.
Completed the scoped follow-up and directly affected contract checks, not a fresh whole-PR review. The previously reviewed tree was unavailable, limiting independent comparison of subsequent changes. No tests or rollouts were executed in this read-only review; runtime results remain author-reported.
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 findings-only review. Request a full review with /review reset=true.
|
/ok to test 75b763d |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP
LGTM — no remaining eligible concerns in this same-head follow-up.
- The earlier child-invocation validation failure remains fixed in both artifact parsing and the sandboxed adapter. Cancelled/timeout outcomes become incomplete only for invocation fallbacks; parent-tool outcomes, errors, partial output, and child-completion precedence remain intact. The regression assertions cover both parsers and the neighboring fallback statuses.
- The author-reported model-backed checks continue to address the earlier validation-evidence concern. They cover ordinary commands, shell timeouts with partial output, cancellation, verifier behavior, and cleanup, with qualification limits explicitly stated.
Completed the scoped verification and directly affected contract checks. The latest reviewed baseline equals the current head, so there are no subsequent changes eligible for new discovery; this is not a fresh whole-PR review. No tests or rollouts were executed in this read-only review; runtime results remain author-reported.
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 findings-only 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/40816437888 |
OpenCode shell timeouts and aborts can appear as completed or unknown tools, and interrupted tools can lose their partial output. Interpret native tool outcomes consistently across both OpenCode adapters, preserve partial output and compaction markers, and propagate invocation cancellation or timeout to tools left running.
Interrupted task tools retain their precise outcome while child invocation fallbacks use the valid
incompletestatus. Native child completion evidence takes precedence.Representative real-model checks cover ordinary commands, shell timeouts with partial output, and active-tool cancellation in both adapters using OpenCode 1.17.11 and gpt-5.5. A separate legacy whole-invocation timeout yielded no exported tool evidence and is excluded from interrupted-tool qualification.