Skip to content

Add initial repo template - #2

Merged
chtruong814 merged 9 commits into
mainfrom
chtruong/template
Aug 29, 2025
Merged

chtruong814 merged 9 commits into
mainfrom
chtruong/template

Conversation

@chtruong814

Copy link
Copy Markdown
Contributor

Add initial repo template

Signed-off-by: Charlie Truong <chtruong@nvidia.com>
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
pablo-garay
pablo-garay previously approved these changes Aug 29, 2025
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
@chtruong814
chtruong814 merged commit 3b355cb into main Aug 29, 2025
abubakaria56 pushed a commit to abubakaria56/Gym that referenced this pull request Feb 28, 2026
…flagging

Flagging validation issues and writing them into error.json
abubakaria56 pushed a commit to abubakaria56/Gym that referenced this pull request Mar 2, 2026
…flagging

Flagging validation issues and writing them into error.json

Signed-off-by: Dhrutisundar Sahoo <dhrutisundar.sahoo@turing.com>
abubakaria56 pushed a commit to abubakaria56/Gym that referenced this pull request Mar 2, 2026
…flagging

Flagging validation issues and writing them into error.json

Signed-off-by: Dhrutisundar Sahoo <dhrutisundar.sahoo@turing.com>
abubakaria56 pushed a commit to abubakaria56/Gym that referenced this pull request Mar 2, 2026
abubakaria56 pushed a commit to abubakaria56/Gym that referenced this pull request Mar 2, 2026
…flagging

Flagging validation issues and writing them into error.json

Signed-off-by: Dhrutisundar Sahoo <dhrutisundar.sahoo@turing.com>
abubakaria56 pushed a commit to abubakaria56/Gym that referenced this pull request Mar 2, 2026
abubakaria56 pushed a commit to abubakaria56/Gym that referenced this pull request Mar 2, 2026
…flagging

Flagging validation issues and writing them into error.json

Signed-off-by: Dhrutisundar Sahoo <dhrutisundar.sahoo@turing.com>
@bxyu-nvidia
bxyu-nvidia deleted the chtruong/template branch March 26, 2026 22:41
lbliii added a commit that referenced this pull request Apr 30, 2026
Three additions sourced from PR #1062 (skill-eval harness dogfooding).

- Quickstart step 3: replace "Four Uvicorn lines print" with
  ng_status verification. Lawrence's flow uses ng_status; it's faster
  than scanning logs and produces an unambiguous "N healthy" signal.
- Quickstart step 3: add a Tip for returning users — append
  +skip_venv_if_present=true to ng_run to skip venv re-creation.
  Real flag in cli_setup_command.py:116-117.
- Configuration troubleshooting: new accordion for the trailing-slash
  gotcha (a "/" at the end of policy_base_url produces double-slash
  request paths some providers 404 on). From PR #1062 sharp edge #2.

Verified ng_run blocks (cli.py:410 calls rh.run_forever); two-terminal
pattern in Quickstart is correct, no change needed there.

Signed-off-by: Lawrence Lane <llane@nvidia.com>
agronskiy added a commit that referenced this pull request May 20, 2026
…uting (#1367)

## Summary

Two coupled changes that together fix walltime-induced rollout loss on
multi-node GDPVal runs.

**1. Per-task timeout** — default 3h30m, env
`STIRRUP_PER_TASK_TIMEOUT_S` overrides. Wraps `await future` in
`asyncio.wait_for`; on timeout, `ray.cancel(future, force=True)` +
raises `TaskPerAttemptTimeoutError`. Logs once per process at first
dispatch.

**2. Failure classification + sidecar routing** — at the two
`_build_failed_run_payload` callsites, every failure is classified into
one of five classes and persisted accordingly:

| class | persist | retry on chain-hop 2 |
|---|---|---|
| `kill_shaped` (Ray actor died, SIGTERM, OOM, node failure) | NO row
anywhere | yes, unbounded (per-attempt timeout bounds wallclock) |
| `timeout_exceeded` | 1 sidecar entry, `_ng_failure_terminal=True` | no
|
| `skipped` (TaskSampleSkipError) | 1 sidecar entry, terminal | no |
| `transient` (verify-side 5xx, ConnectionError, asyncio.TimeoutError) |
sidecar entry per attempt | yes, up to `NEMO_GYM_MAX_ROLLOUT_ATTEMPTS`
(default 3) |
| `legitimate` (real Python exception with user code in traceback) |
sidecar entry per attempt | yes, up to max_attempts |

Successes still write to `<output_jsonl_fpath>`; failures write to
`<stem>_failures.jsonl`. `_load_from_cache` reads both: main jsonl is
the success ledger, sidecar tracks attempts + terminal flags. The retry
set is `materialized_inputs − (successes ∪ terminal ∪ maxed_out)`.

## Why this matters

Without #1, a single pathological task that exceeds Slurm walltime can
permanently consume every chain-hop's compute and never complete.

Without #2, walltime-killed in-flight rollouts permanently disappear on
chain-hop 2. The old `_load_from_cache` dedup keyed on `(task_index,
rollout_index)` regardless of `-failed` status, so synthetic `-failed`
rows written during the SIGTERM grace window looked already-done to the
resumer. Worse, under harsh kills (SIGKILL, OOM) the `-failed` row write
itself is non-atomic — we couldn't depend on it being there to filter.
Using "row absent from main jsonl" as the canonical "needs retry" signal
sidesteps both problems: kill_shaped writes nothing at all, so the disk
state survives arbitrary kill timing.

See the debug write-up for the production incident and design rationale:
https://gitlab-master.nvidia.com/agronskiy/idea/-/blob/main/reports/debug/20260519T1011-gdpval-missing-histories.md

## Kill-shaped detection

`_classify_rollout_failure` uses Ray's actor-died classes
(`RayActorError`, `WorkerCrashedError`, `NodeDiedError`,
`OutOfMemoryError`, `LocalRayletDiedError`) plus a
user-code-in-traceback fallback for `RayTaskError`. The fallback
distinguishes a real user exception (frames under
\`responses_api_agents/\` or \`stirrup/\`) from Ray's internal
post-mortem (e.g. summary-builder hitting a vanished worker log after
Slurm's epilogue scrubbed `/tmp/ray`) — the latter is the walltime /
SIGTERM signature and routes to `kill_shaped`. Detection fails open: if
Ray's exception surface drifts, everything goes to bounded-retry
`legitimate` instead of unbounded-retry `kill_shaped` — safe, not
catastrophic.

## Knobs

- `STIRRUP_PER_TASK_TIMEOUT_S` — per-attempt timeout (default 12600 s =
3h30m).
- `NEMO_GYM_MAX_ROLLOUT_ATTEMPTS` — max retries per `(task_index,
rollout_index)` (default 3).

## Test plan

- \`python -m py_compile\` clean for both edited files.
- ruff format clean.
- Suggested smoke: run a GDPVal eval with
`STIRRUP_PER_TASK_TIMEOUT_S=60`, confirm the log line is emitted once
and that long-running rollouts get cancelled cleanly with
`_ng_failure_class=timeout_exceeded` in `<stem>_failures.jsonl`.
- Suggested integration: deliberately kill the deployment srun mid-run
(`scancel -s TERM`), verify `_failures.jsonl` is unchanged (kill_shaped
writes nothing) and that on chain-hop 2 the killed rollouts re-dispatch.

---------

Signed-off-by: Alex Gronskiy <agronskiy@nvidia.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
wprazuch added a commit that referenced this pull request Jun 22, 2026
…M6g)

Add a reusable LLM-as-judge resources-server template and a --template flag to
ng_init_resources_server. `+template=judge` scaffolds a verifier whose verify()
calls another model (judge / reward model / subagent) via the server client,
wiring judge_model_server + judge_responses_create_params in the generated config,
with a bounded judge-call semaphore and a clamped 0..1 reward parser.

This is additive: the default 'basic' template is unchanged and the existing
LLM-as-judge servers are left untouched (consolidating them is a separate,
owner-sensitive change). New template files live under nemo_gym/resources/ and
are omitted from coverage (copied verbatim into generated servers; exercised by
the bundled test template inside a scaffolded server).

Implements M6g (epic #1205, friction #2/#7).

Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
copy-pr-bot Bot pushed a commit that referenced this pull request Jun 25, 2026
…ool error

Addresses review feedback on MCPResourcesServer:
- (#3) Replace the per-process token->session dict with a stateless signed token (itsdangerous
  URLSafeSerializer keyed by the deterministic session-middleware secret). Any worker can verify a
  token another worker minted, so this works with num_workers > 1 and there is nothing to evict.
- (#1) Offload blocking sync @gym_tool methods to a threadpool so they don't stall the event loop
  (and every concurrent rollout in the worker).
- (#2) Raise a plain MCPSessionError with a clean message instead of HTTPException(401). MCP runs
  over JSON-RPC (HTTP 200), so the status code never reaches the client; FastMCP surfaces this as a
  tool error (isError: true).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Codex <codex@openai.com>
mjmikulski added a commit that referenced this pull request Jul 16, 2026
…#2)

- _sanitize_function_call_args: blanks the malformed function_call's arguments to
  "{}" in-place, matched by call_id, leaving good calls + tool outputs untouched
  (3 cases incl. no-match no-op).
- responses(): a non-JSON tool-call argument does not crash the rollout; the /tool
  POST is skipped and the loop continues to a final answer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: MJ Mikulski <mmikulski@nvidia.com>
fayejf added a commit that referenced this pull request Oct 5, 2026
…pace WORKDIR

Two bugs, both from the same root cause: the generic agent-sandbox
image (_AGENT_SANDBOX_IMAGE) doesn't have /workspace pre-created by
its own Dockerfile the way the per-task pinned images happen to.

1. SandboxSpec.files uploads into the container AFTER its entrypoint
   has already started (AsyncSandbox.start() calls provider.create()
   first, then uploads - nemo_gym/sandbox/api.py), and SandboxSpec's
   `workdir` is only ever used later as an exec cwd, never to create
   the directory. So files={"/workspace/start.md": ...} silently
   dropped the content on any image whose own WORKDIR isn't already
   /workspace - confirmed via `find / -name start.md` finding nothing
   at all in a live sandbox from the generic image. Fixed by
   explicitly `mkdir -p /workspace` via exec, then uploading start.md
   via sandbox.upload() (not SandboxSpec.files, and not inlining the
   content into a sandbox.exec() command string either - some
   start.md specs run up to ~375KB, and this codebase already hit a
   real `argument list too long` failure the last time large
   NL2RepoBench content was inlined into an exec command, per the
   comment in benchmarks/nl2repobench/opencode.yaml).

2. Even with start.md correctly sitting in /workspace,
   OpenCodeSandboxedAgent reconnects to the sandbox using only
   sandbox_handle and otherwise defaults the opencode run exec's cwd
   to the booted image's own WORKDIR (opencode_sandboxed_agent/
   app.py:496) - /workspace for the per-task images, but e.g.
   /openhands/code for the generic image. seed_session now returns
   workdir="/workspace" explicitly in its response so the agent
   reconnects with the right cwd regardless of the image's own
   default (threaded through AsyncSandbox.connect ->
   SandboxSpec(workdir=...) -> exec(cwd=...), nemo_gym/sandbox/api.py).

Without fix #2, fix #1 alone isn't sufting - the file would exist on
disk but the agent's shell would still start in the wrong directory
and never find it, exactly as observed in a live rollout trace
(agent ends up in /openhands/code, start.md nowhere to be found).

Signed-off-by: Fei Jia <fjia@nvidia.com>
copy-pr-bot Bot pushed a commit that referenced this pull request Nov 2, 2026
fix(env): address locked environment review regressions

This branch was previously deployed

2 inactive deployments
nemo-ci — 8d34f138 Deployed Aug 29, 2025 by copy-pr-bot[bot]
test — 8d34f138 Deployed Aug 29, 2025 by copy-pr-bot[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants