Skip to content

Python: fix(lab-gaia): accept local parquet data in _ensure_data - #9340

Open
Manohar Paturi (ManoharPaturi) wants to merge 5 commits into
microsoft:mainfrom
ManoharPaturi:fix/gaia-parquet-ensure-data
Open

Manohar Paturi (ManoharPaturi) wants to merge 5 commits into
microsoft:mainfrom
ManoharPaturi:fix/gaia-parquet-ensure-data

Conversation

@ManoharPaturi

@ManoharPaturi Manohar Paturi (ManoharPaturi) commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Motivation & Context

_load_gaia_local prefers parquet files (the comment calls it the new format, validation split first) but GAIA._ensure_data only treated a data dir as ready when it contained metadata.jsonl. Pointing data_dir at a parquet-only mirror was ignored and the runner demanded HF_TOKEN for a fresh download even though the local data was fully usable. Issue #9337 has the repro.

Description & Review Guide

  • What are the major changes? _ensure_data now also accepts metadata*.parquet in its existence check, matching the glob the loader itself uses.
  • What is the impact of these changes? Parquet-only data dirs run offline. Jsonl dirs and the download path are untouched.
  • What do you want reviewers to focus on? The one-line condition plus the new test that builds a parquet-only dir and asserts no download is attempted.

Related Issue

Fixes #9337

AI Assistance

  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

_ensure_data only recognized the old metadata.jsonl layout, so a data
dir holding only the parquet files the loader itself prefers was
ignored and the runner demanded HF_TOKEN for a fresh download.

Accept metadata*.parquet in the same existence check.

Fixes microsoft#9337

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@agent-framework-automation agent-framework-automation Bot added python Usage: [Issues, PRs], Target: Python lab Usage: [Issues, PRs], Target: lab packages labels Oct 13, 2026
@eavanvalkenburg

Copy link
Copy Markdown
Member

/review

@github-actions github-actions Bot 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.

MAF Automated Review — Iteration 1

Result: Findings reported
Scope: full PR (2 commit(s)): ddd62b7f05d2, a367690bddab
Model: gpt-5.6-sol

Overview

The change aligns _ensure_data with the parquet glob already used by the loader and adds a real parquet fixture that protects the intended offline path. Existing JSONL handling, dependency packaging, and downstream empty-task failure behavior remain intact. However, filename presence alone also treats an incomplete sharded parquet snapshot as ready, allowing a benchmark to run over a silently truncated task set.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.

Affected areas: python/packages/lab/gaia/agent_framework_lab_gaia/gaia.py

"""Ensure GAIA data is available locally."""
if self.data_dir.exists() and any(self.data_dir.rglob("metadata.jsonl")):
if self.data_dir.exists() and (
any(self.data_dir.rglob("metadata.jsonl")) or any(self.data_dir.rglob("metadata*.parquet"))

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.

This treats the first matching shard as a complete dataset, so an interrupted copy containing only metadata-00000-of-00002.parquet now bypasses snapshot_download. The loader can then read that shard and run a successful-looking benchmark over an incomplete task set. When filenames use the ...-of-N convention, please require all N shards before considering local data ready, while continuing to accept complete parquet-only directories.

…ing local data

A partial metadata-XXXXX-of-NNNNN family from an interrupted copy would
have counted as ready and run the benchmark over a truncated task set.
Group shards by directory and prefix and only treat the snapshot as
complete when each group holds all its declared shards.

Follow-up to the review on microsoft#9340.

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
@ManoharPaturi

Copy link
Copy Markdown
Contributor Author

Fair point, pushed the follow-up: _ensure_data now groups metadata-XXXXX-of-NNNNN files by directory and prefix and only treats the snapshot as ready when every group holds all its declared shards. A partial family forces the normal download path again, and the test covers both halves of that.

@eavanvalkenburg

Copy link
Copy Markdown
Member

/review

@github-actions github-actions Bot 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.

MAF Automated Review — Iteration 2

Result: No findings
Scope: 2 net-new commit(s): 47891ef94bfe, d172e602bca8
Model: gpt-5.6-sol

Overview

The incremental patch replaces the broad parquet-existence check with grouped shard counting and directly tests the previously reported 00000-of-00002 interruption case. Grouping by parent and prefix prevents shards from separate splits from satisfying one another, and empty parquet directories still fall through to the existing download path. Residual malformed-index and mixed-layout cases remain facets of the already unresolved shard-completeness thread rather than new publishable findings in this iteration.

Reviewed the supplied incremental change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manohar Paturi (@ManoharPaturi) Two issues remain on the current head:

  • python/packages/lab/gaia/agent_framework_lab_gaia/gaia.py:282: _has_complete_parquet_snapshot() returns True as soon as it sees any unsharded metadata*.parquet. If that directory also contains an incomplete sharded family, validation stops early even though _load_gaia_local() later reads all matching parquet files, so a mixed/incomplete task set can be accepted. Please continue scanning and require every sharded family present to be complete before treating the directory as ready.
  • python/packages/lab/gaia/tests/test_gaia.py:85: test_incomplete_sharded_parquet_snapshot_forces_download assumes HF_TOKEN is absent. In a developer or CI environment where it is set, the test can perform a real snapshot_download instead of asserting the intended branch. Please clear the environment variable with monkeypatch.delenv("HF_TOKEN", raising=False) or mock the download path so the test is hermetic.

An unsharded metadata parquet made the completeness check return early,
so a directory mixing a plain file with an incomplete sharded family
was treated as ready. Keep scanning after unsharded files and let any
incomplete family disqualify the directory. Also clear HF_TOKEN in the
incomplete snapshot test so it cannot attempt a real download.

Follow-up to the review on microsoft#9340.

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
@ManoharPaturi

Copy link
Copy Markdown
Contributor Author

a16b33d: the completeness scan no longer returns on the first unsharded file, it records it and keeps scanning, and any incomplete sharded family now disqualifies the directory even when unsharded files sit beside it. Added a mixed case test (incomplete family plus a plain metadata-extra.parquet still forces the download path). The incomplete snapshot test also clears HF_TOKEN with monkeypatch now, so it stays hermetic.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manohar Paturi (@ManoharPaturi) _ensure_data() still returns successfully whenever any metadata.jsonl exists, without checking an incomplete metadata*.parquet shard family in the same directory. _load_gaia_local() prefers parquet and falls back to JSONL only when no parquet tasks load, so one valid partial shard can still produce a silently truncated benchmark run. Please require a complete parquet snapshot whenever any parquet files are present, or explicitly ignore incomplete parquet and deliberately fall back to JSONL, with a mixed-layout regression.

This branch was successfully deployed

1 active deployment
github-app-auth — a16b33d1 Deployed Oct 15, 2026 by ManoharPaturi via add_label #25435
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lab Usage: [Issues, PRs], Target: lab packages python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Bug]: GAIA runner refuses local parquet data and asks for HF_TOKEN

3 participants