Repository navigation
fix(tlon): bare URLs and images after text lose rich formatting - #164828
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 7, 2026, 11:33 AM ET / 15:33 UTC (Revision 6). ClawSweeper reviewWhat this changesThe PR repairs Tlon’s Markdown converter so URLs and images after text retain native formatting, including images inside headings, quotes, and styled text. Merge readiness✅ Ready for maintainer review This PR remains necessary: current main still has the reported formatting defects. The latest head resolves the previous parenthesis-depth finding, and no remaining actionable correctness defect was found. Priority: P2 Review scores
Verification
How this fits togetherTlon’s outbound converter turns Markdown messages and media captions into native rich-text payloads. Direct-message and group-message senders forward those payloads to the configured Urbit ship. flowchart TD
A[Messages and captions] --> B[Markdown converter]
B --> C[Recognize URLs and styles]
B --> D[Extract native image blocks]
C --> E[Tlon story payload]
D --> E
E --> F[Direct and group senders]
F --> G[Urbit ship]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +55, Tests +100. Total +155 across 2 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep one Tlon converter that consistently emits native links and image blocks for all outbound text and captions. Do we have a high-confidence way to reproduce the issue? Yes: current-main source establishes the token-consumption and nested-image defects, and the supplied production converter traces demonstrate the affected inputs. This read-only review did not execute them. Is this the best way to solve the issue? Yes: repairing the existing shared converter is the narrowest solution, and balance-aware trailing trimming resolves the previous finite-depth regression without another formatting owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7a8e5a19b68b. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
a6c7896 to
43b165a
Compare
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Fixed in 150531d.
🤖 Written and posted by an AI agent (Claude Code) on behalf of @jayzhou2309. |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Fixed in 0346f78.
🤖 Written and posted by an AI agent (Claude Code) on behalf of @jayzhou2309. |
|
Landed in bcc3b58. Thanks @jayzhou2309! Verified through the real Tlon send path against a mock ship: all 10 URL/image cases now produce native link and image blocks, and plain-text controls are unchanged. |
…claw#164828) Convert bare URLs and images that follow text in outbound Tlon messages into native link and image blocks in the Urbit story, in DMs and groups, including after headings, quotes and bold text. Plain text and other formatting are unchanged. Fixes openclaw#164784. Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #164784
What Problem This Solves
Fixes: Tlon messages lose rich formatting when a bare URL or a Markdown image follows other text on the same line. The URL is sent as plain text, and the image is sent as a literal
!followed by a link. An image inside a heading, quote, or bold, italic, or strikethrough text is sent as an internalimageBlockmarker that is not a valid story inline.User Impact
User impact: Tlon DMs, group posts, and media captions now show a bare URL as a link and a Markdown image as a native image block wherever it appears in the line. The text around the image keeps its heading, quote, or style.
Why This Change Was Made
markdownToStoryinextensions/tlon/src/urbit/story.tstries its inline rules at the cursor in order. The plain-text fallback consumed the scheme letters ofhttps://and the!of, so the URL and image rules could only match at the start of a run. The fallback now stops at!and at ahttp://orhttps://start. Since bare URLs now match in running prose, the URL rule also stops before trailing sentence punctuation, sosee https://example.com/a.linkshttps://example.com/a. A closing paren stays in the URL only when it balances an opening paren inside the URL, sohttps://en.wikipedia.org/wiki/Function_(mathematics)keeps its)while(see https://example.com/a)leaves the prose paren outside the link. An unmatched)foll…Images were hoisted to blocks only from direct paragraph children.
hoistImageBlocksnow moves image markers out of bold, italics, strike, and blockquote content at any depth and drops a style left empty. Paragraphs, list fallback text, headings, and quotes all go through it, and each emits its image blocks after its own verse, as paragraphs already did. A heading or quote that held only an image becomes just the image block. List items with images still fall back to paragraph text, as before.The existing list test "preserves images inside list items as plain story content" pinned the old
- !plus link output. It now expects-followed by the native image block.Evidence
test(tlon)commit a08e2566a67 adds two bare URL cases (after text, and before trailing punctuation) and six image cases (after text, heading with text, image-only heading, quote, bold, nested in a list item) toextensions/tlon/src/urbit/story.test.ts. On upstream/main a6b9da2: 8 failed, 47 passed. On fix afe081343c3: 55/55 pass.pnpm test extensions/tlon: 39 files, 368 passed.pnpm tsgo:extensionsandpnpm tsgo:extensions:testexit 0.scripts/run-oxlint.mjsexit 0 andoxfmt --checkclean on both changed files.story.tsfrom main and from the fix:Function_(mathematicsand the)is left as text). A second-model review of that commit found two edge cases, fixed in a6c78969374 with two more tests that fail on 215141ab073: punctuation before a stray paren stayed in the link (https://example.com/a:( sadlinkedhttps://example.com/a:), and an unmatched)mid-URL cut the URL short (https://example.com/?q=a)b). On a6c78969374:pnpm test extensions/tlon/src/urbit/story.test.ts --maxWorkers=158/58 pass in 0.5s (1.1s wall),pnpm test extensions/tlon/src/urbit/send.test.ts --maxWorkers=15/5,pnpm test:extension tlon…The URL pattern's alternatives start on disjoint characters, so it does not backtrack. 15,000 repeats of each of
(,),.,(a,a(,.(,)(,(.,).after the scheme each convert in under 1 ms.https://example.com/a(b(c)d)keeps its last)as main does. The new test "keeps nested balanced parentheses inside a bare URL" fails on 43b165a (1 failed, 58 passed) and passes on 150531d (59/59). On 150531d:pnpm test:extension tlon37 files 327 passed,send.test.ts5/5,pnpm tsgo:extensionsandpnpm tsgo:extensions:testexit 0,scripts/run-oxlint.mjsexit 0,oxfmt --checkclean. 15,000 repeats of each of(,(a,((a,((a),(((,)(,(.,((((b),a((b))c,(()after the scheme each run through the URL pattern in under 1 ms (worst 0.21 ms). Groups nested three deep still end early. The sam…Not verified: delivery to a live Urbit ship and rendering in a Tlon client. The output uses only the
linkinline andblock.imageshapes the converter already emits for a leading URL and a standalone image.AI disclosure: an AI agent (Claude Code) reproduced the issue, wrote the test and the fix, had a second model review the diff, and ran the gates above:
pnpm test extensions/tlon/src/urbit/story.test.ts,pnpm test extensions/tlon,pnpm tsgo:extensions,pnpm tsgo:extensions:test,scripts/run-oxlint.mjs,oxfmt --check, and the converter driver above.🤖 Written and posted by an AI agent (Claude Code) on behalf of @jayzhou2309.
Maintainer verification
No overlap with Pash/Sarah changes.
Verified the real Tlon plugin outbound adapter through HTTP login and poke requests against a loopback mock Urbit ship, on current main
2f1f73ccb2224bbe7d961b4c0d3b29cfdd51e7f8(including a second real send run) and this head0346f78159c4837e97f1e0a78dc78d1828586864. Both DM and group pokes reproduce plain-text bare URLs and broken image links on main. The candidate emits native links and image blocks, preserving heading, quote and bold context; plain text, bold/italic/strike/code and explicit Markdown-link controls are unchanged. 16 payload comparisons passed (10 corrected cases, 6 unchanged controls).Focused story suite: 61 tests passed, 2.57s wrapper wall time (1.68s Vitest); changed converter passed scoped real tsgo. CI cost was not separately measured. One real gpt-5-mini call (low reasoning, 4096 output-token budget) completed; its output was sent through candidate DM and group adapters with native links in both captured pokes. No real Urbit ship or client rendering is claimed.
Merge danger: two-way door; reverting restores the old converter. No state migration. Blast radius is Tlon outbound Markdown stories and media captions.