Repository navigation
fix(stirrup_agent): libreoffice whitespace + reference_files double-nest - #1333
Merged
bxyu-nvidia merged 1 commit intoMay 15, 2026
Merged
Conversation
Two related GDPVal bugs that bias comparison-mode scoring. ## LibreOffice fails on filenames with whitespace `convert_to_pdf` in `resources_servers/gdpval/preconvert.py` (and the sibling `_convert_office_to_pdf` in `responses_api_agents/stirrup_agent/file_reader.py`) passed `str(input_path)` straight to `libreoffice --convert-to pdf`. The GDPVal HF corpus includes filenames like `Population v2.xlsx`; libreoffice's batch-convert URI handling drops these on the floor (`source file could not be loaded`, rc=0), so every Office doc with a space in its name silently reaches the multimodal judge as a filename-only stub. Fix: extend the existing ns0-staging path to also stage when the name contains whitespace — copy to a tempdir with a sanitized basename, run libreoffice there, move the resulting PDF back to the original location. ## Double `reference_files/reference_files/` nesting `_download_reference_files` materializes each row's reference files at `input_files_dir/<file_path>`, and every GDPVal row has `file_path` prefixed with `reference_files/` (matching the HF dataset layout). The persistence step then did `shutil.copytree(input_files_dir, task_dir / "reference_files")`, so artifacts ended up at `task_dir/reference_files/reference_files/<hash>/<file>` — double nested. This wasn't just cosmetic: `comparison.py`'s `build_file_section` reads `<ref_dir>/reference_files/` with `os.listdir` (no recursion), so it saw only the inner `reference_files/` subdir and **zero actual reference files**, biasing every pairwise judgment against whichever side actually had references. Fix: when `input_files_dir` already carries a top-level `reference_files/` subdir, merge contents straight into `task_dir` so the persisted layout is `task_dir/reference_files/<hash>/<file>`. Fall back to the previous wrapping behavior when the prefix isn't present (non-GDPVal datasets). ## Test plan - [x] `pytest resources_servers/gdpval/tests/ responses_api_agents/stirrup_agent/tests/` → 127/127 pass - [x] New `test_stages_when_path_has_whitespace` reproduces the `Population v2.xlsx` failure mode and asserts the staged input has no whitespace + the PDF lands at the original path - [x] `ruff check` + `ruff format --check` clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Alex Gronskiy <[email protected]>
bxyu-nvidia
approved these changes
May 15, 2026
bxyu-nvidia
deleted the
fix/stirrup-libreoffice-whitespace-and-double-refs
branch
May 15, 2026 15:49
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related GDPVal bugs that bias comparison-mode scoring.
1. LibreOffice preconvert silently drops files with whitespace in the filename
convert_to_pdfinresources_servers/gdpval/preconvert.py(and the sibling_convert_office_to_pdfinresponses_api_agents/stirrup_agent/file_reader.py) passesstr(input_path)straight tolibreoffice --convert-to pdf. The GDPVal HF corpus includes filenames likePopulation v2.xlsx; libreoffice's batch-convert URI handling drops these on the floor (source file could not be loaded, rc=0), so every Office doc with a space in its name silently reaches the multimodal judge as a filename-only stub — same failure mode as the missing-JRE case fixed in #1268, but driven by the path instead of the runtime.Fix: generalize the existing ns0-staging path to also stage when the name contains whitespace. Copy to a tempdir with a sanitized basename, run libreoffice there, move the resulting PDF back to the caller's expected location.
2. Persisted reference files are double-nested as
reference_files/reference_files/_download_reference_filesmaterializes each row's reference files atinput_files_dir/<file_path>, and every GDPVal row hasfile_pathprefixed withreference_files/(matching the HF dataset's directory layout). The persistence step inapp.pythen didshutil.copytree(input_files_dir, task_dir / "reference_files"), so artifacts ended up attask_dir/reference_files/reference_files/<hash>/<file>— double nested.This is not just cosmetic:
comparison.py'sbuild_file_sectionlists<ref_dir>/reference_files/withos.listdir(no recursion), so it saw only the innerreference_files/subdir and zero actual reference files, biasing every pairwise judgment against whichever side actually had references.Evidence:
/lustre/.../ultra-v3/moonshotai/Kimi-K2.6/20260509_231553-df9e2fbb2daff866/nemo_gym.0— every task directory hasreference_files/reference_files/....Fix: when
input_files_diralready carries a top-levelreference_files/subdir (the HF GDPVal layout), merge contents straight intotask_dirso the persisted layout is the expected single-leveltask_dir/reference_files/<hash>/<file>. Fall back to the previous wrapping behavior when the prefix isn't present (non-GDPVal datasets).Test plan
pytest resources_servers/gdpval/tests/ responses_api_agents/stirrup_agent/tests/→ 127/127 passtest_stages_when_path_has_whitespaceuses aPopulation v2.xlsxfixture, asserts the staged input has no whitespace, and verifies the PDF ends up at the original pathruff check+ruff format --checkclean🤖 Generated with Claude Code