Skip to content

fix(agents): refuse agent sessions in gdp_pdf_agent and labbench2_vlm_agent - #5695

Closed
yaoyu-33 wants to merge 5 commits into
mainfrom
yuya/agents-refuse-sessions-without-task-inputs
Closed

yaoyu-33 wants to merge 5 commits into
mainfrom
yuya/agents-refuse-sessions-without-task-inputs

Conversation

@yaoyu-33

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

Copy link
Copy Markdown
Contributor

What and why

gdp_pdf_agent and labbench2_vlm_agent subclass SimpleAgent, so they inherit its agent sessions. But both build the model input in run():

  • gdp_pdf_agent reads the task's document manifest (verifier_metadata.document_manifest) and adds the page text and images.
  • labbench2_vlm_agent embeds the images and PDFs under verifier_metadata.media_dir.

An agent session receives no task data. Put behind single_agent_turn or single_agent_turn_legacy, both agents therefore ran the bare prompt: the model answered without the document or the images, and nothing reported it.

Each agent now overrides Simple Agent's _new_session_state (the state hook its seed and checkpoint restore both call) to raise AgentSeedRejectedError. The seed answers a terminal 422 that names the reason and says to use a legacy_agent environment server. An environment server treats 422 as terminal, so the episode fails once with that message instead of being scored.

Neither agent defines _seed_agent_session_state, so the core tests that keep AGENT_SESSION_AGENT_TYPES and the session close hooks in step with the agent apps need no change: both agents stay out of the set, and config composition keeps relaying them through /run. (An earlier version overrode _seed_agent_session_state, which failed test_session_contract_repo.py's rule that a seeding agent also implements _close_agent_session_state.)

No public issue: this is a fail-closed guard until these agents can receive their documents and images through an agent session. That delivery is a separate change.

Compatibility

  • The shipped gdp_pdf and labbench2_vlm configs (resources server and benchmark) already use a legacy_agent relay, so nothing they run changes.
  • Neither agent is in AGENT_SESSION_AGENT_TYPES, so a config swap to either agent still relays it through /run.
  • A config that pointed single_agent_turn or single_agent_turn_legacy directly at either agent now fails every episode with the 422 message. Before, it scored answers given without the task's inputs.

Validation

Primary venv with the worktree on the path, Python 3.13:

  • responses_api_agents/gdp_pdf_agent/tests: 60 passed, 16 skipped (example manifests not present). Pillow was added from a scratch directory.
  • responses_api_agents/labbench2_vlm_agent/tests: 5 passed.
  • With origin/main's app.py swapped in, both new seed tests fail. The agent accepts the seed and returns 200.
  • tests/unit_tests/config/test_global_config.py and tests/unit_tests/tooling/test_add_legacy_agent_environment_servers.py: 367 passed.
  • pre-commit run --files <changed files>: passed.

At 68655f05c (main merged at 379ae226d, after a review round that moved the refusal to _new_session_state): test_session_contract_repo.py + test_global_config.py: 233 passed (the contract test failed in CI at 875223b30); gdp_pdf_agent + labbench2_vlm_agent tests: 65 passed, 16 skipped; pre-commit run --files: clean. test_global_config.py is no longer changed by this PR.

At 33c34d38d (main 028348701 merged; only gdp_pdf_agent's imports conflicted with #5740, which types run()'s failed model calls): gdp_pdf_agent + labbench2_vlm_agent tests, test_global_config.py and tests/unit_tests/agents/test_raw_verify_typed_row.py: 302 passed, 14 skipped; test_session_contract_repo.py: 2 passed; pre-commit run --files: clean.

Merging with #5704 / #5706: whichever lands second drops this PR's refusal for that agent, its refusal test and README paragraph. Both edits change _new_session_state, so the merge conflicts visibly instead of one silently shadowing the other.

Rollout evidence

N/A. The change only refuses the agent-session seed, which no shipped config sends to these agents. The new tests drive the agent's real /v1/agent_sessions route. The /run path the shipped configs use is unchanged.

🤖 Generated with Claude Code

…_agent

Both agents subclass SimpleAgent and inherit its agent sessions, but they
build the model input in run(): gdp_pdf_agent from the task's document
manifest, labbench2_vlm_agent from the images under
verifier_metadata.media_dir. An agent session receives no task data, so
under single_agent_turn the model silently answered without the document
or the images.

Each now overrides _seed_agent_session_state to raise
AgentSeedRejectedError, which a seed answers with a terminal 422 naming the
reason and the legacy_agent relay to use instead. The shipped configs
already use that relay, so nothing they run changes.

The test that keeps AGENT_SESSION_AGENT_TYPES in step with the agent apps
no longer counts an override whose body only raises: those agents do not
implement sessions, and config composition must keep relaying them
through /run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33 yaoyu-33 added bug Something isn't working area:agent Agent harnesses and Responses API agent behavior labels Nov 5, 2026
@copy-pr-bot

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

@yaoyu-33

yaoyu-33 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 875223b

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

yaoyu-33 and others added 3 commits November 6, 2026 11:14
…t state hook

- Raise the refusal from _new_session_state instead of a raise-only _seed_agent_session_state override, so the
  repo session contract test (seed hook requires a close hook) passes; the seed still answers a terminal 422
  with the same detail and holds no session.
- Revert the raise-only AST exemption in test_global_config.py: neither agent defines the seed hook now, so the
  plain source check already keeps them out of AGENT_SESSION_AGENT_TYPES.

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

yaoyu-33 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 68655f0

…ssions-without-task-inputs

Only gdp_pdf_agent's imports conflicted with main's failed-call typing.

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

yaoyu-33 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 33c34d3

@yaoyu-33

Copy link
Copy Markdown
Contributor Author

Closing in favor of #5704 (labbench2_vlm_agent) and #5706 (gdp_pdf_agent). On #5703's agent context, they deliver the media and the document in agent sessions and move the shipped benchmark configs onto sessions, so refusing sessions is no longer needed.

@yaoyu-33 yaoyu-33 closed this Nov 10, 2026

This branch was previously deployed

1 inactive deployment
public — 33c34d38 Deployed Nov 6, 2026 by copy-pr-bot[bot] via release / finalize / notify #10775
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 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant