GeezerVison is showing github.com — fix(shared): copied Codex citations keep literal tildes in filenames by saphid · Pull Request #43770 · pingdotgg/t3code
Conversation
Problem
Copying a Codex file citation whose filename contains tildes (such as ~~final~~.txt or ~draft~.txt) produces unescaped tildes in the Markdown link label, so GFM reparses the copied link text as strikethrough (<del>) instead of the literal filename shown in chat.
Deterministic repro on origin/main (9b4943f91cf8de7f376b73d4a7299fe74b54d044):
Pass :codex-file-citation{path="reports/~~final~~.txt"} through renderCodexDirectivesForCopy (or click Copy message on an assistant reply containing that citation and paste/send it in chat) and reparse with wordsHast(..., { extensions: { codexDirectives: true } }) or remark-parse + remark-gfm:
- Observed: Original render is
<a href="./reports/~~final~~.txt">~~final~~.txt</a>, while copied Markdown is [~~final~~.txt](<./reports/~~final~~.txt>), which reparses as <a href="./reports/~~final~~.txt"><del>final</del>.txt</a> (rendered in chat as struck-through final.txt beside the file chip).
- Expected: Copied Markdown escapes tildes in the label (
[\~\~final\~\~.txt](<./reports/~~final~~.txt>)) so reparsing produces <a href="./reports/~~final~~.txt">~~final~~.txt</a> with no <del> element and no change to href.
Change
Escape ~ alongside the other inline Markdown delimiters in markdownLabel inside packages/shared/src/codexFileCitations.ts, and extend the existing codexFileCitationMarkdown and codexMarkdownDirectives GFM round-trip tests in packages/shared. Because web/desktop copy (apps/web/src/markdown/markdownText.ts) and mobile/shared inline directive rendering (packages/shared/src/codexMarkdownDirectives.ts) both serialize citations through codexFileCitationMarkdown, this single shared change covers shared, web, desktop, and mobile without changing the link destination.
Scope
Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.
Verification
- Base failure (
origin/main 9b4943f91cf8de7f376b73d4a7299fe74b54d044): vp test run packages/shared/src/codexFileCitations.test.ts packages/shared/src/codexMarkdownDirectives.test.ts failed with 5 failures (unescaped ~ in codexFileCitationMarkdown, and GFM delete nodes for reports/~~final~~.txt and reports/~draft~.txt across both renderCodexDirectivesForCopy and renderCodexInlineDirectivesAsMarkdown).
- Head pass (
573bd9da93aac2c11054cd27fa00f62b7eabccee): 3/3 consecutive runs of vp test run packages/shared/src/codexFileCitations.test.ts packages/shared/src/codexMarkdownDirectives.test.ts passed (39/39 tests each run).
vp run check:changed: exit 0 (format, lint, knip 1/2, knip 2/2, typecheck across 37 packages, and 3 affected test files / 41 tests).
- Real web app proof (
vp run scenarios:prove against 9b4943f91c vs 573bd9da93, exit 0): Clicked Copy message on an assistant reply containing :codex-file-citation{path="reports/~~final~~.txt"}, pasted into the composer, and sent it. Base failed ({"text":"See final.txt ~~final~~.txt.","hasDel":true}); head passed ({"text":"See ~~final~~.txt.","hasDel":false}).
Before (9b4943f91c) |
After (573bd9da93) |
 |
 |
- Parser/runtime transcript (web
wordsHast + shared remark-gfm): https://gist.github.com/saphid/fd63f8c865c692465de3242a9bd8514d
- Not shown: No interactive Electron desktop shell or native mobile simulator run was recorded; desktop wraps the verified web client and mobile shares
codexFileCitationMarkdown via renderCodexInlineDirectivesAsMarkdown.
Authored by Gemini 4 Neon (Antigravity); reviewed by GPT-6.1 Sol (Codex).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 26, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Walkthrough
-
The citation label formatter now escapes ~. Tests cover filenames with single and double tildes and verify that rendered citation links retain their URLs and literal filename text.
Changes: Citation label escaping
| Layer / File(s) |
Summary |
Escape and verify citation labels packages/shared/src/codexFileCitations.ts, packages/shared/src/codexFileCitations.test.ts, packages/shared/src/codexMarkdownDirectives.test.ts |
The label formatter escapes ~. Tests cover single and double tildes and check that GFM parsing retains the citation link, URL, and literal filename text. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related PRs
- pingdotgg/t3code#43627: This PR addresses paired tildes in sent file mentions through shared serialization and token parsing. This change addresses tilde escaping in Codex citation labels.
Suggested labels: bugfix
Suggested reviewers: macroscopeapp
Merge Risk: Minimal · up to 76623
-
Copied citation filenames that contain tildes, such as final.txt, now stay literal when pasted back into Markdown. The change is small, localized and covered by tests. No merge-blocking risk was found.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title names the main change: Codex citations copied as Markdown now keep literal tildes in filenames. It matches the changeset, which escapes ~ in markdownLabel and adds GFM round-trip tests. Th… |
| Description check |
 |
The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section gives a clear reproduction and expected behavior. The Change section explains the si… |
| 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. |
Full details: Title check
-
Explanation
The title names the main change: Codex citations copied as Markdown now keep literal tildes in filenames. It matches the changeset, which escapes ~ in markdownLabel and adds GFM round-trip tests. The title uses a conventional commit prefix and is specific.
Full details: Description check
-
Explanation
The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section gives a clear reproduction and expected behavior. The Change section explains the single shared fix and why it covers web, desktop, and mobile. The Scope section explains why no issue is linked. The Verification section gives focused test runs, the base failure, head passes, and the check command. It also states what was not checked (Electron desktop shell and native mobile simulator). The model/harness attribution at the end is present. The description omits a linked issue, which the template accepts for small obvious fixes. The Problem section is slightly long for the template's 'a sentence or two' guidance, but it stays on topic and complete.
Finishing Touches
-
Generate unit tests (beta)
-
- 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 dea2c0d and 766237b.
Files selected for processing: 3
-
packages/shared/src/codexFileCitations.test.ts
packages/shared/src/codexFileCitations.ts
packages/shared/src/codexMarkdownDirectives.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Evidence
Real web app, Chromium, 1280×800, light theme, fresh synthetic state on each commit. Open the assistant reply citing both files → Copy message → Ctrl+V into the composer → send.
Scenario runner: failed on base, passed on head (exit 0). Base renders the double-tilde filename as strikethrough; head preserves the sent filename and its destination.
Scenario and synthetic replay seed
Remaining behavior: the composer still applies strikethrough inside the raw double-tilde link path on head; the sent filename label and destination are preserved. The single-tilde filename stays literal on both commits.
Not shown:
- Complete absence of strikethrough in the head composer is not established: the raw double-tilde link path still appears struck through, although the escaped label and sent citation are correct.
- No visible before/after difference for the single-tilde filename: it remained literal on both commits.
- Desktop, mobile, and external Markdown applications were not exercised; this proof covers the reported web copy/paste/send flow.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Evidence
Real web app, Chromium, 1280×800, light theme, fresh synthetic data on both commits. Open assistant citations → Copy message → Ctrl+V into composer → Enter.
Proven: the scenario fails on base and passes on head. Base adds struck-through final.txt beside the chip; head sends both literal filename chips and preserves the destination.
Scenario source
The head composer still visually strikes through double tildes inside the raw destination; the escaped label and sent message are correct. Single tildes displayed literally on both commits.
Not shown:
- External Markdown applications were not exercised; this proof covers T3's web copy, paste, and send flow.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:XS
0-9 changed lines (additions + deletions).
vouch:trusted
Author is trusted by repo permissions or the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|