Skip to content

fix(server): RTF attachments that declare code page 0 or 866 reach the agent as text - #41340

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/server-rtf-attachment-codepage-0-866
Nov 23, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/server-rtf-attachment-codepage-0-866

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

When I attach an RTF file whose header declares \ansicpg0 or \ansicpg866 to a chat message, the agent gets no text from it. The server logs "Document text extraction failed." and writes no <id>.rtf.txt next to the attachment. Code page 0 is Windows' "system default ANSI code page" (CP_ACP), and 866 is the DOS Cyrillic code page. #41277 already made the web preview open these files; the server's attachment text extraction has its own code page check.

rtf() in apps/server/src/provider/documentTextWorker.ts accepts only \ansicpg874 and \ansicpg1250 to 1258 (plus 10000 for Macintosh) and throws "Unsupported RTF code page" for anything else, so the server stores the RTF file but produces no extracted text.

Change

rtf() now also accepts \ansicpg0, decoded as windows-1252 (the decoder it already uses when a file declares no code page), and \ansicpg866, decoded as ibm866. These are the same two mappings #41277 added to the web preview. Other code pages, such as \ansicpg99999 or \ansicpg932, are still rejected as before. The code page check now picks the decoder label first and rejects anything without one, so a bare \ansicpg with no number now fails with "Unsupported RTF code page" instead of an encoding error.

Scope

One problem in one server function, plus two rows in the existing RTF extraction test table. It needs no issue because it is a small fix for an obvious bug: a valid RTF attachment reaches the agent with no text. \fcharset handling is not changed.

Verification

An AI agent (T3 Code Nightly) ran each check below.

  • apps/server/src/provider/userInputAttachments.test.ts: two new rows in the "extracts RTF text" table check that {\rtf1\ansi\ansicpg0 Caf\'e9} extracts Café and that {\rtf1\ansi\ansicpg866 \'8f\'e0\'a8\'a2\'a5\'e2} extracts Привет. Both rows fail on 65cd6446233 with "Unsupported RTF code page"; on this branch all 49 tests pass. The existing checks that expect \ansicpg99999 and \ansicpg932 to be rejected still pass. vp run check:changed passes.
  • Real app on Linux, vp run dev --no-seed with a fresh empty home for each commit, no accounts needed.

Setup:

mkdir -p /tmp/rtf-repro
printf '%s' '{\rtf1\ansi\ansicpg0 Hello world}' > /tmp/rtf-repro/cp0.rtf
printf '%s' "{\\rtf1\\ansi\\ansicpg866 \\'8f\\'e0\\'a8\\'a2\\'a5\\'e2}" > /tmp/rtf-repro/cp866.rtf
printf '%s' '{\rtf1\ansi\ansicpg99999 Unsupported}' > /tmp/rtf-repro/cp99999.rtf
vp run dev --no-seed --home-dir "$(mktemp -d)"

Steps: on each commit, start the server as above → open the pairing URL → in the new thread, click Attach files → choose all three files in /tmp/rtf-repro → list the userdata/attachments/ folder under the baseDir that the [dev-runner] line prints, and read each <id>.rtf.txt.

File 65cd6446233 (before) This branch
cp0.rtf no .rtf.txt, "Document text extraction failed." Hello world
cp866.rtf no .rtf.txt, "Document text extraction failed." Привет
cp99999.rtf no .rtf.txt, "Document text extraction failed." no .rtf.txt, "Document text extraction failed."

Before:

$ ls userdata/attachments/
pending-8e9daca5-…-rtf.rtf
pending-9f23bc9d-…-rtf.rtf
pending-b0d342bf-…-rtf.rtf
WARN: Document text extraction failed. { extension: 'rtf' }   (3 times)

After:

$ ls userdata/attachments/
pending-0d50ab22-…-rtf.rtf
pending-0d50ab22-…-rtf.rtf.txt
pending-e5bc5a59-…-rtf.rtf
pending-e5bc5a59-…-rtf.rtf.txt
pending-fc13ced1-…-rtf.rtf
$ cat pending-e5bc5a59-…-rtf.rtf.txt     # cp0.rtf
Hello world
$ cat pending-0d50ab22-…-rtf.rtf.txt     # cp866.rtf
Привет
WARN: Document text extraction failed. { extension: 'rtf' }   (once, cp99999.rtf)

Not shown: macOS and Windows runs. The changed code has no platform branch, and windows-1252 and ibm866 are both standard WHATWG encoding labels. No screenshots, since nothing on screen changes; the evidence is the extracted text.

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 1ac43c5 and 85bb5dd.

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 RTF decoder now accepts code pages 0 and 866, mapping them to Windows-1252 and IBM866. Extraction tests cover escaped-byte decoding for both code pages.

Changes: RTF Code Page Support

Layer / File(s) Summary
Decoder mapping and extraction tests
apps/server/src/provider/documentTextWorker.ts, apps/server/src/provider/userInputAttachments.test.ts
Code page 0 maps to Windows-1252, and code page 866 maps to IBM866. Tests cover extraction of “Café” and “Привет” from escaped bytes.

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

Change: Bug fix

Possibly related PRs

  • pingdotgg/t3code#38645: Both PRs change the mapping from RTF code-page values to decoders and affect which values are supported.
  • pingdotgg/t3code#40476: Its font-level fallback uses the document code-page mapping changed by this PR.

Suggested reviewers: lucenx9, marve10s, juliusmarminge

Merge Risk: Minimal · previous review 1ac43

RTF attachments declaring code page 0 or 866 will now be extracted as text instead of being rejected. Other unsupported code pages are still rejected. The change is small and tested, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: RTF attachments declaring code page 0 or 866 now reach the agent as text. The summary, the code change in documentTextWorker.ts, and the two new test rows all match this. T…
Description check Passed The description follows the template. It has Problem, Change, Scope, and Verification sections, and each section has real content. The Problem section gives the bug and the expected behavior. The Chan…
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 change: RTF attachments declaring code page 0 or 866 now reach the agent as text. The summary, the code change in documentTextWorker.ts, and the two new test rows all match this. The title uses the conventional commit form and is specific. It is 84 characters, a little over the usual short length, but still clear.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, Scope, and Verification sections, and each section has real content. The Problem section gives the bug and the expected behavior. The Change section explains the code page mappings and the rejection behavior. The Scope section explains why the fix needs no linked issue. The Verification section gives focused test results, a before/after table, and the environments not checked (macOS and Windows). The author also names the model and harness, as the template asks. The description does not link an issue, but it gives a reason for that choice, which the template accepts.

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 8851fb7 and 1ac43c5.

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

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 23, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Attached the same four RTF files through the real web composer on fresh databases; all uploads returned 204. Inspected the server-created text sidecars and displayed the observed results in the app terminal. Base loses code pages 0 and 866; head extracts Café and Привет. Supported 1252 and unsupported 99999 retain their behavior.

Before After
76de50bc0d 85bb5dd06c
Before: code pages 0 and 866 produce no extracted text After: code pages 0 and 866 extract Café and Привет
Before recording After recording
Before runtime transcript After runtime transcript

Scenario driver, with its temporary transcript destination made portable. Chromium, 1280×800, light theme on both sides. Recordings mask the temporary shell path during terminal startup; screenshots are unaltered. scenarios:prove exited 0.

Not shown:

  • A live provider consuming the extracted text was not exercised; proof covers the reported real upload and sidecar extraction failure.

@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 2de6287 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
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Nov 23, 2026
**v0.1.12-nightly.20261123.5138** · 83 changes from 27 contributors

- **Events for outside agents.** ChatGPT and other compatible agents can now receive T3 Code events.
- **Faster worktree launches.** New worktree threads start sooner by generating branch names while the worktree is created.
- **Less repository slowdown.** T3 Code's Git operations no longer trigger automatic maintenance that can tie up large repositories.
- **Queued messages preserved.** Messages remain visible after a server restart cancels a turn that had already started.
- **Background work when settling.** Settling a thread no longer stops background agents and commands that its agent is waiting on.

### Plus 69 more bug fixes and performance improvements.

<details>
<summary>Full changelog</summary>

## What's Changed
* feat(server): outside agents receive milestones by MCP Events webhooks by @juliusmarminge in pingdotgg/t3code#41141
* fix(antigravity): recognize attachments with MIME parameters by @Lucenx9 in pingdotgg/t3code#39097
* fix(antigravity): keep shortened question text valid Unicode by @Lucenx9 in pingdotgg/t3code#39478
* fix(cursor): preserve ended turns when connection retries exhaust by @Yash-Singh1 in pingdotgg/t3code#41176
* fix(server): startup PR backfill looks up each repository branch once by @juliusmarminge in pingdotgg/t3code#41175
* perf(mobile): avoid re-rendering on shell updates in useSidebarRowThreadKey by @Isaac-b-ux in pingdotgg/t3code#41143
* perf(client): skip child indexing when no child needs input by @saphid in pingdotgg/t3code#25537
* fix(server): app links no longer leave the preview stuck loading by @niieani in pingdotgg/t3code#41168
* fix(server): open Claude sessions on macOS share one process-table poll by @juliusmarminge in pingdotgg/t3code#37585
* fix(mobile): screen readers hear when a terminal Ctrl, Alt or Cmd key is latched by @tiliakoos in pingdotgg/t3code#41173
* fix(server): renaming a provider instance no longer stops its sessions by @juliusmarminge in pingdotgg/t3code#41189
* perf(server): idle agent sessions free their memory after 2 minutes by @juliusmarminge in pingdotgg/t3code#41174
* perf(server): checkpoint capture no longer walks every reflog in the repository by @juliusmarminge in pingdotgg/t3code#41177
* test(server): replay scenarios no longer run checkpoints against the real checkout by @juliusmarminge in pingdotgg/t3code#41192
* fix(web): chat file tooltips open beside the link instead of sliding in from the corner by @juliusmarminge in pingdotgg/t3code#41194
* fix(server): RTF attachments leave hidden text out of what agents read by @only21mil in pingdotgg/t3code#41191
* fix(server): Antigravity 502s fail the turn with the real error by @juliusmarminge in pingdotgg/t3code#33596
* fix(web,mobile): translate remaining untranslated workflow, git, and link strings by @SeniorZhai in pingdotgg/t3code#41193
* fix(web): preserve reading position when side panels resize by @juliusmarminge in pingdotgg/t3code#41184
* fix(web): preserve alpha channel when previewing WhiteIsZero TIFF images by @only21mil in pingdotgg/t3code#41196
* fix(server): workflow event types appear only while Workflows is on by @juliusmarminge in pingdotgg/t3code#41202
* fix(server): worktree launches name their branch while the worktree is created by @juliusmarminge in pingdotgg/t3code#36904
* fix(cli): expand ~ paths passed to t3 project add --track by @only21mil in pingdotgg/t3code#41199
* fix(server): html_preview as root names the sandbox opt-out by @juliusmarminge in pingdotgg/t3code#41206
* chore: vouch jschachter by @t3dotgg in pingdotgg/t3code#41215
* fix(server): parse unordered HTML favicon rel tokens by @only21mil in pingdotgg/t3code#41203
* fix(server): token analytics label new models from Codex and Claude catalogs by @t3dotgg in pingdotgg/t3code#41214
* fix(web): file picker highlights stay on the typed letters after İ by @only21mil in pingdotgg/t3code#41216
* fix(server): T3's own git commands no longer start Git's auto maintenance by @mkantenko in pingdotgg/t3code#41200
* fix(web): accept TIFF files containing standard IFD tag type 13 (SubIFDs) by @only21mil in pingdotgg/t3code#41228
* fix(shared): reject keybindings with a dangling or extra '+' by @juliusmarminge in pingdotgg/t3code#41231
* fix(github): a remote host URL rejects no longer breaks GitHub resolution by @juliusmarminge in pingdotgg/t3code#41232
* feat(scripts): a server metrics run catches CPU, memory and first-request regressions by @juliusmarminge in pingdotgg/t3code#41159
* fix(ssh): accept Node versions with build metadata by @Pulsar-Programmer in pingdotgg/t3code#41171
* fix(server): merge-back refuses an archived or deleted parent by @juliusmarminge in pingdotgg/t3code#41229
* fix(contracts): ForwardCompatibleOptional drops the key for values it cannot read by @juliusmarminge in pingdotgg/t3code#41236
* fix(acp): agent terminals keep 1.25 MiB of output, not 16 MiB by @juliusmarminge in pingdotgg/t3code#41243
* feat(cursor): show which step Cursor is in while a turn starts by @Yash-Singh1 in pingdotgg/t3code#41242
* fix(server): Claude turns no longer stay in memory for 10 minutes after each request by @juliusmarminge in pingdotgg/t3code#41238
* fix(server): Claude plan ids live with the turn, not the session by @juliusmarminge in pingdotgg/t3code#41244
* fix(server): pass explicit null payloads to workflows by @only21mil in pingdotgg/t3code#41245
* fix(server): accept unquoted HTML favicon attributes by @only21mil in pingdotgg/t3code#41239
* docs(user): explain how settling differs from archiving a thread by @juliusmarminge in pingdotgg/t3code#41253
* fix(web): spreadsheet text and fills no longer vanish when their cell scrolls out by @Yash-Singh1 in pingdotgg/t3code#41263
* fix(provider): leave MacPorts-owned agent updates to MacPorts by @maria-rcks in pingdotgg/t3code#25208
* fix(acp): sessions no longer keep a record of every turn they ran by @juliusmarminge in pingdotgg/t3code#41256
* fix(web): shift-scroll and horizontal scrollers no longer navigate history by @Yash-Singh1 in pingdotgg/t3code#41264
* fix(web): hidden preview tabs larger than the window capture whole by @jason5545 in pingdotgg/t3code#26965
* fix(web): quick clicks on different sidebar threads open each one by @juliusmarminge in pingdotgg/t3code#41258
* fix(web): match macOS Option shortcuts to the active keyboard layout by @nateEc in pingdotgg/t3code#24034
* fix(server): let the CLI answer workflow questions by their exact name by @only21mil in pingdotgg/t3code#41260
* fix(web): a refused desktop install shows as failed instead of downloaded by @juliusmarminge in pingdotgg/t3code#41262
* refactor(server): adapter snapshots stop carrying provider turns nothing reads by @juliusmarminge in pingdotgg/t3code#41276
* fix(acp): deliver appContext on startTurn and steerTurn by @jieyuexing in pingdotgg/t3code#41241
* fix(server): later Codex retry or failure no longer sorts above same-turn progress by @juliusmarminge in pingdotgg/t3code#41255
* fix(server): branch names keep leading and trailing Unicode whitespace by @juliusmarminge in pingdotgg/t3code#41274
* fix(cli): expand ~ paths in t3 thread --output-schema by @only21mil in pingdotgg/t3code#41271
* fix(web): RTF previews open files that declare code page 0 or 866 by @only21mil in pingdotgg/t3code#41277
* fix(shared): composer file links to names with # ? & ' , % ! ~ open after sending by @shivamhwp in pingdotgg/t3code#41270
* fix(web): No project drafts no longer offer New worktree by @Kwan-Li in pingdotgg/t3code#41269
* fix(server): queued messages stay visible when a restart cancels their started run by @juliusmarminge in pingdotgg/t3code#41307
* fix(desktop): annotation Select picks elements inside open shadow roots by @fixfon in pingdotgg/t3code#23180
* fix(web): archive folders with leading or repeated slashes show their names by @only21mil in pingdotgg/t3code#41301
* fix(server): provider updates keep running when the client disconnects by @juliusmarminge in pingdotgg/t3code#27261
* fix(server): reject workflow signals with conflicting destinations by @only21mil in pingdotgg/t3code#41312
* fix(desktop): declare Apple Events access for Computer Use cleanup by @loia5tqd001 in pingdotgg/t3code#33869
* fix(server): settling no longer ends background work the agent is waiting on by @Kazuya-Hibara in pingdotgg/t3code#31449
* fix(server): CLI single-executable builds again after MCP webhooks by @juliusmarminge in pingdotgg/t3code#41326
* fix(server): preserve spaces in workflow store keys and prefixes by @only21mil in pingdotgg/t3code#41318
* fix(web): remote open uses the environment's saved SSH route by @juliusmarminge in pingdotgg/t3code#27236
* fix(web): an IME Escape no longer clears a typed font family by @heki1224 in pingdotgg/t3code#32768
* fix(web): caret lands after closing Markdown markers after a paste by @juliusmarminge in pingdotgg/t3code#41327
* feat(skills): launch videos can stage file edits, commits and MCP sign-in by @juliusmarminge in pingdotgg/t3code#40202
* perf(server): the full thread snapshot is streamed in bounded chunks by @navidnadali in pingdotgg/t3code#30836
* fix(server): a reconnect burst checks a watched project's branch once, not per subscriber by @juliusmarminge in pingdotgg/t3code#41309
* fix(server): follow replacements along linked theme paths by @StiensWout in pingdotgg/t3code#41325
* fix(shared): search cwd for empty POSIX PATH components by @Motaghi in pingdotgg/t3code#28106
* fix(server): repository lookup shows why a repository was not found by @bmmmm in pingdotgg/t3code#31239
* docs: prune internal and operations docs and enforce them in review by @juliusmarminge in pingdotgg/t3code#41330
* test(server): remove the flaky workflow store case by @juliusmarminge in pingdotgg/t3code#41344
* fix(server): RTF attachments that declare code page 0 or 866 reach the agent as text by @only21mil in pingdotgg/t3code#41340
* fix(desktop): macOS SnapShot skips the window-sharing indicator by @juliusmarminge in pingdotgg/t3code#41334
* fix(desktop): capture the whole oversized preview viewport by @shantanuojha in pingdotgg/t3code#36286

## New Contributors
* @niieani made their first contribution in pingdotgg/t3code#41168
* @SeniorZhai made their first contribution in pingdotgg/t3code#41193
* @loia5tqd001 made their first contribution in pingdotgg/t3code#33869
* @Kazuya-Hibara made their first contribution in pingdotgg/t3code#31449
* @heki1224 made their first contribution in pingdotgg/t3code#32768
* @bmmmm made their first contribution in pingdotgg/t3code#31239
* @shantanuojha made their first contribution in pingdotgg/t3code#36286

**Full Changelog**: pingdotgg/t3code@v0.1.12-nightly.20261123.5124...v0.1.12-nightly.20261123.5138

</details>


Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.1.12-nightly.20261123.5138
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