Skip to content

fix(gui_coordinate): keep per-row metadata in the verify response - #4554

Merged
yaoyu-33 merged 1 commit into
mainfrom
qiaochuz/nvb-6783212-gui-coordinate-verify-metadata
Oct 13, 2026
Merged

yaoyu-33 merged 1 commit into
mainfrom
qiaochuz/nvb-6783212-gui-coordinate-verify-metadata

Conversation

@qiaochuz-nv

Copy link
Copy Markdown
Contributor

What does this PR do?

gui_coordinate rollouts now keep each row's metadata, as the server's README says (metadata "is passed through and is not used for scoring"). Before this PR, gym eval run saved rollout rows without it, even though every materialized input row had it. Scoring is unchanged.

Fixes NVBug 6783212.
Closes #4495.

Cause

GuiCoordinateRunRequest declares metadata (resources_servers/gui_coordinate/app.py:39), but GuiCoordinateVerifyResponse did not. verify() builds its response from **body.model_dump(...), so metadata arrived as a keyword the response model didn't declare. BaseVerifyResponse keeps pydantic's default extra="ignore", so the field was dropped. The simple agent returns the /verify JSON as the rollout row, so the saved row had no metadata. The server has done this since it was added in #2332; the README line came later in #2377. The committed data/example_rollouts.jsonl from #2332 shows it too: all 5 input rows have metadata, and none of the 5 rollout rows do.

Fix

Declare metadata: Optional[dict[str, Any]] = None on GuiCoordinateVerifyResponse. verify() already passes the request's value in, so nothing else changes. Downstream, the simple agent and image_tools_agent both validate the /verify JSON with extra="allow", and rollout collection writes the /run result as the row, so the field reaches rollouts.jsonl.

Alternatives not taken:

  • Make the response inherit GuiCoordinateVerifyRequest, as 16 servers do. That would also echo max_dist, which the README doesn't promise. Declaring only the documented field keeps the diff to what the README says.
  • Change the README to say metadata is kept only in *_materialized_inputs.jsonl. Nothing in the gui_coordinate PRs or docs narrows "passed through" that way, and the QA case reads the README as promising it in saved output.

Not changed: data/example_rollouts.jsonl. It is model output from #2332 and still lacks metadata; regenerating it needs a GPU run of the example and would replace all five model outputs.

Test: test_verify_passes_metadata_through calls verify() with a metadata-bearing request and checks that the serialized response carries the same dict, and that the reward is unchanged.

Before the fix

Gym 91d8c6c9f (main), with this PR's test file, from resources_servers/gui_coordinate:

python -m pytest tests -q -rf --tb=short
tests/test_app.py::TestApp::test_verify_passes_metadata_through FAILED   [100%]
tests/test_app.py:117: in test_verify_passes_metadata_through
    assert result["metadata"] == metadata
E   KeyError: 'metadata'
FAILED tests/test_app.py::TestApp::test_verify_passes_metadata_through - KeyE...
=================== 1 failed, 12 passed, 1 warning in 3.23s ====================

End to end, the NVBug's QA case runs the README flow (gym env start + gym eval run --no-serve --agent gui_coordinate_simple_agent) on 5 independent GUI screenshots with Qwen/Qwen3-VL-8B-Instruct on one H100. Its scoring and /verify control checks pass; it fails only on saved-output metadata:

FAIL   167.2s  five independent GUI screenshots follow documented coordinate scoring and preserve output metadata
  - documented metadata pass-through: saved CLI rollout 0
saved rollout rows with metadata: 0/5
row keys: _ng_environment_server, _ng_result_type, _ng_rollout_index, _ng_task_index, agent_ref, distance,
  expected_answer, extracted_x, extracted_y, failure_kind, failure_reason, mask_sample, response,
  responses_create_params, reward

After the fix

Gym 40767fa54 (this branch), same command:

tests/test_app.py::TestApp::test_verify_passes_metadata_through PASSED   [100%]
======================== 13 passed, 1 warning in 2.85s =========================

Same QA case, same model and inputs:

PASS   162.3s  five independent GUI screenshots follow documented coordinate scoring and preserve output metadata
saved rollout rows with metadata: 5/5, each equal to its input row's metadata
e.g. {"fixture_id": "button", "target_label": "Create report", "source": "independent gui_coordinate GUI fixtures"}

Validation

  • pytest in resources_servers/gui_coordinate: before 1 failed / 12 passed; after 13 passed.
  • gym env test --resources-server gui_coordinate (server venv): 13 passed.
  • tests/unit_tests/test_task_data.py::TestSchemaPresence and tests/unit_tests/test_ray_opt_out.py: 21 passed.
  • pre-commit run --all-files: passed, no changes.
  • QA testcase gui_coordinate (5 independent GUI screenshots, Qwen/Qwen3-VL-8B-Instruct on one H100): before 0/1 (fails on documented metadata pass-through), after 1/1. The rows went through gui_coordinate_environment_server (legacy_agent), so the relay path is covered.
  • Rollout evidence: the QA run above is a real 5-row rollout with the README commands; all 5 saved rows carry their input's metadata. Model rewards were 0.0 on both commits: Qwen3-VL-8B answered in an attribute form (<point x1="862" y1="207" ...>) that the documented <point>(x, y)</point> parser does not match. That is unchanged by this PR. The case's 17 direct /verify controls still score 1.0, 0.25 and 0.0 where expected, and each control response now includes metadata.

Compatibility

Rollout rows from gui_coordinate gain a top-level metadata key: the row's dict, or null when the input row has none. Rewards, metrics, and other fields are unchanged.

🤖 Generated with Claude Code

The README says per-row `metadata` is passed through, and the request
model accepts it, but GuiCoordinateVerifyResponse did not declare it.
pydantic's default extra="ignore" dropped it, so saved rollout rows
from `gym eval run` never had it. Declare the field; verify() already
passes it in from the request.

Fixes NVBug 6783212.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: qiaochuz <[email protected]>
@qiaochuz-nv qiaochuz-nv added bug Something isn't working QA_fix Fix implemented by a QA team member area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers needs-review PR is ready for code review and waiting on a reviewer complexity:low Localized change in one scope with a small, straightforward review surface labels Oct 13, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 13, 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 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.

LGTM. Metadata is preserved through verification and response validation without changing rewards. Focused tests and metadata boundary checks passed.

@yaoyu-33
yaoyu-33 enabled auto-merge October 13, 2026 02:27
@qiaochuz-nv

Copy link
Copy Markdown
Contributor Author

/ok to test 40767fa

@yaoyu-33

Copy link
Copy Markdown
Contributor

/ok to test 40767fa

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/38339683338

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/38340492158

Merged via the queue into main with commit f31eeb4 Oct 13, 2026
53 of 55 checks passed
@yaoyu-33
yaoyu-33 deleted the qiaochuz/nvb-6783212-gui-coordinate-verify-metadata branch October 13, 2026 03:25

This branch was previously deployed

1 inactive deployment
public — 40767fa5 Deployed Oct 13, 2026 by copy-pr-bot[bot] via release / finalize / notify #5136
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers bug Something isn't working complexity:low Localized change in one scope with a small, straightforward review surface needs-review PR is ready for code review and waiting on a reviewer QA_fix Fix implemented by a QA team member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NVBug 6783212] Declare metadata on GuiCoordinateVerifyResponse so it survives eval

2 participants