From ad95b3bd74a5e5b6ed359c2e012f6f6c3dee86e0 Mon Sep 17 00:00:00 2001 From: Fuksss Date: Mon, 16 Nov 2026 23:59:26 +0100 Subject: [PATCH 1/3] fix(server): DOCX text for agents no longer includes object position numbers Skip hidden DrawingML layout values and Word field data during extraction. Do not let hidden text suppress a chart's fallback caption. --- README.md | 1 + .../server/src/provider/documentTextWorker.ts | 7 +++- .../src/provider/userInputAttachments.test.ts | 41 +++++++++++++++++++ docs/user/composer.md | 3 ++ 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 24dc0f8f7f666..0305925c6ffe8 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ We wanted something performant, remote-ready, and truly open. If we ever go the - [Install and first run](./docs/user/install.md) - [Remote access from a phone or another machine](./docs/user/remote-access.md) +- [Messages and attachments](./docs/user/composer.md#attach-files) - [Permission modes](./docs/user/permission-modes.md) - [Source control](./docs/user/source-control.md) - [Connect outside agents over MCP](./docs/user/outside-agents.md) diff --git a/apps/server/src/provider/documentTextWorker.ts b/apps/server/src/provider/documentTextWorker.ts index 5957fdd3cd892..2d6fddee0a2af 100644 --- a/apps/server/src/provider/documentTextWorker.ts +++ b/apps/server/src/provider/documentTextWorker.ts @@ -28,6 +28,11 @@ const HIDDEN = new Set([ "delInstrText", "tracked-changes", "pPr", + "positionH", + "positionV", + "sizeRelH", + "sizeRelV", + "fldData", ]); // @effect-diagnostics-next-line extendsNativeError:off - this worker loads no Effect runtime; Truncation is a local throw sentinel. @@ -109,7 +114,7 @@ function xml(source: string, extension: string): XmlNode { parent.children.pop(); return; } - if (!node.hasText && node.name !== "noBreakHyphen") return; + if (HIDDEN.has(node.name) || (!node.hasText && node.name !== "noBreakHyphen")) return; parent.hasText = true; if (node.name === "Choice") parent.hasTextChoice = true; }); diff --git a/apps/server/src/provider/userInputAttachments.test.ts b/apps/server/src/provider/userInputAttachments.test.ts index 4087601b58c0b..110ed7ebaac53 100644 --- a/apps/server/src/provider/userInputAttachments.test.ts +++ b/apps/server/src/provider/userInputAttachments.test.ts @@ -483,6 +483,47 @@ describe("question answer paths", () => { Effect.gen(function* () { const config = yield* ServerConfig.ServerConfig; const cases = [ + // Word stores object layout and field data outside the visible document text. + { + ext: "docx", + bounded: true, + parts: { + "word/document.xml": + 'Total cost is 1905000-6350042 EUR.', + }, + expected: ["Total cost is 42 EUR."], + absent: ["1905000", "-635", "0042"], + }, + { + ext: "docx", + bounded: true, + parts: { + "word/document.xml": + 'See the logo centertop00above.', + }, + expected: ["See the logo above."], + absent: ["center", "top", "00"], + }, + { + ext: "docx", + bounded: true, + parts: { + "word/document.xml": + '1905000-63500Chart caption', + }, + expected: ["Chart caption"], + absent: ["1905000", "-635"], + }, + { + ext: "docx", + bounded: true, + parts: { + "word/document.xml": + 'As shown RU5ETk9URQ==(Smith 2020) earlier.', + }, + expected: ["As shown (Smith 2020) earlier."], + absent: ["RU5ETk9URQ=="], + }, { ext: "docx", bounded: true, diff --git a/docs/user/composer.md b/docs/user/composer.md index 89a96f120d4d0..8f03e72d6cb94 100644 --- a/docs/user/composer.md +++ b/docs/user/composer.md @@ -47,6 +47,9 @@ apply, including images already in the conversation. A video attachment gives the agent a file path; only [Antigravity](./providers-antigravity.md#skills-and-attachments) sends supported videos to Gemini models as video. +Word (DOCX) attachments provide extracted text to the agent. Object position, +relative size and hidden field data are excluded from that text. + Uploads begin when you add an attachment. All uploads must finish before the message can send. Retry or remove a failed upload. On web and desktop, reloading before an upload finishes requires you to attach that file again. From 5931ebf25437efeb5d0a646c8b83c431a92c45f6 Mon Sep 17 00:00:00 2001 From: Fuksss Date: Tue, 17 Nov 2026 00:18:50 +0100 Subject: [PATCH 2/3] docs: keep the DOCX position fix to the worker and its tests Remove the guide paragraph and README link. Attaching a DOCX does not change, so this upstream bug fix needs no user documentation change. --- README.md | 1 - docs/user/composer.md | 3 --- 2 files changed, 4 deletions(-) diff --git a/README.md b/README.md index 0305925c6ffe8..24dc0f8f7f666 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,6 @@ We wanted something performant, remote-ready, and truly open. If we ever go the - [Install and first run](./docs/user/install.md) - [Remote access from a phone or another machine](./docs/user/remote-access.md) -- [Messages and attachments](./docs/user/composer.md#attach-files) - [Permission modes](./docs/user/permission-modes.md) - [Source control](./docs/user/source-control.md) - [Connect outside agents over MCP](./docs/user/outside-agents.md) diff --git a/docs/user/composer.md b/docs/user/composer.md index 8f03e72d6cb94..89a96f120d4d0 100644 --- a/docs/user/composer.md +++ b/docs/user/composer.md @@ -47,9 +47,6 @@ apply, including images already in the conversation. A video attachment gives the agent a file path; only [Antigravity](./providers-antigravity.md#skills-and-attachments) sends supported videos to Gemini models as video. -Word (DOCX) attachments provide extracted text to the agent. Object position, -relative size and hidden field data are excluded from that text. - Uploads begin when you add an attachment. All uploads must finish before the message can send. Retry or remove a failed upload. On web and desktop, reloading before an upload finishes requires you to attach that file again. From 8818a610bd785a1de6b8945cdfe7495d3eaeb077 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 17 Nov 2026 13:04:34 +0000 Subject: [PATCH 3/3] test(server): drop redundant DOCX anchor alignment case Co-Authored-By: Claude Opus 5.5 --- apps/server/src/provider/documentTextWorker.ts | 3 ++- apps/server/src/provider/userInputAttachments.test.ts | 10 ---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/apps/server/src/provider/documentTextWorker.ts b/apps/server/src/provider/documentTextWorker.ts index 2d6fddee0a2af..52521495f9d5d 100644 --- a/apps/server/src/provider/documentTextWorker.ts +++ b/apps/server/src/provider/documentTextWorker.ts @@ -15,7 +15,8 @@ type TextPart = string | typeof CELL_START | typeof CELL_END | { fallback: strin const TRUNCATED = "\n\n[Extracted text truncated at document extraction limits.]"; // Parts the document never displays: the XHTML head, tracked deletions and moves, field codes, -// phonetic guides, paragraph properties such as tab-stop definitions. +// phonetic guides, paragraph properties such as tab-stop definitions, drawing anchor layout +// values and encoded field data. const HIDDEN = new Set([ "head", "script", diff --git a/apps/server/src/provider/userInputAttachments.test.ts b/apps/server/src/provider/userInputAttachments.test.ts index 110ed7ebaac53..570fcc2fe4d5f 100644 --- a/apps/server/src/provider/userInputAttachments.test.ts +++ b/apps/server/src/provider/userInputAttachments.test.ts @@ -494,16 +494,6 @@ describe("question answer paths", () => { expected: ["Total cost is 42 EUR."], absent: ["1905000", "-635", "0042"], }, - { - ext: "docx", - bounded: true, - parts: { - "word/document.xml": - 'See the logo centertop00above.', - }, - expected: ["See the logo above."], - absent: ["center", "top", "00"], - }, { ext: "docx", bounded: true,