You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(server): ODT attachments no longer repeat index titles or template separators - #40523
When an OpenDocument text file with an index is attached, the agent reads the index's source as if it were content. For LibreOffice's Tabs-in-TOC.odt test document the extracted text has Table of ContentsTable of Contents. For BibliographyEntryField.odt the bibliography is preceded by Bibliography: , , : , , : , , ….
ODF stores an index in two parts: the source it is generated from (text:table-of-content-source and its siblings), then the generated body (text:index-body). The source holds a title template and entry templates whose fixed separator strings are character data. The attachment text extractor walks into the source and emits that text before the real title. ODF 1.3 part 3 §8.2.1 says the source "contains the information necessary to generate the index content"; the body holds the content.
Change
The seven index source elements (table of contents, illustration, table, object, user, alphabetical, bibliography) join the extractor's HIDDEN set, which already holds other non-content OpenDocument elements. That is the complete set in ODF 1.3. The generated body, with the title and the entries, is extracted as before.
Limits:
An index with a source and no generated body now contributes nothing, where main emitted the bare template title. pandoc's ODT template writes its table of contents that way. textutil also prints nothing for it. No document I compared has such an index.
A document whose only text is such a template now fails with "No text extracted".
If a template title differs from the generated title, only the generated one remains (one corpus file).
Scope
A fix for one extraction bug, so there is no separate issue. Server only. #40509 fixes the same defect in the web Files preview reader, which is separate code; neither depends on the other. I searched open and closed PRs and issues for ODT indexes, tables of contents and bibliographies and found nothing else covering this. Open PR #38542 edits the same file in different places.
Verification
I found this by running the extractor and textutil -convert txt over LibreOffice's ODT test documents and looking at files where the extractor returned text that textutil did not.
Before and after,node src/bin.ts __document-text <file> .odt, last lines of each:
Tabs-in-TOC.odt
main : c
Table of ContentsTable of Contents
Hello world 1
fix : c
Table of Contents
Hello world 1
textutil: c
Table of Contents
Hello world 1
BibliographyEntryField.odt
main : [ABC]
Bibliography: , , : , , : , , : , , … Bibliography
ABC: Author1, Title1, 2017
fix : [ABC]
Bibliography
ABC: Author1, Title1, 2017
textutil: [ABC]
Bibliography
ABC: Author1, Title1, 2017
Real documents: ran main's extractor and this one over 5,074 LibreOffice test files: 1,157 odt, 2,172 docx, 649 ods, 396 xlsx, 457 pptx, 243 odp.
45 outputs change, all odt. In each, the characters removed are exactly the text of the index sources. Nothing is added, and the same 666 files fail on both.
The seven element names occur only in ODT content.xml, never in the other formats.
Of the 56 title templates in those 45 files, 52 now appear as often as in textutil's output. The other four: two in one file whose indexes sit in a footnote, which textutil omits; one in a text box, where textutil itself prints the title twice; and one template that differs from its generated title, as noted above.
Test: the existing ODT case now includes all seven index kinds. On main it yields Contents: Contents where Contents is expected, and it passes here. vp test run src/provider/userInputAttachments.test.ts passes 45/45.
vp run check:changed passes: format, lint, knip, graphql, typecheck of 3 packages, and tests.
Not checked: ODT files exported by Word, Google Docs or Pages, and a real agent turn with such an attachment.
Written by Claude Fable 5.2 in Claude Code, run from T3 Code.
…e separators
An OpenDocument index (table of contents, bibliography, table of figures
and the other four kinds) is stored as two parts: the source it is
generated from, then the generated body. The attachment text extractor
emitted the text of both, so the agent read a LibreOffice table of
contents as "Table of ContentsTable of Contents" and a bibliography
after a run of the separators from its entry templates (": , , : , ,").
The seven index source elements are now skipped; the index body, which
holds the title and the entries, is extracted as before.
Claude Fable 5.2 in Claude Code, running in T3 Code.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Reviewing files that changed from the base of the PR and between cd20593 and eb642d3.
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 server attachment extractor now includes text from seven OpenDocument index source element types. The ODT extraction test covers their titles and entries.
Changes: ODT index text extraction
Layer / File(s)
Summary
Include index source text apps/server/src/provider/documentTextWorker.ts, apps/server/src/provider/userInputAttachments.test.ts
The hidden-element set excludes seven OpenDocument index source element types. The ODT test checks that each element’s title and entry appear in the extracted text.
pingdotgg/t3code#40509: Updates the web ODF HTML preview to skip the same index-source elements. This pull request applies the change to the server attachment extractor.
ODT attachments will no longer repeat index titles or template separators in extracted text, while generated index content is still extracted. No actionable merge-blocking risk was found. A document consisting only of an index template with no generated body can now fail with "No text extracted", which is a documented and accepted limitation.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: ODT attachment extraction no longer repeats index titles or template separators. It matches the raw summary, which adds seven ODF index-source elements to the HIDDEN s…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description follows the template closely. It has the Problem, Change, Scope, and Verification sections, plus the agent-model line. The Problem section names the defect, the affected documents, and…
Full details: Title check
Explanation
The title names the main change: ODT attachment extraction no longer repeats index titles or template separators. It matches the raw summary, which adds seven ODF index-source elements to the HIDDEN set, and the test change. The title is 81 characters, slightly long but still a single clear sentence, and it follows the conventional commit form the template asks for.
Full details: Description check
Explanation
The description follows the template closely. It has the Problem, Change, Scope, and Verification sections, plus the agent-model line. The Problem section names the defect, the affected documents, and the ODF structure behind it. The Change section lists the seven index-source elements added to HIDDEN and states the limits of the fix. The Scope section explains why no issue is linked and names a related PR. The Verification section gives before-and-after extractor output, a corpus comparison over 5,074 files, the test result, and what was not checked. The template asks for a conventional commit title in the PR title, but the title is not part of the description body, so it is not assessed here. The description is thorough and specific, and the only gap is that it does not link an issue. The template allows a small obvious fix to skip an issue if the author says why, and the author does give that reason.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
Uploaded the same two LibreOffice ODT documents through the real composer on fresh databases, then inspected the server-created attachment text. Chromium, 1280×800, light theme on both sides. The labeled inspector is a capture aid displaying those artifacts, not the separate Files preview reader. No turn was sent with the attachments.
Scenario source. scenarios:prove exited 0: failed on base with title count 2 instead of 1; passed on head.
Not shown:
Other index-source kinds and source-only indexes were outside the supplied two-document reproduction.
A real provider consuming the attachment was not exercised; evidence reads the exact text artifacts produced at upload, matching the triage reproduction.
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
size:XS0-9 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
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.
Problem
When an OpenDocument text file with an index is attached, the agent reads the index's source as if it were content. For LibreOffice's Tabs-in-TOC.odt test document the extracted text has
Table of ContentsTable of Contents. For BibliographyEntryField.odt the bibliography is preceded byBibliography: , , : , , : , , ….ODF stores an index in two parts: the source it is generated from (
text:table-of-content-sourceand its siblings), then the generated body (text:index-body). The source holds a title template and entry templates whose fixed separator strings are character data. The attachment text extractor walks into the source and emits that text before the real title. ODF 1.3 part 3 §8.2.1 says the source "contains the information necessary to generate the index content"; the body holds the content.Change
The seven index source elements (table of contents, illustration, table, object, user, alphabetical, bibliography) join the extractor's
HIDDENset, which already holds other non-content OpenDocument elements. That is the complete set in ODF 1.3. The generated body, with the title and the entries, is extracted as before.Limits:
mainemitted the bare template title. pandoc's ODT template writes its table of contents that way.textutilalso prints nothing for it. No document I compared has such an index.Scope
A fix for one extraction bug, so there is no separate issue. Server only. #40509 fixes the same defect in the web Files preview reader, which is separate code; neither depends on the other. I searched open and closed PRs and issues for ODT indexes, tables of contents and bibliographies and found nothing else covering this. Open PR #38542 edits the same file in different places.
Verification
I found this by running the extractor and
textutil -convert txtover LibreOffice's ODT test documents and looking at files where the extractor returned text thattextutildid not.node src/bin.ts __document-text <file> .odt, last lines of each:main's extractor and this one over 5,074 LibreOffice test files: 1,157 odt, 2,172 docx, 649 ods, 396 xlsx, 457 pptx, 243 odp.content.xml, never in the other formats.textutil's output. The other four: two in one file whose indexes sit in a footnote, whichtextutilomits; one in a text box, wheretextutilitself prints the title twice; and one template that differs from its generated title, as noted above.mainit yieldsContents: ContentswhereContentsis expected, and it passes here.vp test run src/provider/userInputAttachments.test.tspasses 45/45.vp run check:changedpasses: format, lint, knip, graphql, typecheck of 3 packages, and tests.Written by Claude Fable 5.2 in Claude Code, run from T3 Code.
🤖 Generated with Claude Code