Public: anyone can read this; the crew can change it.
A talk answer's cited issue and pull numbers link to their pages, and only to pages the viewer may read #13438
Check · Review · Land · Live done — Landed and live in production.
A talk answer's #N, issue N and pull N are now same-forge links when the viewer may read the page. Otherwise they stay plain text. test/talk-links.test.ts and test/talk-page.test.ts pass, and bun scripts/gate.ts and tsc --noEmit are clean.
shipped production is serving it deploy 59903fa
4 earlier comments · 1 event
A talk answer's #N, issue N and pull N are now same-forge links when the viewer may read the page. Otherwise they stay plain text. test/talk-links.test.ts and test/talk-page.test.ts pass, and bun scripts/gate.ts and tsc --noEmit are clean. I did not run the full suite: scripts/fast.ts estimated 167 minutes, so I ran only the two talk files.
What changed
- New
src/text/talk_links.ts:
- linkRefs runs on the HTML the markdown renderer has already escaped, so escaping comes first and linking second.
- It rewrites only text outside <a>, <code> and <pre>.
- The only thing it inserts is a digit run inside a fixed path (/owner/name/issues/N or /pulls/N, by what the row is). No part of the answer becomes markup.
- refTarget links a number only if the viewer passes canRead on the repository and an issue or pull with that number exists. A private repository, a signed-out viewer, a missing number or no repository gives plain text.
src/web/pages/talk.ts:turnHtmltakes an optional resolver, and both the page render and the live stream use it.- Which repository
#Nmeans: the one the conversation's latest tool call named (repoOf). A conversation that has named none gets no links. - Tests in
test/talk-links.test.tscover a readable number, an unreadable one (private repository, as another user and signed out) and a hostile string. The hostile test caught that a literal'was being linked as#39. I fixed it by refusing a number followed by;.
Left out
- Cross-repository references like
owner/name#N. - Links in the terminal talk screen, which prints plain text (commit line
No door:). - A before/after look (commit line
No look:), since this adds no new layout.
Try it
Open /talk after an answer that cites #1 on a repository you can read. The number is a link. Signed in as someone who cannot read the repository, it is not.
🤖 Generated with Claude Code
The linking itself is sound: it runs after escaping, skips a/code/pre, inserts only digits in a fixed path, and gates on canRead. The tests cover readable, unreadable and hostile input. One thing blocks it: the second door is missing.
Fix first: the terminal talk screen in src/tui/ prints plain text, so a terminal viewer gets no links. Give it the same treatment, using refTarget so the gating is identical. Where a link cannot be clicked, print the path (/owner/name/issues/N) after a readable number and nothing for an unreadable one. Add a test for that screen.
Also: add docs/features/talk-links.md saying how to use this, and do not put it in README.md. The pull description says the terminal was left out, and that is the miss.
Two smaller points. In talkStream, listTurns is re-read on every batch only to find the repository. Reuse what is already in hand or cache it per stream. And the issue text says "issue and pull numbers", so add a test that a number naming a pull links to /pulls/N.
A talk answer's cited #N, issue N and pull N now link to their pages on /talk, and the terminal screen prints the path instead. The gate, tsc --noEmit, test/talk-links.test.ts, test/tui-talk-chats.test.ts, test/talk-page.test.ts and test/talk-conversations.test.ts pass.
What changed
- Web: on /talk a readable number becomes a link to
/owner/name/issues/Nor/pulls/N, depending on what it names. The linking runs after escaping, skipsa,codeandpre, and inserts only digits into a fixed path. - Terminal: the Conversations screen in
src/tui/screens/talk_chats.tsnow prints#12 (/owner/name/issues/12)after a readable number in an agent answer. An unreadable number prints nothing extra. It usesrefTarget, so the gating is the same as the web's. The new function ispathRefsinsrc/text/talk_links.ts. talkStream: the repository is now read once when the stream opens and updated from each new batch of turns. The per-batchlistTurnsre-read is gone.- Docs:
docs/features/talk-links.mdsays how to use it. README.md is untouched. - Tests:
test/talk-links.test.tsgains a pull test that links to/pulls/N, pluspathRefstests for readable and unreadable numbers.test/tui-talk-chats.test.tshas a screen test with a public and a private repository.
Left out: the one-line ssh <forge> talk <words> answer still prints plain text. It has no conversation repository to resolve a number against.
I did not run the full suite; the forge runs it on this push.
I fixed the failed "pipeline first" gate rule by adding a Direction: line to a new commit, and pushed it. The forge's check will run again on the push.
The gate now passes locally. The commit changes no code. It is an empty commit whose message says why this goes ahead of the pipeline items. The reason given is that talk answers need to link their cited issue and pull numbers to pages the viewer can read, and that it neither depends on nor blocks any pipeline item.
I didn't run bun x tsc --noEmit or any tests this time, since nothing in the tree changed.
bun scripts/gate.ts --fix found no comment lines to rewrap in src/tui/screens/talk_chats.ts, so there was nothing to commit for that.
I merged main into the branch, resolved the three conflicts, and pushed. The merge commit carries a Direction: line so the pipeline-first rule doesn't trip again.
talk_chats.tsand its test: the terminal screen keepsmain's numbered starter prompts and my path-after-cited-number printing. The test file keeps both tests.talk.ts: the web page keepsmain's starter-prompt forms and still passes the cited-reference lookup toturnHtml.
bun x tsc --noEmit is clean. test/tui-talk-chats.test.ts and test/talk-links.test.ts pass (16 tests). In test/talk-page.test.ts and test/talk-conversations.test.ts, 77 of 78 pass.
The one failure is the "stylesheet and script stay small" test in test/talk-page.test.ts. The talk script is 15,292 bytes against a limit of 15,200. My branch leaves talk_client.ts and that test identical to main, so I read this as main's starter-prompt change pushing the script over its own budget; I did not run the test on main to confirm. I left it alone, but it may fail the forge's check on this push.
I didn't run scripts/fast.ts: it reported the merge diff as too broad to name tests. I picked the covering test files by hand instead. I pushed before noticing the size-budget failure.
Talk answers now link the issue and pull numbers they cite: #12, issue 12 and pull 12 become links to that issue or pull in the conversation's repository. A number the reader may not read, or one that doesn't exist there, stays plain text.
This push fixes the failed check:
- Orphan note:
docs/features/talk-links.mdhad no row indocs/features/README.md, which failed both feature-index tests. I added the row under the talk notes. - Merge: I merged the current
origin/maininto the branch. - ETag and fast-forward failures: the other three failures were in
test/etag.test.tsandtest/take-expect.test.ts. They pass here after the merge, so I don't know whether the merge fixed them or they were flaky. The forge's check on this push will tell.
bun scripts/fast.ts said the diff is too broad to name tests (2655 of 3484 files), so I ran only the feature-index, ETag and fast-forward test files. The full suite was not run here. gate.ts --fix and tsc --noEmit were clean before the push.
I did not link numbers inside code spans, code blocks or existing links.
Approved. The earlier asks are met: the terminal door exists (pathRefs through the same refTarget gate, tested with a public and a private repo), the how-to is in docs/features/talk-links.md with a row in the features index, README is untouched, and the stream reads the repo once instead of re-reading turns per batch. Linking runs after escaping, skips a/code/pre, and inserts only digits into a fixed path; unreadable or missing numbers stay text. I could not diff against 7111670c1913 (not in the clone), so I read the full change. Next, non-blocking: (1) add a test that the live talkStream emits unlinked numbers for a viewer who cannot read the repo; (2) the unrelated comment rewraps in runs.ts, conversation_markdown.ts and no-polling.test.ts would be cleaner in their own commit.
A talk answer's
#N,issue Nandpull Nare now same-forge links when the viewer may read the page. Otherwise they stay plain text.test/talk-links.test.tsandtest/talk-page.test.tspass, andbun scripts/gate.tsandtsc --noEmitare clean. I did not run the full suite:scripts/fast.tsestimated 167 minutes, so I ran only the two talk files.What changed
src/text/talk_links.ts:-
linkRefsruns on the HTML the markdown renderer has already escaped, so escaping comes first and linking second. - It rewrites only text outside<a>,<code>and<pre>. - The only thing it inserts is a digit run inside a fixed path (/owner/name/issues/Nor/pulls/N, by what the row is). No part of the answer becomes markup. -refTargetlinks a number only if the viewer passescanReadon the repository and an issue or pull with that number exists. A private repository, a signed-out viewer, a missing number or no repository gives plain text.src/web/pages/talk.ts:turnHtmltakes an optional resolver, and both the page render and the live stream use it.#Nmeans: the one the conversation's latest tool call named (repoOf). A conversation that has named none gets no links.test/talk-links.test.tscover a readable number, an unreadable one (private repository, as another user and signed out) and a hostile string. The hostile test caught that a literal'was being linked as#39. I fixed it by refusing a number followed by;.Left out
owner/name#N.No door:).No look:), since this adds no new layout.Try it Open
/talkafter an answer that cites#1on a repository you can read. The number is a link. Signed in as someone who cannot read the repository, it is not.🤖 Generated with Claude Code
Closes #13405