Repository navigation
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
ae4cc9b to
3295f6a
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The finance and conversational skip paths bypass required session cleanup, causing unbounded resource-state retention.
2 open findings
What changed in this PR
Adds global skip_verification support to six agents so training runs can collect rollouts without invoking verifiers.
Changes:
- Return configured skip rewards while preserving rollout outputs and metadata.
- Bypass resource-server metric aggregation in three agents.
- Add skip-verification regression tests for all six agents.
| File | Description |
|---|---|
responses_api_agents/scicode_agent/tests/test_app.py |
Tests skipped verification and preserved sub-step outputs. |
responses_api_agents/scicode_agent/app.py |
Returns skip reward after generating solutions. |
responses_api_agents/opencode_agent/tests/test_app.py |
Tests skip reward and rollout metadata. |
responses_api_agents/opencode_agent/app.py |
Conditionally bypasses verification. |
responses_api_agents/non_executing_simple_agent/tests/test_app.py |
Tests skip reward and retained response. |
responses_api_agents/non_executing_simple_agent/app.py |
Bypasses verification and metric proxying. |
responses_api_agents/image_tools_agent/tests/test_app.py |
Tests configured base reward under skip. |
responses_api_agents/image_tools_agent/app.py |
Substitutes base reward while retaining auxiliary rewards. |
responses_api_agents/finance_agent/tests/test_app.py |
Tests skip reward and outbound calls. |
responses_api_agents/finance_agent/app.py |
Bypasses verification and metric proxying. |
responses_api_agents/conversational_tool_use/simulation/tests/test_app.py |
Tests skipped responses without judge results. |
responses_api_agents/conversational_tool_use/simulation/app.py |
Adds skip handling and relaxes result validation. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if self.config.skip_verification: | ||
| session_needs_discard = False |
There was a problem hiding this comment.
Confirmed: only /verify or /discard_session drops session_id_to_state, so clearing the flag leaked each skipped session (the super-v3.5 fork had the same bug). Fixed in b7d8a62: the skip path leaves session_needs_discard set so the existing finally posts /discard_session with the rollout cookies. The regression test now expects /seed_session -> /v1/responses -> /discard_session (asserting the seeded cookie) and still fails on any /verify.
| if self.config.skip_verification: | ||
| return FinanceAgentVerifyResponse.model_validate( |
There was a problem hiding this comment.
Confirmed: both finance servers freed _data_storage / _session_start_times only in verify and had no cleanup route. Fixed in b7d8a62: added POST /discard_session to finance_sec_search and finance_agent_v2 (registered ahead of the /{tool_name} catch-all) releasing exactly what verify releases, and FinanceAgent calls it with the session cookies before returning the fixed reward. The agent test now expects /discard_session and rejects /verify; each server gains a test that discard frees the seeded state without a judge call and is idempotent. Checked the other four agents in this PR: their resources servers keep no seed-to-verify state, so no further leaks of this class.
skip_verification / skip_verification_reward are declared on BaseResponsesAPIAgentConfig and injected globally, and simple_agent and tool_simulation_agent already honor them. Six agents accepted the fields (inherited from the base config) but still called /verify unconditionally: opencode_agent, finance_agent, scicode_agent, image_tools_agent, non_executing_simple_agent and conversational_tool_use/simulation. On-policy distillation runs set skip_verification=True globally because the teacher, not the verifier, supplies the training signal, so these agents either burned verifier/judge compute or failed when no verifier was provisioned. Port the per-agent skip handling from the training fork (Gym 14317ec) onto main. The fork and main share no merge-base, so the hunks are re-applied by hand against main's current code in the style of simple_agent: when the flag is set, skip the /verify POST and return the verify request echoed back with the fixed reward and verification_skipped=True. image_tools_agent still layers its aux reward on top of the fixed base reward. conversational_tool_use's verify-response validator accepts a skipped response with no typed judge result, and the three agents that proxy aggregate_metrics to the resources server fall back to the base implementation under skip, as simple_agent does. Add one unit test per agent asserting the fixed reward, the verification_skipped marker, and that only /seed_session and /v1/responses are called. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: adithyare <[email protected]>
…n path Review of #4154 found that two of the ported skip paths leaked per-session state on the resources server, because only /verify (or an explicit discard) releases it. conversational_tool_use/simulation: the skip path cleared session_needs_discard, so session_id_to_state was never dropped. Leave the flag set so the existing finally block posts /discard_session with the rollout's cookies. finance_agent: finance_sec_search and finance_agent_v2 allocate _data_storage and _session_start_times in seed_session and freed them only in verify, and had no cleanup-only route. Add a discard_session method and POST /discard_session to both servers, registered ahead of their /{tool_name} catch-all, releasing exactly the two dicts verify releases. The agent calls it with the session cookies before returning the fixed reward. Tests: the agent regression tests now expect /discard_session after /v1/responses (with the seeded cookies) and still fail on any /verify call; each finance resources server gains a test that discard frees the seeded state without touching the judge and is idempotent. The other four agents in the PR pair with resources servers that keep no seed-to-verify state (base seed_session, or vibench's stateless seed). Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: adithyare <[email protected]>
3295f6a to
b7d8a62
Compare
|
We’re doing some cleanup of the open PR list. This PR has had no activity for over a month, so I’ve moved it back to draft. If this change is still needed, please resolve any merge conflicts and mark the PR ready for review again when it’s ready to merge. Thanks! |

Branch:
adithyare/gym-skip-verification-agents(based on Gym mainbbb0c58e)Motivation
skip_verification: bool/skip_verification_reward: floatare declared onBaseResponsesAPIAgentConfig(nemo_gym/base_responses_api_agent.py) andinjected into every agent config by
nemo_gym/global_config.py. On-policydistillation (OPD) runs set
skip_verification=Trueglobally because theteacher, not the verifier, produces the training signal: the policy rollout is
collected,
/verifyis skipped, and the fixedskip_verification_rewardisreported with
verification_skipped: True.simple_agentandtool_simulation_agentalready honor the flag on main, butsix agents accept the config fields (inherited from the base config) and then
silently ignore them: they call
/verifyunconditionally. Under OPD thiseither wastes verifier/judge compute or fails outright when the resources
server's verifier is not provisioned for that run.
This PR ports the per-agent
skip_verificationhandling that already shippedin our training fork (Gym
14317ecb5) onto main. Main and that fork have nocommon merge-base, so the hunks were re-applied by hand against main's current
code, following the style of
simple_agent/app.pyon main.No issue is linked: the base config already documents the flag and these
agents simply did not implement it.
Per-agent changes
All six configs inherit
BaseResponsesAPIAgentConfig, so no config-classchanges are required; the fields were already accepted, just unused.
responses_api_agents/opencode_agent/app.pyrun(), whenskip_verificationis set, buildverify_jsonfrom the run request + agent response with the fixed reward andverification_skipped: Trueinstead of POSTing/verify.turns_used/finished_naturally/ observability fields are still attached.responses_api_agents/finance_agent/app.py_run_inner(), return aFinanceAgentVerifyResponseechoing the verify request with the fixed reward before the/verifycall.aggregate_metrics()falls back to the base-class implementation (which warns and returns empty metrics) instead of proxying to the resources server when verification is skipped, mirroringsimple_agent.responses_api_agents/scicode_agent/app.pyrun(), after assemblingsolutions,response,token_usage_versionandstep_usage, return that dict with the fixed reward instead of calling/verify. All sub-steps are still generated.responses_api_agents/image_tools_agent/app.pyrun(), substitute the fixed reward for the verifier's base reward; the image-tool aux reward is still layered on top, soreward = skip_verification_reward + image_tools_aux_rewardandbase_rewardis the fixed value.responses_api_agents/non_executing_simple_agent/app.pyfinance_agent: short-circuit/verifyinrun()and fall back to baseaggregate_metrics()under skip.responses_api_agents/conversational_tool_use/simulation/app.pyrun(), return the echoed verify request with the fixed reward and mark the session as not needing discard (the resources server session completed normally).ConversationalToolUseAgentVerifyResponse.require_result_for_scored_rolloutnow also accepts a response withverification_skipped=Trueand no typedresult, since no judge ran.aggregate_metrics()falls back to the base implementation under skip.The
aggregate_metricsfallback for the three agents that proxy aggregation tothe resources server (finance, non-executing, conversational tool-use) is a
small addition beyond the literal fork hunks: it matches what
simple_agentdoes on main and avoids asking a resources server to aggregate rows it never
scored.
Tests
One unit test per agent, each asserting that under
skip_verification=True, skip_verification_reward=0.25:reward == 0.25andverification_skipped is True,/seed_sessionand/v1/responses(the mockedserver_client.postraises on any other path, so a stray/verifyor/discard_sessionfails the test).Files:
responses_api_agents/opencode_agent/tests/test_app.py::TestSkipVerification::test_run_skip_verification_uses_configured_rewardresponses_api_agents/finance_agent/tests/test_app.py::TestRun::test_run_skip_verification_uses_configured_rewardresponses_api_agents/scicode_agent/tests/test_app.py::TestApp::test_run_skip_verification_uses_configured_rewardresponses_api_agents/image_tools_agent/tests/test_app.py::test_image_tools_agent_skip_verification_uses_configured_base_rewardresponses_api_agents/non_executing_simple_agent/tests/test_app.py::TestApp::test_run_skip_verification_uses_configured_rewardresponses_api_agents/conversational_tool_use/simulation/tests/test_app.py::test_run_skip_verification_uses_configured_reward_without_verifyAgent-specific assertions: scicode still generates every sub-step and keeps
solutions/token_usage_version; image_tools reportsbase_reward == 0.25,image_tools_aux_reward == 0.0,reward == 0.25; conversational tool-useyields
result is None, no transient-failure marker, andinstance_config == {"mask_sample": False}; opencode reportsturns_used == 1andfinished_naturally is True.Validation performed
ruff checkon the 12 touched files: passes.ruff format --checkon the 12 touched files: already formatted.python3 -m py_compileon all touched files: passes.uv sync --frozen --extra devenv, each agent'stest file run in isolation with the agent dir on
PYTHONPATH, mirroringgym env test; image_tools additionally needspillow numpy scipy requestsfrom its
requirements.txt):finance_agent/tests/test_app.py: 68 passednon_executing_simple_agent/tests/test_app.py: 5 passedscicode_agent/tests/test_app.py: 44 passedimage_tools_agent/tests/test_app.py: 4 passedopencode_agent/tests/test_app.py: 32 passedconversational_tool_use/simulation/tests/test_app.py: 37 passedpre-commit run --all-fileswas not run (no pre-commit in the throwawayenv); ruff check/format cover the Python hooks for the touched files.
Rollout evidence: N/A for this draft. The change is a pure short-circuit ahead
of the
/verifycall and does not alter the rollout itself; the fork versionof these hunks has been exercised in OPD training runs. A real smoke rollout
with
skip_verification=trueon at least one of these agents should berecorded before the PR is marked ready for review.
Review follow-ups
Copilot flagged two session leaks in the first revision (PR #4154 comments
4222309268 and 4222309372). Both premises were verified against the code on
main; both also existed in the fork version of these hunks (
14317ecb5), whichhad no finance cleanup endpoint either.
conversational_tool_use/simulation: the skip path setsession_needs_discard = False, but the resources server only dropssession_id_to_statein/verifyor/discard_session(
resources_servers/conversational_tool_use_simulation/app.pydiscard_session/verify). Fix: the skip path no longer clears the flag,so the existing
finallyposts/discard_sessionwith the session cookies.The regression test now expects
/seed_session,/v1/responses,/discard_session(withsession_id=session-1) and still fails on any/verifycall.finance_agent:finance_sec_searchandfinance_agent_v2allocate_data_storage/_session_start_timesinseed_sessionand freed themonly in
verify; neither server had a cleanup-only endpoint. Fix: add adiscard_session(request) -> DiscardSessionResponsemethod andPOST /discard_sessionroute to both servers (registered ahead of their/{tool_name}catch-all), releasing exactly the two per-session dicts thatverifyreleases and nothing else.FinanceAgent._run_innercalls it withthe rollout's session cookies before returning the fixed reward. Tests:
agent test expects
/discard_sessionafter/v1/responseswith{"session": "seeded"}and still rejects/verify; each resources servergains
test_discard_session_releases_seeded_state_without_judging(seed, populate storage, discard -> both dicts empty,
server_client.postnever called, second discard is a no-op).
The other four agents were checked for the same class of leak. Their in-repo
resources servers keep no per-session state across seed/verify:
scicode,image_tools,structured_outputs(non-executing agent) andterminal_multi_harnessuse the baseseed_session;vibench(opencode)returns the PRD text from
seed_sessionand stores nothing.opencode_agentand
non_executing_simple_agentare generic harnesses, so a statefulresources server paired with them in the future would need the same
/discard_sessiontreatment; that caveat already applies tosimple_agent'sskip path on main and is out of scope here.
Follow-up validation (same throwaway env, per-dir
PYTHONPATH; financeresources servers additionally need their
requirements.txt):ruff check/ruff format --checkon the 8 touched files pass;finance_agent/tests/test_app.py68 passed;conversational_tool_use/simulation/tests/test_app.py37 passed;resources_servers/finance_sec_search/tests/test_app.py79 passed;resources_servers/finance_agent_v2/tests/test_app.py114 passed;resources_servers/conversational_tool_use_simulation/tests/test_app.py35 passed (unchanged, sanity).
Compatibility
skip_verification=False) is unchanged for all six agents.pick this up.
🤖 Generated with Claude Code