Skip to content

feat(gdp_pdf_agent): deliver the document in agent sessions - #5706

Open
yaoyu-33 wants to merge 39 commits into
mainfrom
yuya/gdp-pdf-agent-context
Open

yaoyu-33 wants to merge 39 commits into
mainfrom
yuya/gdp-pdf-agent-context

Conversation

@yaoyu-33

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

Copy link
Copy Markdown
Contributor

GDP.pdf now delivers the PDF through agent sessions when run from the benchmark config or selected through agent composition. This builds on the role-keyed agent context from #5703.

Paired before/after rewards at 9e0e04285

Compared base c2974f7bd (shipped legacy relay → agent /run) with head 9e0e04285 (shipped flat-row environment → agent session) on the same three committed GDP.pdf examples as the earlier comparison. Both arms used NVIDIA NIM nvidia/nemotron-3.5-super-vl-120b-a12b for policy and rubric judging, 150 DPI, thinking disabled, temperature 0 for policy generation and a 4,096-token policy output cap. Each task ran once per arm.

GDP.pdf example Pages Criteria Base reward PR reward Δ
Warehouse bonuses (9ef247ac) 10 16 0.3125 0.3750 +0.0625
Construction punch list (55fe580d) 4 6 0.8333 0.1667 -0.6667
Production scheduling (758bb8e1) 5 26 0.1538 0.1923 +0.0385
Unweighted mean across tasks 0.4332 0.2447 -0.1886

All three pairs sent byte-equivalent canonical policy payloads, including the page images, and had identical input-token counts. All 96 criterion evaluations completed and all six rows were unmasked. A preliminary run hit judge HTTP 429s. The table uses the completed, rate-paced rerun. On the construction task the base answer named Norske as the worst subcontractor and earned 5/6 criteria. The session answer named Warner Stellian and earned 1/6. Replaying all six saved answers and their judge replies through each revision reproduced every criterion score and reward. One attempt on each of three tasks limits inference about benchmark-wide score changes.

The verifier graded the answers returned at the output cap for Warehouse bonuses (before, after), Production scheduling (after).

What and why

gdp_pdf_agent builds the model input from the task's document manifest in run(): page images and extracted text, with a reactive DPI, compositing and text-only backoff when the policy model rejects the request's size. It inherits Simple Agent's agent sessions, but an agent session never reaches run(), so under single_agent_turn the model answered the bare prompt without the document.

With the agent-context contract from #5703:

  • Context. The agent declares agent_context_model with document_manifest, a required artifact. benchmarks/gdp_pdf/prepare.py writes agent_context = {"agent": {"artifacts": {"document_manifest": {"path": ...}}}} into every rendered-document row, keyed by single_agent_turn's one role, agent, and the committed example.jsonl rows carry it. Nothing else in those rows changed.

  • Seed. _new_session_state resolves the manifest under documents_base_dir. That also covers a checkpoint restore, which rebuilds sessions through the same method. A missing agent_context, a missing, unreadable or malformed manifest, a page image outside the manifest's directory, or a manifest rendered at a DPI other than dpi is refused with a terminal 422. documents_base_dir must be the real directory, not a symlink to other storage (the README gives an example).

  • Activation. The delivery runs in _create_session_episode, the Simple Agent hook from feat(agents): deliver per-task agent context to agent sessions #5703, which gets the session state. The agent does not override responses(), so environment validation still infers custom-gym-verifier, the profile the benchmark manifest declares. The session builds each attempt with _document_request, which run() now uses too, so both paths send the same request. The backoff runs inside the one activation. In a session, Simple Agent returns a model HTTP error as a failed response instead of raising it, so _session_model_error reads the input limit from that response, with the same classifier run() uses.

  • Delivery record. It goes into the response's document_delivery metadata as a JSON string, with pages_truncated in it. gdp_pdf's verify() copies it to the row's document_delivery, agent_adaptations and failure_reason (and verifier_metadata.pages_truncated), so a session row has the fields a /run row has.

  • mask_failed_attempts (feat(gdp-pdf): training reward modes and opt-in masking of failed attempts #5529). In a session the Environment Server returns the row, so for a document that never fits the agent marks its delivery record, and verify() sets mask_sample, failure_kind and instance_config.mask_sample as run() does.

  • Observations. With strip_images_from_output on, the session's trajectory, and so its observations and ng_trajectory, lose the page images and gain a multimodal_history_redacted gap.

  • Shipped configs. resources_servers/gdp_pdf/configs/gdp_pdf.yaml and benchmarks/gdp_pdf/config.yaml now put single_agent_turn_legacy in front of the agent instead of the legacy_agent relay, so their episodes run in agent sessions. Benchmark data prepared before agent_context existed is refused at the seed with 422; gym eval prepare --benchmark gdp_pdf writes the key. The README says so.

The standard single-message rows keep their request shape on both paths. Both also accept a string prompt, preserve surrounding messages, and stop at the DPI floor when the PDF has no text for a fallback request.

#5703 now keys a row's agent_context by participant role, so prepare.py and the example rows write the context under agent. A row in the earlier unkeyed shape is refused with 422 at the task input, before the agent is seeded.

#5695, which refused agent sessions in this agent until document delivery existed, is closed in favor of this PR.

No public issue: this is the document-delivery migration of one agent onto the contract in #5703.

Behavior that differs from /run (please review)

Model errors other than input limits no longer differ: since #5740 on main, run() also lets them leave as typed failures instead of scoring a zero, and a session returns the model_request_error failure Simple Agent reports (after its own 5xx retries) for the Environment Server's outcome policy. In both, only a terminal input limit is a scored zero.

  • Verification belongs to the Environment Server. run() retried a verify lost in transport and then masked the row with reward 0. In a session, a verify failure is the Environment Server's typed failure.
  • skip_verification. single_agent_turn now has skip_verification and skip_verification_reward, which fall back to the agent's own settings. When verification is skipped, even a document that never fit receives the fixed reward. Its delivery record stays in response metadata. Training that depends on the GDP.pdf mask needs verification enabled.
  • An empty-body 5xx that never stops. Gym's model servers relay an upstream empty-body 500 with the empty body, and the agent backs off on it as a possible size limit. If the last attempt, text-only, is still rejected that way, a session returns the classified model_request_error (status 500) instead of the unclassified zero; a real size verdict (413, context-length text) still ends as the scored zero. run() is unchanged.

Validation

Training token capture, head 9e0e04285. Ran the shipped session environment on the four-page construction example (55fe580d) with NIM nvidia/nemotron-3.5-super-vl-120b-a12b, capture enabled for the agent, and the vLLM adapter requesting token IDs and chosen-token logprobs. The returned message and the durable Gym token record matched element for element: 10,268 prompt IDs, 16 generation IDs, and 16 generation logprobs. Finalization kept mask_sample=false. This capture-only probe skipped grading and reached its deliberate 16-token output cap. It covers a single session activation.

Preset choice. GDP.pdf ships its session config only. The single_agent_turn_legacy environment accepts the existing flat dataset rows and drives the agent session. There is no separate *_legacy_agent.yaml preset for GDP.pdf.

At 9e0e04285, against main c2974f7bd:

  • Registered gdp_pdf_agent with the session-capable agents used by config composition. Fixed stale role keys and mismatched document paths in the prepared-data cache, empty manifests, and seed checks for page images omitted by the configured image cap.
  • An image rejection can fall back to extracted text when available. The final record reports the images in the actual request. Rejected image requests stay redacted when the last attempt is text-only or the activation is interrupted.
  • Ran python -m pytest --import-mode=importlib separately on responses_api_agents/gdp_pdf_agent/tests, resources_servers/gdp_pdf/tests, tests/unit_tests/config/test_global_config.py, tests/unit_tests/server_runtime/test_agent_context.py, environment_servers/single_agent_turn/tests and environment_servers/single_agent_turn_legacy/tests. 946 passed, 15 skipped (example media). Reproduced the registry, stale-cache and document-delivery failures before applying the fixes.
  • pre-commit run --all-files passed. The private guardwords catalog was unavailable. gym env validate --config benchmarks/gdp_pdf/config.yaml and gym env validate --config benchmarks/gdp_pdf/opencode.yaml +gdp_pdf_sandbox_image=gdp-pdf-tools both reported valid in non-strict mode.

At 8de9ca46a2 (main 90e192df93 merged; review fixes), on a Linux workstation with Python 3.13.14:

  • Fixes from the review:
    • prepare.py writes agent_context only for rows with a rendered manifest. prepare_opencode.py (feat(gdp-pdf): add OpenCode environment and benchmark #5635) prepares rows without one, which carried an empty manifest path, so every OpenCode GDP.pdf session would have been refused with 422.
    • is_prepared_data_current prepares a cached file again when its rows lack agent_context.
    • mask_failed_attempts now works in sessions, as described above.
    • The seed refuses a page whose text or page image the delivery would read is missing. A storage error reading the manifest (EIO, ESTALE) fails the seed as a retryable error, not a terminal 422.
    • README fixes.
  • Tests: gdp_pdf_agent: 94 passed, 14 skipped. gdp_pdf: 133 passed, 1 skipped. Skips are the example documents, which are not committed. The round adds 12 tests and extends the OpenCode prepare test. With the pre-fix app.py files and prepare.py, 9 of them fail; the rest check what must not change (a page the delivery never reads, a delivered answer, a response without a record).
  • gym env validate: valid for gdp_pdf.yaml with its judge config, benchmarks/gdp_pdf/config.yaml and benchmarks/gdp_pdf/opencode.yaml.
  • pre-commit run --files <changed files>: clean.

Earlier rounds:

Primary venv with the worktree on the path, Python 3.13, Pillow added from a scratch directory:

  • responses_api_agents/gdp_pdf_agent/tests: 66 passed, 16 skipped (the committed example manifests are fetched by prepare.py, not stored in git). The seven new session tests cover:
    • the document reaching the model, with images first;
    • images kept out of the observations, with the redaction gap;
    • a context-limit rejection backing off to 120 DPI within the activation;
    • a document that never fits ending as an unclassified empty answer after the text-only attempt;
    • a 500 staying a classified model_request_error;
    • three seed refusals: no context, a missing manifest, and a DPI mismatch.
  • With feat(agents): deliver per-task agent context to agent sessions #5703's app.py in place of this one, all seven new tests fail.
  • resources_servers/gdp_pdf/tests: 57 passed, 1 skipped.
  • pre-commit run --files <changed files>: passed.

At 7b2075f82 (#5703's updated branch and main 379ae226d merged, after a review round): gdp_pdf_agent + gdp_pdf tests: 146 passed, 32 skipped (example manifests are not committed); test_session_contract_repo.py + test_global_config.py: 233 passed; pre-commit run --files: clean. New tests: /run and a session send identical requests for all pages, with max_pages=1, and text-only; an empty-body 500 backs off once and then completes; malformed manifests are refused at seed; a page image path with .. or an absolute path is refused (at seed, and as a ValueError from run(), like the DPI mismatch, so run() now refuses such a manifest too). Removing any of those fixes makes a test fail.

At 14169aa29 (main 028348701 merged; only the imports conflicted with #5740): gdp_pdf_agent tests, tests/unit_tests/agents/test_raw_verify_typed_row.py, test_typed_agent_faults.py and test_agent_context.py: 100 passed, 14 skipped (example manifests are not committed); pre-commit run --files: clean.

At c2f4fad36 (#5703 at ccd50dc04 and main 099832fa7 merged, configs switched), on a Linux workstation with Python 3.13.14: gdp_pdf_agent and gdp_pdf tests, test_session_contract_repo.py, tests/unit_tests/config, test_environment_validation.py, test_add_legacy_agent_environment_servers.py, test_harness_conformance_ci.py, test_raw_verify_typed_row.py and test_typed_agent_faults.py: 749 passed. gym env validate on gdp_pdf.yaml with its judge config, and on benchmarks/gdp_pdf/config.yaml: valid. pre-commit run --files <changed files>: clean.

At a276b3afa (role-keyed rows; #5703 at 79b7c92c1 merged), on a Linux workstation with Python 3.13.14 and the example documents rendered: gdp_pdf_agent and gdp_pdf tests, single_agent_turn and single_agent_turn_legacy tests, and tests/unit_tests/server_runtime/test_agent_context.py: 508 passed, none skipped. test_row_shape now checks that single_agent_turn seeds the agent with the row's manifest. TestRepoDataMatchesSchemas: passed. pre-commit run --files <changed files>: clean.

At 7667fe90a: #5703 at 12eb72992 merged (main f636596db, documentation only); no conflicts.

Rollout evidence

Real-model smoke at 9e0e04285. A locally served Qwen2.5-0.5B-Instruct handled policy and rubric judging for one synthetic page with include_images: false. The environment's /run seeded, activated and closed an agent session, then called /verify. The question asked for an ID that appeared only in the document. The policy answered 7314, the judge scored the criterion 1, and the row had reward 1.0 and mask_sample: false. A preliminary run with a 256-token judge budget produced a masked judge_failed row. The successful run used 1,024 tokens. Image backoff and interrupted capture on this head were exercised by component tests.

Scripted-model smoke (no real model) at 8de9ca46a2. gym env start on the shipped gdp_pdf.yaml (agent sessions through single_agent_turn_legacy), with policy and judge served by openai_model in front of a local stub. The stub rejects every policy request for one row with a context-length error and answers the other; its judge passes every criterion. Then gym eval run --no-serve runs a fabricated two-page document as two rows.

Run Row Policy requests Reward mask_sample failure_kind failure_reason agent_adaptations.input_limit_rejections
mask_failed_attempts: false fits 1 (2 images) 1.0 false none none 0
mask_failed_attempts: false never fits 6 (150 to 72 DPI, then text only) 0.0 false none GDP.pdf terminal input limit: context 6
mask_failed_attempts: true fits 1 1.0 false none none 0
mask_failed_attempts: true never fits 6 0.0 true model_context_limit GDP.pdf terminal input limit: context 6
true, with the pre-fix app.py files never fits 6 0.0 false none none none (no document_delivery in the row)

Both runs were healthy, and no page images were left in the saved rows.

Scripted-model smoke (no real model). Real servers from gym env start (openai_model for policy and judge, both pointed at a local stub), then gym eval run --no-serve on one row: a fabricated two-page document, one rubric criterion, and agent_context. The stub rejects every request whose page images are as large as the first one with a context-length error, as an endpoint rejects the same request each time, and answers smaller ones. openai_model relays the upstream 400 as a 500, so Simple Agent retries it twice before the agent sees it. The row ran through a scratch config that puts single_agent_turn_legacy in front of the agent, and through the shipped legacy_agent relay.

Path Policy requests Delivery Judge calls Result
Agent session (single_agent_turn_legacy) 3 at 150 DPI rejected, 1 at 120 DPI answered image_dpi 120, input_limit_rejections 1, in response.metadata.document_delivery 1 no failure, no images in the row
Legacy /run (legacy_agent) 3 at 150 DPI rejected, 1 at 120 DPI answered image_dpi 120, input_limit_rejections 1, in the row's document_delivery 1 no failure, no images in the row

The rejected and the answered request each had the same SHA-256 on both paths. The reward of 1.0 is the stub judge's fixed score, not a result.

Real-model smoke (2026-11-09, at c2f4fad36). On a Linux workstation: the committed example documents fetched and rendered with prepare.py's fetch_example_media; gym env start with the shipped gdp_pdf.yaml, hosted nvidia/nemotron-3.5-super-vl-120b-a12b (through vllm_model, thinking off) as both policy and rubric judge, and model-call capture on; then gym eval run --no-serve on the example rows at temperature 0. Each row ran twice: through the shipped config, an agent session (/v1/agent_sessions on the agent, 3 times), and through a run config that puts the legacy_agent relay back (the agent's /run, 3 times, no sessions).

Task Page images + text block Policy request, session vs /run Input tokens Delivery Reward /run / session
9ef247ac 10 + 1 same SHA-256 32449 150 DPI, no rejection 0.25 / 0.25
55fe580d 4 + 1 same SHA-256 10254 150 DPI, no rejection 0.33 / 0.33
758bb8e1 5 + 1 same SHA-256 13926 150 DPI, no rejection 0.62 / 0.42
  • Both runs are healthy, with no failed or masked rows and no images in the saved rows. The delivery record is the row's document_delivery on /run and response.metadata.document_delivery in the session.
  • The hosted model is not deterministic at temperature 0 (output lengths differ between runs of the same request), so rewards are not expected to match; the evidence is the identical requests. On /run, one judge call for 758bb8e1 failed and Gym's collection re-judged it automatically.
  • No request hit a size limit, so the DPI backoff ran only in the scripted smoke above.
  • In an earlier pass with all five example rows, the provider's content screening rejected two documents (18 and 19 page images) with HTTP 422, from the same request on both paths. On /run the agent raised the typed model failure (main's fix(agents): keep the typed cause of a failed custom agent run #5740) and the collection stopped. In the session, the 422 stayed the classified model_request_error (it is not an input limit), and single_agent_turn's default outcome policy (400, 413 and 422 are verified) scored it 0. The table above leaves those rows out.

Real-model smoke with role-keyed rows (2026-11-09, at a276b3afa). The same setup and documents, now written as {"agent": {...}}, through the shipped config only (3 agent sessions).

Task Policy request vs the c2f4fad36 session run Input tokens Delivery Reward
9ef247ac same SHA-256 32449 150 DPI, no rejection 0.31
55fe580d same SHA-256 10254 150 DPI, no rejection 0.33
758bb8e1 same SHA-256 13926 150 DPI, no rejection none: judge rate-limited
  • The hosted judge answered HTTP 429 to most of the third document's rubric calls, so the row was masked as judge_failed and Gym's automatic re-judge kept waiting on the same limit; I stopped that pass. The policy side was complete: the request matched, the document went at 150 DPI, and the model answered.
  • No images in the saved rows.

🤖 Generated with Claude Code

yaoyu-33 and others added 4 commits November 5, 2026 14:23
An agent session gets its initial model input and its grants, but no task
data. Harnesses that build part of their input from the task row, such as
gdp_pdf_agent's document manifest, labbench2_vlm_agent's media directory
and CritPt's formatting prompt, had no supported way to receive it under
single_agent_turn.

A task row now carries that data in a reserved agent_context key: small
inline values (at most 64 KiB) and artifact references, paths relative to
a root the agent configures. SingleAgentTurnTaskInput lifts it out of
task_data, so the Resources Server never receives it, and single_agent_turn
passes it in AgentSeedSessionRequest.agent_context, omitted when empty.

Each agent declares the keys it reads in agent_context_model. The base
seed refuses with a terminal 422 a context the agent declares no model
for, an undeclared key, a missing required key or a mistyped value, so a
task never runs without data it was given. Agents read the typed context
with parse_agent_context() and resolve artifacts with
resolve_agent_context_artifact(), which refuses paths that leave the root.

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

A server's TaskData schema validates the task-owned fields of a row and reports unknown keys. agent_context goes to the agent session, never to the Resources Server, so it joins RESERVED_ROW_KEYS instead of showing up as an unknown task field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
gdp_pdf_agent builds the model input from the task's document manifest in
run(), with a reactive DPI, compositing and text-only backoff. Under an
agent session none of that ran, so the model answered the bare prompt
without the document.

The agent now declares its agent_context: artifacts.document_manifest,
required. It resolves the manifest under documents_base_dir when the
session is seeded, also when a checkpoint restore rebuilds the session,
and refuses a missing manifest or one rendered at another DPI with a
terminal 422. The activation builds the same request as run(), through a
shared _document_request, and backs off within its one activation. In a
session Simple Agent returns a model HTTP error as a failed response
instead of raising, so the backoff reads the input limit from that
response.

A document that never fits returns the empty failed response run()
scores as a zero attempt, without an outcome, so the Environment Server
verifies it. Other model errors stay the classified model_request_error
failure, for the Environment Server's outcome policy. The delivery record
goes into the response's document_delivery metadata, and images are
removed from the session's trajectory and observations.

prepare.py writes agent_context into every row, and the committed example
rows carry it. The legacy /run path sends the same requests as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@yaoyu-33 yaoyu-33 added feature New capabilities, enhancements, or enablement work 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 1ec247a

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

yaoyu-33 and others added 3 commits November 5, 2026 14:48
…tate

An agent whose task context lives in its session state, such as a
document or media to put in the model request, had to override
responses() to reach that state from the episode it creates. Environment
validation then infers custom-gym-agent-loop for it, though the agent loop
is still Simple Agent's.

responses() now creates a session activation's episode through
_create_session_episode(state, body, **kwargs), which by default calls
_create_episode. A subclass overrides it to use the session's context and
leaves responses() and the agent loop alone. The sessionless path is
unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…s episode, not responses()

Overriding responses() made environment validation infer the
custom-gym-agent-loop profile, though the agent loop is still Simple
Agent's and the manifest declares custom-gym-verifier. The delivery and
backoff now run in _create_session_episode, which gets the session state
directly, so the responses() override and its context variable are gone.

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

yaoyu-33 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 272f391

yaoyu-33 and others added 8 commits November 6, 2026 11:14
…erifier

- Refuse an artifact path with a NUL byte at validation, and turn a path the filesystem cannot look up (name
  too long, no permission) into a 422 seed refusal instead of a 500; other OS errors stay retryable.
- Count the 64 KiB values limit in UTF-8 bytes, not ASCII-escaped JSON.
- Treat an empty agent_context as none in the task input and the seed, so the seed and task digest match a row
  without the key and an agent server that predates the key still accepts the seed.
- Skip a task_data container's agent_context in dataset validation, as the task input lifts it out.
- single_agent_turn_legacy: answer a row that fails the episode request model with the typed /run's 422.
- Re-verification no longer sends a stored agent_context to the Resources Server's /verify.
- Docs and helper docstring: a Simple Agent subclass resolves context in _new_session_state (restores rebuild
  through it) and overrides _create_session_episode, never responses(); configure the real directory as the
  root; files under a directory artifact are the agent's to confine.

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

- Seed: a manifest that cannot be read or parsed is a final 422 refusal, not a 500 that is retried.
- A manifest's page images must resolve inside the manifest's directory, on /run and in sessions, so a
  manifest cannot send other files on the host to the model.
- Session backoff: an empty-body 5xx is still backed off as a payload limit, but if it persists through
  text only, the activation returns Simple Agent's classified model_request_error for the outcome policy
  instead of an unclassified failure scored 0; Gym's model server relays such an empty body.
- Tests: /run and a session send the same model requests (all pages, max_pages, text only); empty-body 500
  backoff and persistence; malformed manifests; page image confinement.
- README: the session refusals, and pointing documents_base_dir at the real directory behind a symlink.

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 7b2075f

yaoyu-33 and others added 2 commits November 13, 2026 15:29
Signed-off-by: yaoyu-33 <[email protected]>

# Conflicts:
#	environment_servers/single_agent_turn_legacy/tests/test_app.py
#	environment_servers/swe_together/tests/test_environment.py
#	nemo_gym/agents/base_responses_api_agent.py
#	pyproject.toml
#	responses_api_agents/gdp_pdf_agent/README.md
#	responses_api_agents/gdp_pdf_agent/app.py
#	responses_api_agents/gdp_pdf_agent/tests/test_app.py
#	responses_api_agents/simple_agent/tests/test_app.py
#	tests/unit_tests/server_runtime/test_agent_context.py
…attempts

- prepare.py writes agent_context only for rows with a rendered manifest. Rows from
  prepare_opencode.py (render_documents=False) carried an empty manifest path, so every
  OpenCode GDP.pdf session was refused with 422; its agent takes no agent context anyway.
- is_prepared_data_current re-prepares a cached gdp_pdf file whose rows lack agent_context.
- In a session, a document that never fits marks its delivery record when
  mask_failed_attempts is on, and gdp_pdf verify() applies the mark as run() does
  (mask_sample, failure_kind, instance_config.mask_sample). verify() also copies the
  record to the row's document_delivery, agent_adaptations, failure_reason and
  pages_truncated, so session rows match /run rows.
- The seed refuses a manifest page whose text or page image the delivery would read is
  missing. A storage error reading the manifest (EIO, ESTALE) now fails the seed as a
  retryable error instead of a terminal 422; path errors still refuse it.
- README, docstring and field description updates for the session path.

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 8de9ca4

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the needs-review PR is ready for code review and waiting on a reviewer label Nov 16, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the risk:high Autobot PR risk: high label Dec 1, 2026
@weijiac0619

Copy link
Copy Markdown
Contributor

do we want to keep *_legacy_agent.yaml for this benchmark?

@weijiac0619

Copy link
Copy Markdown
Contributor

could you provide before/after reward comparison in the description

@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA label Dec 1, 2026
@yaoyu-33

yaoyu-33 commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Agreed on keeping a single GDP.pdf preset. I checked the benchmark and component configs at 9e0e04285: there is no GDP.pdf *_legacy_agent.yaml to remove. The shipped single_agent_turn_legacy entry is the environment adapter for existing flat dataset rows. It seeds, activates and closes the new agent session. I clarified the preset choice in the PR description.

Benchmark config · Flat-row adapter

@yaoyu-33

yaoyu-33 commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Added the per-task before/after reward table near the top of the description. Over three matched examples the mean was 0.4332 on base and 0.2447 on the session head. All six rows were graded, all three policy request hashes matched, and both verifiers reproduced the same 96 criterion scores with the saved answers and judge replies. The largest observed difference was the four-page construction example, where the two policy answers named different worst subcontractors.

@weijiac0619

Copy link
Copy Markdown
Contributor

/ok to test 9e0e042

@nemo-pr-automation
nemo-pr-automation Bot requested review from a team December 2, 2026 04:58

This branch was previously deployed

1 inactive (outdated) deployment
public — 7667fe90 Deployed Nov 10, 2026 by copy-pr-bot[bot] via release / finalize / notify #11309
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants