Skip to content

fix(server): paragraphs and headings start on a new line after inline text in EPUB and DOCX documents - #43411

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
saphid:hunter/c-55a9341411
Nov 26, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
saphid:hunter/c-55a9341411

Conversation

@saphid

@saphid saphid commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Problem

EPUB paragraphs and headings after inline text run into the preceding words. DOCX text-box paragraphs have the same problem, so agents read IntroBody paragraph or BeforeBox text instead of separate paragraphs.

Deterministic repro on origin/main (0df79074ad5f21478b616fe812746c0896ec90d7): after vp i, run the copyable Python ZIP fixture builder and Node extractDocumentText() command in the runtime transcript. The EPUB chapter body is <div>Intro<p>Body paragraph</p></div>, <ul><li>Summary<p>Details</p></li></ul>, <div>Intro<h2>Section Title</h2></div>, or <table><tr><td>First<p>Second</p></td></tr></table>. The DOCX fixture contains Before, an inline w:txbxContent paragraph containing Box text, then After in the enclosing paragraph.

Observed → expected (JSON string notation):

  • "IntroBody paragraph" → "Intro\nBody paragraph"
  • "SummaryDetails" → "Summary\nDetails"
  • "Intro## Section Title" → "Intro\n## Section Title"
  • "FirstSecond" → "First Second" inside a table cell
  • "BeforeBox text\nAfter" → "Before\nBox text\nAfter"

The committed archive regression can also be run with vp test run apps/server/src/provider/userInputAttachments.test.ts -t "preserves office structure and EPUB reading order with bounded archives"; applying only its test diff to base reproduces the failing assertion.

Change

Emit the existing deferred paragraph boundary before paragraph/heading text and its heading prefix. The common server extractor handles EPUB and DOCX attachments for every client and provider; table cells keep their existing whitespace normalization. Extend the existing archive fixture table and correct its DOCX text-box heading expectation.

Scope

Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.

Verification

  • The regression fails on unmodified base with IntroBody paragraph where Intro\nBody paragraph is expected.
  • Three consecutive full runs of vp test run apps/server/src/provider/userInputAttachments.test.ts: 61/61 tests pass each time.
  • vp run check:changed: exit 0.
  • Before/after runtime transcript and copyable reproducer show all five cases through the real extractor.
  • Not shown: full app attachment upload, real office-generated files, web/desktop/mobile UI interaction, or a live provider turn. No client, contract, translation, provider-adapter, or connection-mode changes are required for this shared server parser fix.

Authored by GPT-6.1 Sol (Codex); reviewed by Gemini 4 Neon (Antigravity).

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 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 5610f64 and f77cb84.

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 paragraph worker now emits a thematic-break marker before each paragraph or heading. Archive extraction tests add EPUB and DOCX fixtures that check text order, including a newline before a DOCX text-box heading.

Changes: Document text extraction

Layer / File(s) Summary
Paragraph boundaries and archive extraction coverage
apps/server/src/provider/documentTextWorker.ts, apps/server/src/provider/userInputAttachments.test.ts
The paragraph worker emits a thematic-break marker before each paragraph or heading. EPUB tests cover nested paragraphs, lists, a heading, and table cells. DOCX tests check text-box content order and require a newline before the text-box heading.

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

Change: Bug fix

Suggested reviewers: only21mil, lucenx9

Merge Risk: Minimal · previous review 5610f

This change makes paragraphs and headings start on a new line after inline text in EPUB and DOCX attachments. It is a small, localized extraction fix with regression tests, and no merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: EPUB and DOCX paragraphs and headings now start on a new line after inline text. It matches the raw summary (a thematic-break marker before each paragraph or heading) …
Description check Passed The description covers the problem, a reproduction, the change, scope, and verification. It follows the template sections: Problem, Change, Scope, and Verification. It gives observed and expected outp…
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: EPUB and DOCX paragraphs and headings now start on a new line after inline text. It matches the raw summary (a thematic-break marker before each paragraph or heading) and the PR objectives. It follows the conventional commit format and is specific.

Full details: Description check

Explanation

The description covers the problem, a reproduction, the change, scope, and verification. It follows the template sections: Problem, Change, Scope, and Verification. It gives observed and expected outputs for five cases, names the regression test, and states what was not checked. The template's optional agent-attribution line is present. The description is detailed and matches the objectives, though it relies on an external gist for the runtime transcript.

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 147028a and 5610f64.

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; 0 remain after this review.

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

Copy link
Copy Markdown
Member

Evidence

Upload the same synthetic EPUB and DOCX in a fresh thread, submit, and inspect the server-generated extracted text verbatim in the app's file viewer. Chromium, 1280×800, light theme, fresh database on each commit, Replay (dev).

The base joins inline text to paragraphs and headings, including DOCX text-box content. The head preserves newlines and normalizes the table-cell boundary to a space. scenarios:prove exited 0.

Before After
6ac4edef8c f77cb84d82
Before: joined EPUB paragraphs, heading and DOCX text-box text After: EPUB and DOCX block boundaries preserved
Before recording After recording

Scenario and synthetic document generator

Not shown:

  • A live Codex response quoting the sidecars was not exercised; the scenario used Replay (dev) and displayed the actual server-generated sidecar contents directly.

@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 26, 2026
@juliusmarminge
juliusmarminge merged commit 74c0308 into pingdotgg:main Nov 26, 2026
60 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 26, 2026
luckyou-02 pushed a commit to luckyou-02/t3code that referenced this pull request Nov 26, 2026
包含上游提交:
- pingdotgg#43238 (4c34f1c) 输入框图片溢出按钮单数文案
- pingdotgg#43209 (6c1e423) 本地 trace 常规 span 采样
- pingdotgg#43049 (d5d5c17) 审批卡片显示不可见字符
- pingdotgg#43248/pingdotgg#43290/pingdotgg#43310/pingdotgg#43353/pingdotgg#43411 同步 documentTextWorker 文档文本提取修复
- pingdotgg#43258 (744ff6c) Antigravity ask_question 正文显示问题
- pingdotgg#43235 (afc388c) 带行号文件链接打开只读文件定位到对应行
- pingdotgg#43251 (6ca7e66) ACP 可选数字题允许留空
- pingdotgg#43253 (2cc5253) 共享 agent 强停提示单数文案
- pingdotgg#43214 (3e0a40f) 文件查看器支持 GBK/GB18030 解码(仅 shared,不含 mobile polyfill)
- pingdotgg#43254 (9c4ab6d) 已渲染 Markdown 切换文件/会话保留滚动位置
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 26, 2026
… text in EPUB and DOCX documents (pingdotgg#43411)

Co-authored-by: SAPHID <saphid@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 74c0308)
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 26, 2026
… text in EPUB and DOCX documents (pingdotgg#43411)

Co-authored-by: SAPHID <saphid@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 74c0308)
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 26, 2026
… text in EPUB and DOCX documents (pingdotgg#43411)

Co-authored-by: SAPHID <saphid@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 74c0308)
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 26, 2026
… text in EPUB and DOCX documents (pingdotgg#43411)

Co-authored-by: SAPHID <saphid@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 74c0308)
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 26, 2026
… text in EPUB and DOCX documents (pingdotgg#43411)

Co-authored-by: SAPHID <saphid@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 74c0308)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants