GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): prevent lossy edits of non-UTF-8 workspace files by StiensWout · Pull Request #36545 · pingdotgg/t3code

Conversation

@StiensWout

@StiensWout StiensWout commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Editing a non-UTF-8 workspace file silently replaced invalid bytes with U+FFFD on the first autosave. Reject undecodable content through the existing binary-file error so the editor never receives lossy text. Valid UTF-8 and partial multibyte truncation keep their existing behavior. BOM preservation is separate and unchanged.

Small fast-lane fix: localized server validation, no new state, interface or UI flow.

Proof

The T3 Code bughunt found this, and Claude Opus 5.5 independently confirmed it on main d899bddfa2a6f824411eaae10fb7a8fa0a37bbb7.

  • Red: the added invalid-UTF-8 row fails on that base because readFile succeeds with caf�; the existing NUL case passes.
  • Green: pnpm exec vp test run apps/server/src/workspace/WorkspaceFileSystem.test.ts passes, including invalid input, valid UTF-8 and split multibyte truncation.
  • pnpm exec vp run check:changed passes. The trim run repeated both commands, and Sol independently reran the focused suite.
  • Runtime decoder probe: valid café stays café; a standalone e9 is rejected; streaming input ending in a partial character still drops that character.
  • Rebased onto current main before filing; git range-diff confirms the reviewed patch is unchanged.

scenarios:prove and real-client verification were not run. The service test reaches production decoding through real file I/O. Legacy-encoded files now use the existing unavailable/binary preview state instead of being editable. Mobile wording still calls them binary.

Local cubic: the unrelated VCS P1 was a stale-base comparison, resolved by rebasing with an unchanged patch. Its legacy-encoding preview nit is the intentional safety tradeoff. Opus's optional truncated-invalid-input test and mobile-copy nits remain open. No blocker or should findings remain. Shared client/server decoder consolidation is a follow-up.

Council review

Reviewer Round 1
Claude Opus 5.5 9/10
GPT 6.1 Sol 9.5/10

Small-PR council per Wout: two seats, no guest. Grok and guest tasks were cancelled when the instruction changed; neither gates this PR.

Closes #36544

Created with GPT 6.1 Sol (lead, bughunt and review) in the Codex harness and Claude Opus 5.5 (independent verification, build, trim and review) in the Claude harness, through T3 Code.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@StiensWout @codex @claude
fix(server): reject invalid UTF-8 when reading workspace files
0abf0dc
readFile decoded invalid UTF-8 into U+FFFD, so editing and saving such a
file silently replaced its original bytes. Decode fatally and reject the
file with the existing binary-file error; a multibyte character split by
the read limit is still dropped by streaming decode.

Co-authored-by: GPT 6.1 Sol <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 14, 2026
macroscopeapp[bot]
macroscopeapp Bot approved these changes Nov 14, 2026
View reviewed changes
@macroscopeapp

macroscopeapp Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 0abf0dc

Macroscope's review found this PR approvable — Invalid UTF-8 workspace files now use the existing binary-file error path instead of exposing lossy text for editing. The change leaves valid UTF-8 handling and file contents untouched while reducing accidental corruption risk.

You can add or adjust custom eligibility rules. Learn more.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 14, 2026
@juliusmarminge @claude
Merge origin/main into t3/reject-invalid-utf8-edits
6f3b0c0
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

WorkspaceFileSystem.readFile now rejects invalid UTF-8 as a binary-file error, alongside files containing NUL bytes. Tests cover both cases. Truncated reads continue to use streaming decoding.

Changes: Workspace file read validation

Layer / File(s) Summary
Read validation and rejection tests
apps/server/src/workspace/WorkspaceFileSystem.ts, apps/server/src/workspace/WorkspaceFileSystem.test.ts
readFile uses fatal UTF-8 decoding and the shared WorkspaceBinaryFileError path for invalid UTF-8 and NUL-containing files. Tests cover both inputs and retain assertions that errors do not expose file contents.

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

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: marcodotio, juliusmarminge

Merge Risk: Minimal · up to 6f3b0

Files with invalid UTF-8 now fail to open as binary instead of being shown with replacement characters that autosave could write back. Valid UTF-8 files and files truncated mid-character keep their existing behavior. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the server now rejects non-UTF-8 workspace files so edits cannot lossily replace invalid bytes. It follows the conventional commit format and is specific enough for a …
Description check Passed The description covers the problem (silent U+FFFD replacement on autosave), the change (reject undecodable content via the existing binary-file error), and verification (focused test run, red/green ev…
Linked Issues check Passed Issue #36544 requires that editing an unsupported-encoding workspace file either preserves its original bytes or refuses the edit. The diff to apps/server/src/workspace/WorkspaceFileSystem.ts changes …
Out of Scope Changes check Passed All changed hunks serve the issue. The WorkspaceFileSystem.ts change adds fatal UTF-8 decoding and routes decode failures through the existing WorkspaceBinaryFileError. The binaryFileError helper avoi…
Full details: Title check

Explanation

The title names the main change: the server now rejects non-UTF-8 workspace files so edits cannot lossily replace invalid bytes. It follows the conventional commit format and is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description covers the problem (silent U+FFFD replacement on autosave), the change (reject undecodable content via the existing binary-file error), and verification (focused test run, red/green evidence, runtime probe). It links issue #36544 under Scope and notes the author's council and model usage. The Scope section does not explain why a small fix needs no issue, but the issue is linked, so the gap is minor. The Verification section also lists what was not checked. Overall the description is mostly complete.

Full details: Linked Issues check

Explanation

Issue #36544 requires that editing an unsupported-encoding workspace file either preserves its original bytes or refuses the edit. The diff to apps/server/src/workspace/WorkspaceFileSystem.ts changes readFile to decode with new TextDecoder("utf-8", { fatal: true }). Invalid UTF-8 now fails inside Effect.try with catch: binaryFileError, which yields WorkspaceBinaryFileError. The file is therefore refused, and the server never returns replacement-character text that autosave could write back. The NUL-byte check is unchanged. Truncated reads keep stream: truncated, so a character split at the byte limit is still dropped. The test diff in WorkspaceFileSystem.test.ts adds an invalid-UTF-8 case (bytes 63 61 66 e9) to the binary-file rejection test, and it asserts the same WorkspaceBinaryFileError without content leakage. The issue requirement is a server-side coding requirement, and the code and test cover it. The PR does not preserve the original bytes. It refuses the edit, which the issue allows. I did not run the test suite. The result rests on the source diff and the PR's reported test results.

Full details: Out of Scope Changes check

Explanation

All changed hunks serve the issue. The WorkspaceFileSystem.ts change adds fatal UTF-8 decoding and routes decode failures through the existing WorkspaceBinaryFileError. The binaryFileError helper avoids duplicating that constructor for the NUL path and the decode path. The truncated-read comment and streaming behavior are kept. The test change parameterizes the existing binary-file test with a NUL case and an invalid-UTF-8 case. No unrelated files or behavior changes appear in the reviewed diff. The PR description states that BOM handling is unchanged, and the diff contains no BOM changes.

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

  • Source mode: Auto
  • Repository: pingdotgg/t3code
  • Branch: main
  • File: .coderabbit.config.ts
  • Commit: 99071c4
  • Layers: Repository TS config
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0bb7478c-a237-4b9b-8911-cae4adca8e76
Commits

Reviewing files that changed from the base of the PR and between 99071c4 and 6f3b0c0.

Files selected for processing: 2

  • apps/server/src/workspace/WorkspaceFileSystem.test.ts
  • apps/server/src/workspace/WorkspaceFileSystem.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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge

juliusmarminge commented Nov 14, 2026

Copy link
Copy Markdown
Member

Evidence

Create notes.txt with Windows-1252 bytes 63 61 66 e9, open its project and thread, then select Files → notes.txt. If editable, append edited and await autosave. Inspect disk bytes on both sides.

Environment: real web client and server, Chromium 156 on Linux, 1280×800, light theme, fresh synthetic state and replay agent on each commit.

Before After
Commit 99071c4953 6f3b0c043b
Result Editable caf�; autosave changed the original e9 into ef bf bd. Final bytes: 636166efbfbd20656469746564. No editor; unsupported UTF-8 notice. Original bytes remain 636166e9.
Open file Before: lossy editable text After: unsupported encoding refused
After edit attempt Before: corrupted text autosaved After: editing refused and bytes preserved
Recording Before interaction After interaction

Scenario source

scenarios:prove exited 0: fails on base and passes on head. Captures and recording frames were visually inspected.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@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 14, 2026
@juliusmarminge
juliusmarminge merged commit 5abf383 into pingdotgg:main Nov 14, 2026
51 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 14, 2026
AIdoesmyjob pushed a commit to AIdoesmyjob/t3code that referenced this pull request Nov 14, 2026
@StiensWout @juliusmarminge @AIdoesmyjob
fix(server): prevent lossy edits of non-UTF-8 workspace files (pingdo…
8876f93
…tgg#36545)

Co-authored-by: Julius Marminge <[email protected]>
(cherry picked from commit 5abf383)
@AIdoesmyjob AIdoesmyjob mentioned this pull request Nov 14, 2026
sync: 43 upstream fixes 2026-11-14 (security, Codex/Claude/ACP compat, delegation, data safety) AIdoesmyjob/t3code#29
Closed
@unlockdigital unlockdigital mentioned this pull request Nov 14, 2026
fix(fork): backport file safety and Codex reliability updates unlockdigital/t3code#21
Merged
Pipyakas pushed a commit to Pipyakas/t3code that referenced this pull request Nov 15, 2026
@StiensWout @juliusmarminge @Pipyakas
fix(server): prevent lossy edits of non-UTF-8 workspace files (pingdo…
ce7aec6
…tgg#36545)

Co-authored-by: Julius Marminge <[email protected]>
(cherry picked from commit 5abf383)
@thoerwink8 thoerwink8 mentioned this pull request Nov 25, 2026
fix(server): show GBK files in diffs and stop corrupting non-UTF-8 saves thoerwink8/fleet-ade#402
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@macroscopeapp macroscopeapp[bot] macroscopeapp[bot] approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug]: Editing non-UTF-8 workspace files corrupts bytes on autosave

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@StiensWout @juliusmarminge
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.