Skip to content

feat(pi): upgrade the coding agent to 1.5.2 - #6454

Merged
yaoyu-33 merged 10 commits into
NVIDIA-NeMo:mainfrom
yaoyu-33:codex/upgrade-pi-runtime
Nov 25, 2026
Merged

yaoyu-33 merged 10 commits into
NVIDIA-NeMo:mainfrom
yaoyu-33:codex/upgrade-pi-runtime

Conversation

@yaoyu-33

@yaoyu-33 yaoyu-33 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What

Upgrade Gym's Pi harness (@earendil-works/pi-coding-agent) from 0.80.2 (0.85.1 in the offline science image) to 1.5.2, and adapt the Pi adapter to what 1.x changed. Release · npm

flowchart LR
  A["pi_agent default, benchmarks,<br/>AnySWE, pi_math, pi_reasoning_gym,<br/>offline science image"] -- "pin 1.5.2" --> P["Pi 1.5.2 CLI"]
  P --- G["Gym Pi adapter<br/>with 1.x handling"]
  X["DeepSearchQA, WideSearch<br/>via harness_exa_search"] -- "pin stays 0.80.2" --> O["Pi 0.80.2 CLI"]
  O --- S["adapter of Gym 621ecac,<br/>installed in the sandbox"]
  classDef new fill:#fff3b0,stroke:#b59f00,color:#000
  class P,G new
Loading

Why

Pi has published no 0.x release since 1.0.0, so staying on 0.80.2 means getting no fixes. Pi 1.x also moves its CLI, changes its error text and recovers cut-off replies by itself. Without matching adapter changes, transport failures are mistyped and a failed recovery is graded as if it were an answer.

How

Pi 1.x change Gym handling
CLI moved to dist/bundle/cli.js Installer, version probe and launcher go through npm's .bin/pi link; the installer forces --bin-links
Connection errors carry their cause (Connection error.: connect ECONNREFUSED …) The classifier matches the prefix, so they stay model_transport_error
Compacts and retries a length reply cut below the output cap See the diagram below
The bundled CLI turns on Node's compile cache in /tmp Turned off for the run, the runtime check and the installer's probe
A custom provider without limits defaults to 16384 output / 128000 window pi_math and pi_reasoning_gym declare their model cards' limits: 262144 window, 81920 / 16384 output
— Local setup checks that the configured command reports an exact pin
flowchart TD
  L["reply cut at length below the cap,<br/>after earlier tool turns"] --> C["Pi compacts, then retries the call"]
  C -- "compaction call succeeds" --> R["the retried reply decides the run"]
  C -- "compaction call fails, e.g. 503" --> F["run fails as that call did: kind unknown, retryable;<br/>response and invocation record both failed"]
  classDef new fill:#fff3b0,stroke:#b59f00,color:#000
  class F new
Loading

Pi 1.5.2 scores are not comparable with 0.80.2 or 0.85.1 runs:

Area Pi 1.x behavior
System prompt Rewritten preamble with no date; bash gets AI_AGENT=pi and PI_* variables
Output cap Set per call to fit the room left in the window; under output_token_policy: fixed it can drop to 1 token near a full window
Cut-off replies Tool calls of a length reply are not run; a retried reply stays in the output before its replacement
Tool arguments Coerced to the JSON Schema, for example "x" becomes ["x"]
Retries A failed summary call is retried 3 times (2, 4 and 8 s apart)

Compatibility:

  • Rebuild every image or archive that carries a Pi runtime: the offline science image, AnySWE baked images, prebuilt runtime archives, and /tmp/nemo-gym-pi-node-22.19.0-1.5.2. A host whose pi reports a version other than an exact pin now fails local setup; upgrade it with npm install -g @earendil-works/[email protected] (needs Node 22.19.0 or later).
  • 1.x ships no npm-shrinkwrap.json, so installs other than the offline image resolve Pi's dependencies at install time.
  • Not moved: DeepSearchQA and WideSearch run the adapter of the Gym commit their setup_command installs, so they stay on 0.80.2 until they leave harness_exa_search (feat(tavily_search): add Exa as a search provider and move the DeepSearchQA and WideSearch session harnesses onto it #5827). swe_atlas_qa/pi.yaml has no pin, and skill_trigger uses Harbor's Pi agent.

Issue: none; this is a self-contained dependency upgrade. Rollout evidence: with a hosted model on Pi 1.5.2, an agent-session smoke and a shipped pi_math run each scored 1.0. No Terminal-Bench 2.1 before/after evaluation has been run.

🤖 Generated with Claude Code

@yaoyu-33 yaoyu-33 added feature New capabilities, enhancements, or enablement work area:agent Agent harnesses and Responses API agent behavior labels Nov 19, 2026
@copy-pr-bot

copy-pr-bot Bot commented Nov 19, 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.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the risk:high Autobot PR risk: high label Nov 19, 2026
yaoyu-33 and others added 4 commits November 19, 2026 19:52
… 1.x

Local setup now runs the configured command with its environment overrides to
check an exact pi_version, skips the check for latest or npm ranges, and turns
a failing or hung version command into the setup error with its output. The
renamed host toolchain prefix, lock and record are git-ignored.

Comments, the README and the harness guide no longer describe 0.80.2-specific
behavior, and the README notes the output cap that Pi 1.x sends itself.

Tests seed the real-Pi sessions with the pinned version, cover a cut-off
finish call with parsable arguments (Pi 1.x refuses the calls of a length
reply itself), pin Pi's retry policy in the compaction test, and cover the
installer's .bin/pi probe and the new local setup branches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…f replies

Pi 1.x appends the cause to a connection error ("Connection error.: connect
ECONNREFUSED ..."), so classify_outcome now matches the prefix and keeps such
failures typed as model transport errors.

Pi 1.x also compacts and retries a length reply cut below the output cap. When
that compaction call fails, the run now fails as the compaction call did,
retryable by default, instead of grading the cut-off reply.

Pi's bundled entry script enables Node's compile cache, which left files in
the task sandbox's /tmp: Gym now disables it for the Pi run, the runtime check
and the installer's version check. The installer passes --bin-links so a task's
npm config cannot drop the .bin/pi link that Gym runs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
… typing

DeepSearchQA and WideSearch run the Pi adapter of the Gym commit that their
setup_command installs in the sandbox. That adapter predates Gym's Pi 1.x
handling, so these two presets stay on 0.80.2 until setup_command moves to a
Gym commit that has it.

The pinned-Pi HTTP error test now also checks that the adapter types the
pinned Pi's error message as a model request error with its status.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test bf5dfd0

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

…ironments

Pi 1.x sends each call's cap itself: the provider model's maxTokens, 16384
when unset, fitted to its contextWindow, 128000 when unset. Pi 0.80.2 sent no
cap. pi_math and pi_reasoning_gym now declare their models' native 262144-token
context and the model cards' output lengths: 81920 for Qwen3.5-397B-A17B on
competition math, 16384 for Qwen3-Next-80B-A3B-Instruct.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test 0503090

@yaoyu-33
yaoyu-33 marked this pull request as ready for review November 20, 2026 17:28

@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 WITH CARE

RISK: Provide the required Terminal-Bench 2.1 upgrade comparison.

The PR explicitly lists a full Terminal-Bench 2.1 before/after evaluation as unvalidated. This upgrade changes the shipped Pi pin used by the benchmark's documented Pi pairing, so that supported pairing moves to 1.5.2 without the required qualification evidence. The trusted harness-upgrade guidance requires the complete benchmark with eight repeats before and after an upgrade; the reported file-task and math smokes do not meet that requirement.

Could you run Pi 0.80.2 and 1.5.2 against the same pinned Terminal-Bench 2.1 revision and real model, keeping prompts, sampling, budgets, provider, task images, verifier and concurrency fixed apart from the harness version? Keep golden-patch mode disabled and retain the existing representative smokes as separate evidence. No score-equality requirement is implied, but explain score and failure shifts.

Acceptance evidence: account for all 89 tasks × 8 repeats, 712 expected outcomes per version, without smoke-only filters. Report attempted, graded and missing counts, aggregate scores with denominators, per-task rewards, and incomplete or failed evaluations. Separate known task/verifier failures and infrastructure failures from valid zero rewards. Link the resolved configurations, commands, rollouts, verifier outputs, failure sidecars, quality_summary.json and saved-rollout evidence-check results. This is a validation gap, not a demonstrated production failure.

NOTE: The inline finding concerns inconsistent invocation-status evidence after a failed cut-off recovery. The response's retry classification is already handled correctly.

I reviewed all 30 changed files and traced the affected launch, outcome and configuration paths. This was a static review; I did not execute tests or independently reproduce the reported rollouts.


Inline comments (escaped v1):

  • responses_api_agents/pi_agent/app.py line 1303: NOTE: Reconcile invocation status after a failed cut-off recovery.

    A final assistant length reply followed by agent_end and a failed overflow compaction now produces a failed response through the new recovery branch. However, _build_pi_observations() maps that last length reply to invocation status "incomplete". This reconciliation block excludes errors, and close returns those observations unchanged. The response correctly reports the provider failure, but its invocation evidence still describes a limit stop.

    Could you reconcile this recognized compaction failure too? Replace the block at lines 1303–1306 with:

    if (compaction_failure is not None and error) or (incomplete and not error):
        for record in state.observations.records:
            if isinstance(record, AgentInvocation):
                record.status = "failed" if error else "incomplete"

    This makes the invocation agree with the failed recovery without changing response classification. It keeps ordinary length limits and timeouts incomplete, successful recovery completed, and successful finish-tool completion unchanged. Verify this suggested code before adopting it.

    Proposed acceptance checks, not executed: extend the cut-off recovery test to assert one invocation with status "failed" after summary HTTP 503 and "completed" after HTTP 200. Retain "incomplete" when recovery succeeds but the retried call overflows in the context-limit test, and retain the existing finish-tool assertion that the invocation is completed.

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

@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test 09bc707

Port the Pi 1.x launcher path (.bin/pi), NODE_DISABLE_COMPILE_CACHE and the
compaction-failure classification of cut-off replies into main's
_sandbox_payload/reported_error refactor, and update the Pi pin named in the
harness guide, the pi_agent README and the DeepCAD harness table.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test 5e4a195

yaoyu-33 and others added 2 commits November 25, 2026 10:15
Resolve the job_bench and workspace_bench Pi presets, which main moved to pi_agent at 0.80.2, to main's blocks
at this branch's 1.5.2 pin, and keep main's HLE-Diamond README text with the 1.5.2 pin. Main's Agentic-VBench
overlay test checks the shipped pin, so it now expects 1.5.2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…ails

When Pi's compaction call fails while it recovers a reply cut off at the length limit, the response already fails
as that call did, but the invocation record kept the `incomplete` status of the cut-off reply that Pi's events
end on. The record now takes the response's status in that case too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33

Copy link
Copy Markdown
Contributor Author

/ok to test 93cc4b6

@yaoyu-33
yaoyu-33 merged commit 68c4cb4 into NVIDIA-NeMo:main Nov 25, 2026
70 of 72 checks passed
weijiac0619 added a commit that referenced this pull request Dec 2, 2026
main's Pi adapter targets Pi 1.x since #6454, and a 0.80.2 runtime runs
only with the adapter of an earlier Gym commit. Pin the version the
adapter now expects, and build the runtime at that version.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: weijia chen <[email protected]>
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 feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer risk:high Autobot PR risk: high sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants