Repository navigation
fix(chat): render Codex file citations - #2612
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
| Layer / File(s) | Summary |
|---|---|
Citation validation and scanning shared/markdown.ts, src/lib/markdown.test.ts |
The inline scanner recognizes citation directives that close on the same line. Attribute validation rejects malformed, duplicate, or unsupported values. Scan tests cover citation openers and closing braces. |
File-node conversion and rendering shared/markdown.ts, src/lib/markdown.test.ts, changelog.d/codex-file-citations.md |
With inline marks enabled, valid citations become file nodes with the cited path and basename. Tests cover supported paths, invalid and code-form citations, and rendering through the file opener. The changelog records the behavior. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Possibly related PRs
- devswha/ovis#2220: It moved the Markdown parser and file-link handling into
shared/markdown.ts, which this change extends.
Suggested reviewers: devswha
Merge Risk: 
Minimal · previous review 7ea51
-
Unsupported citations containing a brace and Markdown characters can still be formatted, but no merge-blocking regression was established.
Pre-merge checks: 
5
-
Full details: Linked Issues check
-
Explanation
Issue [
#2611] requires actionable file links for Codex local document and PDF citations.shared/markdown.tsrecognizes complete:codex-file-citation{...}tokens and converts valid absolutesourceandoutputpaths to the existingfilenode. Invalid, incomplete, non-local, live, and code-form citations remain text or code.src/lib/markdown.test.tscovers citation parsing and existing file-opener rendering.
Full details: Out of Scope Changes check
-
Explanation
The changes stay within issue [
#2611]. The parser change implements citation rendering, the tests verify valid and unsupported cases plus file-opener output, and the changelog documents the fix. No unrelated product behavior is changed.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.)
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
…ly when it is well formed A citation path is held to the same rule as a file:/// link: an absolute local path, never a network share (however its separators are written, JSON escapes included) and no control character, DEL included. Only a well-formed directive is a token now, so an unfinished one no longer swallows the markdown or a valid citation after it, and a brace inside a quoted value no longer ends it. Tests fail on 7ea51bd.
|
Thanks @cheol-95. Review (omo + Codex Terra) found three things, fixed on your branch in 73f4eab:
|
… end it A directive whose value holds an escape JSON cannot read is no token, so the markdown inside it stays markdown; spaces or tabs before the closing brace no longer leave a valid citation as text.
|
Codex Terra's check of 73f4eab confirmed those three, and found two small parsing gaps that were already in the first commit; fixed in cf76d15: a value holding an escape JSON cannot read ( |
|
Thanks @cheol-95, this fixes #2611: on main a Codex citation such as Merge-pass checks:
|
Change
Codex document skills return
:codex-file-citation{...}for generated files, but Ovis chat displayed the directive as text. Parse localsourceandoutputcitations into Ovis's existing file links, so the viewer can open the file or offer its download. Existing conversation text is unchanged, and code examples and incomplete or unsupported directives remain readable.This follows the Codex document skills' file-citation output and uses Ovis's existing file-link presentation rather than adding another artifact UI. Live artifact references are left as text; source locators such as page numbers are not used for navigation. Directives containing
}inside an attribute value are also left as text.Closes #2611
Validation
bun test src/lib/markdown.test.ts: 55 passed. Covers output and source citations, Unicode and spaced paths, Windows paths, inline and fenced code, invalid/incomplete directives, and the existing file-button rendering.bun run check faston macOS (Bun 1.4.2): generated types/themes, typecheck and build passed. Unit suite did not pass: 10,360 passed, 28 failed, 264 skipped across 660 files. Failures include socket teardown (ENOTSOCK), installation, process and platform-specific tests. One unrelatedserver/usage-login-private.test.tsprocess was manually terminated after it did not finish (exit 143; no result). The new Markdown suite passed in that run.