Skip to content

fix(web,mobile): render Codex citations and artifact templates - #219

Merged
rynfar merged 2 commits into
pylonfrom
upstream/2026-08-31-codex-citations
Aug 31, 2026
Merged

rynfar merged 2 commits into
pylonfrom
upstream/2026-08-31-codex-citations

Conversation

@rynfar

@rynfar rynfar commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Codex emits file citations and artifact templates as markdown directives. Pylon
rendered the raw directive syntax, so a Codex answer that cited a file showed the
markup instead of a link, and artifact templates were unusable.

Adds three client-runtime modules — a directive parser, file-citation resolution,
and artifact-template presentation — and wires them into web ChatMarkdown and the
mobile thread feed. Citations become links into the file viewer; artifact templates
render as an affordance that appends the template's prompt to the composer.

Adopted from upstream pingdotgg/t3code#8584 (c1e70b5f8). Brings five new
dependencies (unified, remark-parse, mdast-util-directive, micromark-*).

Adaptation — five conflicts, three of them dependency artifacts. Upstream merged
this after #8793 and #8807, so its diff carries pieces of both:

  • ThreadFeed keeps Pylon's renderer rather than upstream's Animated.View
    disclosure wrapper. THREAD_FEED_DISCLOSURE_* and disclosureEnteringEntryIds
    come from #8793 and do not exist in Pylon; only the artifact-template callback
    is added.
  • MessagesTimeline keeps Pylon's local commandProgramName (line ~2466) instead of
    importing client-runtime/work-log/command-label, a subpath #8793 introduces.
  • The onImageExpand prop upstream threads through ChatMarkdown belongs to #8807,
    which lands separately in fix(web): open agent images in the expanded preview #212. Dropped here so the two do not collide.
  • Import blocks and Pylon's NOOP_OPEN_ATTACHMENTNOOP_DOWNLOAD_ATTACHMENT
    rename are merged Pylon-first.

Verified: vp test run --dir packages/client-runtime for the three new modules
(45 passed); --dir apps/web ChatMarkdown, ChatView.logic,
MessagesTimeline.logic, markdown-clipboard (156 passed); typecheck clean on
@t3tools/client-runtime, @t3tools/web, and @t3tools/mobile.

Not exercised against a live Codex turn, on either client. Worth a real-client
pass before merge.

Reviewed and integrated with Claude Opus 5 in Claude Code.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XL labels Aug 31, 2026
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ The exact PR base did not have a successful artifact. Baseline uses the latest successful main measurement shown below.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.5 KiB 13.5 KiB −19 B (−0.1%) 15.1 KiB
Codex Thread snapshot wire 6.9 KiB 6.9 KiB +6 B (+0.1%) 7.3 KiB
Codex Live turn WebSocket wire 6.6 KiB 6.6 KiB −25 B (−0.4%) 7.8 KiB
Codex Live turn WebSocket decoded 57.2 KiB 57.1 KiB −44 B (−0.1%) 66.4 KiB
Codex Live turn messages 10 9 −1 (−10.0%) 21
Claude Total thread wire 13.5 KiB 13.6 KiB +58 B (+0.4%) 15.1 KiB
Claude Thread snapshot wire 6.9 KiB 6.9 KiB +3 B (+0.0%) 7.3 KiB
Claude Live turn WebSocket wire 6.6 KiB 6.6 KiB +55 B (+0.8%) 7.8 KiB
Claude Live turn WebSocket decoded 58.0 KiB 58.1 KiB +44 B (+0.1%) 66.4 KiB
Claude Live turn messages 9 10 +1 (+11.1%) 21

Baseline: 5e3fd47 · PR result: 43c4aee · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 109.5 KiB
  • Claude decoded thread snapshot: 110.2 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@rynfar

rynfar commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

Adversarial review pass found two issues, both fixed in the follow-up commit:

  1. Six dead imports (ChatAttachment, ChatFileAttachment, ChatImageAttachment, resolveAssetUrl, formatAttachmentSize, squashAtomCommandFailure) carried in from upstream's attachment work, which this branch does not adopt. Three were value imports that would have entered the Metro bundle. Removed.

  2. Mobile "Copy message" copied raw directive markup (::artifact-template{…}, :codex-file-citation{…}) while the same message rendered as a card or link. Web already copies the rendered form via renderCodexDirectivesForCopy in MessagesTimeline.logic; mobile now does too. Upstream has the same gap, so this is a Pylon-side improvement rather than a port regression.

Re-verified: @t3tools/mobile and @t3tools/web typecheck clean, vp lint clean on the touched file.

@rynfar
rynfar force-pushed the upstream/2026-08-31-codex-citations branch from e3b8e24 to 24a0e67 Compare August 31, 2026 20:47
Yash-Singh1 and others added 2 commits August 31, 2026 14:50
Adapted for Pylon: five conflicts. Pylon's ThreadFeed renderer is kept rather
than upstream's Animated disclosure wrapper, which belongs to #8793 and is not
adopted here; only the artifact-template callback is added. MessagesTimeline
keeps Pylon's local commandProgramName instead of importing the client-runtime
work-log subpath #8793 introduces, and the onImageExpand prop upstream threads
through here belongs to #8807, which lands separately. Import blocks and the
NOOP_DOWNLOAD_ATTACHMENT rename are merged Pylon-first.

(cherry picked from commit c1e70b5f8c93428c1fe7af62f24ee6ff2bffff6e)
Review follow-ups on the #8584 port. The mobile thread feed carried six
imports from upstream's attachment work, which this fork has not adopted;
three were value imports that would have entered the Metro bundle.

"Copy message" also copied raw directive markup while the same message
rendered as a card or link. It now copies the rendered form through
renderCodexDirectivesForCopy, matching what web already does in
MessagesTimeline.logic. Upstream has the same gap on mobile.
@rynfar
rynfar force-pushed the upstream/2026-08-31-codex-citations branch from 24a0e67 to 43c4aee Compare August 31, 2026 20:50
@rynfar
rynfar merged commit 35b8380 into pylon Aug 31, 2026
19 checks passed
@rynfar
rynfar deleted the upstream/2026-08-31-codex-citations branch August 31, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL vouch:trusted PR 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