Skip to content

fix(server): XLSX files whose workbook is not xl/workbook.xml reach the agent - #41598

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/server-xlsx-custom-workbook-root
Nov 23, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/server-xlsx-custom-workbook-root

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

When an XLSX attachment keeps its workbook somewhere other than xl/workbook.xml, the agent gets none of its cells. The output is only [Skipped document part: xl/workbook.xml (missing or invalid XML).] and the same note for xl/_rels/workbook.xml.rels. An Office package names its main part in _rels/.rels (the officeDocument relationship), so a file whose workbook is docs/book.xml is valid. The server's text extractor already followed that relationship for Word files (#40777), but for spreadsheets it still read the fixed xl/ paths. It also resolved styles, shared strings and sheets under xl/ instead of the workbook's own folder.

Change

In documentTextWorker.ts, the Word lookup of the main part becomes one small helper that Word and XLSX both use, with xl/workbook.xml still the fallback. The extractor now reads the workbook's relationships from <folder>/_rels/<name>.rels and resolves its sheet, shared-strings and styles targets from the workbook's folder. Ordinary xl/... files resolve to exactly the same paths as before. One case is added to the XLSX table in userInputAttachments.test.ts.

Scope

This is a small bug fix with no issue. PowerPoint files have the same fixed ppt/presentation.xml path. That is a separate problem, so it is left for its own PR.

Verification

An AI agent ran each check on Linux with no accounts.

Setup: Linux x86_64, Node 26.13.1, and a synthetic XLSX whose _rels/.rels points at docs/book.xml. Its relationships, shared strings, styles (a custom 0.0% format) and sheet are all under docs/, and there is no xl/ folder.
Steps: node apps/server/src/bin.ts __document-text custom-workbook-root.xlsx .xlsx (the same worker entrypoint the server starts for attachments)

6aad800ecfe2 (main) 1069565dbd1f (this PR)
[Skipped document part: xl/workbook.xml (missing or invalid XML).]
[Skipped document part: xl/_rels/workbook.xml.rels (missing or invalid XML).]
## Sheet: Data
hello 0.25 [Excel numFmtId=164; format=0.0%; date system 1900]
  • A workbook at the package root (/book.xml, relationships in _rels/book.xml.rels) also extracts its sheet on this PR.
  • vp test run apps/server/src/provider/userInputAttachments.test.ts: the new case fails on main (the output is only the skip notes) and passes with this change (53/53).
  • vp run check:changed: passes.

Generated with Gemini 4 Neon in T3 Code Nightly

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 23, 2026
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1069565 and 81f9263.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The document text worker now uses the OPC officeDocument relationship to locate the main part for DOCX and XLSX. XLSX related parts resolve relative to the workbook directory. A test covers a workbook with parts under docs/.

Changes: OPC part resolution

Layer / File(s) Summary
Resolve workbook and related parts
apps/server/src/provider/documentTextWorker.ts, apps/server/src/provider/userInputAttachments.test.ts
The worker uses the officeDocument relationship to locate the main part, with word/document.xml as the DOCX fallback. XLSX workbook relationships and worksheet targets resolve relative to the workbook directory. The added test checks extraction of a workbook with parts under docs/, including its sheet name, shared string, and formatted date serial.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Suggested labels: bugfix

Suggested reviewers: lucenx9, marve10s, macroscopeapp

Merge Risk: Minimal · previous review 10695

This change lets spreadsheets whose workbook is not at the conventional path reach the agent with their cell content, while conventional layouts keep working. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: XLSX files whose workbook part is not xl/workbook.xml now reach the agent. The fix matches the PR objective and the description, and the title follows the conventional…
Description check Passed The description follows the template sections (Problem, Change, Scope, Verification). It explains the bug, the root cause (the extractor read fixed xl/ paths instead of following the officeDocument re…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: XLSX files whose workbook part is not xl/workbook.xml now reach the agent. The fix matches the PR objective and the description, and the title follows the conventional commit format. It is specific and does not include file lists or vague terms.

Full details: Description check

Explanation

The description follows the template sections (Problem, Change, Scope, Verification). It explains the bug, the root cause (the extractor read fixed xl/ paths instead of following the officeDocument relationship), and the fix. It states the scope and says PowerPoint is out of scope. Verification gives concrete commands, before/after results, and the environment. It also names the agent and model that did the work, as the template asks. The template's comment asks for a linked issue or a reason for no issue; the author gives a reason (small obvious bug fix) and cites #40777 as prior art. The check passes because the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a369642 and 1069565.

Files selected for processing: 2

  • apps/server/src/provider/documentTextWorker.ts
  • apps/server/src/provider/userInputAttachments.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 23, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Environment: Linux, Chromium, 1280×800, light theme; fresh isolated database per commit.

Attach custom-workbook-root.xlsx (officeDocument targets docs/book.xml; no xl/ folder) and an identical standard-xl control. Request extracted text only. A deterministic ACP agent reads and quotes the server-supplied sidecars without opening the XLSX archives.

Proven: scenarios:prove exited 0. Base reproduced the two missing-xl skip notes; head supplied Data, hello, quarterly-growth, 0.25, 0.125, and numFmtId=164 / format=0.0%, matching the control.

Before After
da7d298fae 81f92638cd
Before: custom workbook has missing-part notes After: custom workbook supplies extracted cells and formats
Before recording After recording

Scenario, fixture generator, and deterministic reader

Not shown:

  • The original Codex GPT-6-Luna natural-language interpretation was not exercised; a deterministic ACP agent quoted the actual extracted sidecars on both commits.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 23, 2026
@juliusmarminge
juliusmarminge merged commit 592e4d3 into pingdotgg:main Nov 23, 2026
55 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants