Skip to content

fix(presentation): preserve parentheses in Markdown links - #5942

Merged
huangruiteng merged 2 commits into
loopx-project:mainfrom
mikamikasuki:codex/loopx-markdown-parentheses
Oct 8, 2026
Merged

huangruiteng merged 2 commits into
loopx-project:mainfrom
mikamikasuki:codex/loopx-markdown-parentheses

Conversation

@mikamikasuki

@mikamikasuki mikamikasuki commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Goal And Delivered Outcome

  • Outcome basis / optional anchor: A reproducible Dashboard Markdown rendering defect; the contribution guide does not require a separate issue for this scoped fix.
  • Goal/source and gap: The personal-workspace MarkdownText renderer stopped a named Markdown destination at the first closing parenthesis. URLs with balanced parentheses were truncated, leaving the final parenthesis outside the link.
  • Observable before → after: At baseline 412ba81, Topic rendered with the href ending at Reference_(mathematics and the final ) outside the anchor. The parser now consumes balanced, including nested, parentheses and keeps the complete destination linked. A following plain URL remains a separate link.
  • Issue/task and intended base: Self-contained fix; no separate issue is required. Current intended base is main at a1890a3.

Author Declaration

  • Written by: model_agent — OpenAI GPT-6 Luna.

Implemented against

  • Specification and revision: The reproduced renderer behavior is the acceptance basis. The original baseline was 412ba81; current main is a1890a3. The parser and smoke-test sources relevant to this reproduction are unchanged between those revisions.
  • Criteria:
Criterion Disposition Symbol / path Test or command
Named HTTP(S) Markdown destinations preserve balanced parentheses implemented nextMarkdownLink and renderInline in apps/presentation/dashboard/src/features/personal-workspace/markdown.tsx pnpm run smoke:team-report
Nested parentheses are retained and a following plain URL remains separate implemented renderInline pnpm run smoke:team-report
  • Self-check before submission: Reproduced the truncation on the exact original baseline and confirmed the relevant parser and smoke sources are unchanged through current main. Reviewed the implementation, regression smoke, screenshots, and final diff. Current PR head 0ef11d2 contains the parser fix and evidence assets.

Scope And Continuation

  • Completed scope and remaining work: The Dashboard conversation renderer retains balanced and nested parentheses in named Markdown link destinations. This change is complete within the stated scope.
  • Slice boundary / successor: No follow-up slice is required for this defect.

Validation

  • Tested revision: PR head 0ef11d2, based on current main a1890a3. The parser fix is commit 75341cc.
  • Run state: Focused smoke, type check, production build, and diff check finished; the full repository pre-merge canary was not rerun after the rebase.
  • Input classes: Synthetic.
Check kind Result Public-safe evidence / limitation
regression_parity passed On a clean worktree at exact original main 412ba81, three independent pnpm run smoke:team-report runs failed at the balanced-parentheses assertion: the href ended at Reference_(mathematics and the closing ) remained outside the anchor. The relevant parser and smoke sources are unchanged through current main a1890a3. The regression passes on this PR head.
unit passed pnpm run smoke:team-report passed on PR head 0ef11d2, covering balanced and nested links, adjacent URL separation, safe links, inert HTML, and chat parity.
static passed pnpm exec tsc --noEmit passed; pnpm run build:desktop passed TypeScript checking and the production Dashboard build (Vite emitted a chunk-size advisory); git diff --check origin/main...HEAD passed.
integration not run The repository pre-merge canary was not rerun on the rebased head.
  • Coverage and gaps: The synthetic smoke exercises the production MarkdownText renderer and checks the affected output plus existing link-safety behavior. Full CommonMark syntax remains outside this renderer's supported subset.

Frontend / Visual Evidence

  • UI impact: changed.
  • Before: The synthetic capture shows the final parenthesis rendered outside the link.
  • After: The synthetic capture shows the complete balanced destination linked.
  • States and viewports shown: Synthetic personal-workspace conversation message, desktop viewport, 1440 × 900.
  • Source data: Synthetic.
  • Attention review: The change preserves the intended link destination without changing layout or controls. The smoke continues to cover safe-link filtering and inert HTML. The renderer source and directly imported styles used for these captures are unchanged from their capture baseline through current main.

Before: the closing parenthesis is rendered outside the Markdown link

After: the full balanced URL is rendered as one Markdown link

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring (no functional changes)
  • Documentation update
  • Test update

LoopX Area

  • Control plane (goals, todos, quota, scheduler, registry, runtime)
  • Benchmark boundary (adapters, runners, verifiers, scoring, evidence)
  • Capability or extension (providers, adapters, skills)
  • Public docs or presentation surface (README, protocols, dashboard)
  • Build, packaging, installer, or CI
  • Host or runtime integration

Technical Direction

  • Direction / acceptance reference: N/A; this is a self-contained renderer defect outside a technical-direction milestone.

Shared-authority RFC fixture impact

  • Production-scale fixture schema: N/A; no shared-authority schema changed.
  • Semantic dimensions changed, or reviewed no-impact rationale: N/A.
  • Provider conformance arms run: N/A.
  • Read-only legacy/file/PostgreSQL three-arm rehearsal: N/A.

Boundary Checklist

  • The diff, body, and attachments contain no private state, credentials, raw traces, internal links, or local paths.
  • This change does not duplicate maintainer-owned benchmark work.
  • The change is scoped to the reproduced renderer defect.
  • Visual evidence is included for the UI change.
  • Every commit includes a DCO Signed-off-by trailer.

Signed-off-by: mika <211269698+mikamikasuki@users.noreply.github.com>
Signed-off-by: mika <211269698+mikamikasuki@users.noreply.github.com>
@mikamikasuki
mikamikasuki force-pushed the codex/loopx-markdown-parentheses branch from 5a0d308 to 0ef11d2 Compare October 8, 2026 07:45

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; reasoning_effort=xhigh

动机

在 LoopX 对话或报告中打开资料链接的用户。 用户打开 Reference_(mathematics) 资料:旧版 Topic 的地址少了末尾括号,候选保留完整地址,并把后面的普通 URL 显示为独立链接。 真实生产渲染器对照复现旧版截断;候选的简单、成对及嵌套括号、粗体、表格和相邻链接正确,打包对话纠正并重载后仍读回完整地址。 不声称支持完整 CommonMark、真实模型采用、本机安装升级或外部网站可达性,也不更改执行权限、调度或持久化协议。

改动思路

复用现有 MarkdownText 和 bare-URL renderer,只在同一模块内替换命名链接边界识别;没有引入另一套 Markdown 框架、状态或权限 owner。 当前 PR 只修复 HTTP(S) 命名链接目的地址中的成对括号,并保留代码、HTML 和相邻链接的既有边界;不扩展为完整 CommonMark 或新的运行配置。 旧正则在第一个右括号停止;简单贪婪匹配又可能吞掉后一个链接。局部深度计数解决这一个实际错误,随后仍按最早出现的位置选择代码、粗体或命名链接;plain URL 继续由既有 linkify-it 处理。来源文本仍由真实 Chat store 保存,页面只生成 React 节点,没有额外网络请求或权限决策。

具体改动

精确 head 0ef11d2ca799e48e8deb0b4972f94a6c9478c327,不可变实际基线 a1890a37f4f759bc2e39823074bbe78f78e49fdb;完整四文件 +63/-8,生产模块 +53/-8,薄 smoke +10,另有两张公开合成插图。没有预先书面规定此命名链接括号语法的规范或关联 issue;本结论依据独立复现的目的地址错误与现有安全渲染调用者,不把作者自述当成已接受规范。

关键代码讲解

  1. nextMarkdownLink :47:识别非空、最多120字且无换行的 label,目的地址必须 HTTP(S),遇空白停止;内部左右括号计数,到深度为零的外层关闭位置返回完整 span。
  2. renderInline :82:与原代码/粗体 token 比较起点,早到的 token 优先;链接去掉外层分隔符生成 anchor,粗体递归,后续正文继续安全渲染。代码中的链接不会激活。
  3. renderPlainText :28:原有 bare URL、中文标点与完整 userinfo 判断不变;命名 literal URL 与自动识别目的地具有不同边界,合并成一条贪婪规则反而失去输入含义。

共享调用者包含管家/Goal 对话、timeline、答案报告、team artifact 及 attention detail;没有闲置新 API。两项新增 smoke 分别检查相邻 URL 与嵌套括号。公开 PNG 是合成说明,本评审另外构建并走了真实打包对话。

对主干的风险

独立同输入生产渲染器 oracle 共12组:基线7通过、5组有意暴露截断,候选12通过;覆盖简单/相邻/嵌套、粗体、表格、代码/fence、中文标点、raw HTML、非HTTP协议及长userinfo。候选没有吞掉相邻链接,也没有改变自动userinfo截断防护。

真实隔离 Chat HTTP/store 加脚本模型响应中,普通请求读回完整 Topic 地址;键盘发送嵌套纠正、打开完整对话、重载并检查390px手机视图,原消息和纠正链接仍存在。模型选择、已安装 App、外部网站访问未验证。全视口保留目标、对话来源、顺序与下一步,没有增加必须重填的信息或确认。

team-report、类型检查/desktop build、Chat bundle build、完整语义词汇检查通过;standard premerge3项直接及11项选定检查通过,无失败、skip、timeout、manual hold或tracked副作用。Vite大chunk提示仍保留。最初私有SSR输出无法解析React,明确补足依赖路径后同模块/同断言两端执行成功;先前读取脚本缺少Path导入也已另行完成,不宣称这些初次工具失败通过。未查询或等待CI。

支持范围仍是现有轻量Markdown子集,不承诺完整CommonMark的转义、title或image语法。未增加opt-in/default-off配置或actor生命周期;本次默认改变是已披露的目的地址修复。解析深度是本地临时值,没有新共享词汇、持久化状态或授权语义。

我的整体评价

APPROVE,goal_achieved:所选链接修复通过实际生产路径和基线反例,user_experience improved、long_horizon preserved。原消息保存和后续纠正/重载保持,机制与错误范围相称。未来变更整理已考虑复用自动URL parser,但命名语法边界不同;现有模块内局部helper足够,无需新框架。复用现有 MarkdownText 和 bare-URL renderer,只在同一模块内替换命名链接边界识别;没有引入另一套 Markdown 框架、状态或权限 owner。 当前 PR 只修复 HTTP(S) 命名链接目的地址中的成对括号,并保留代码、HTML 和相邻链接的既有边界;不扩展为完整 CommonMark 或新的运行配置。 完整CommonMark与真实模型/安装采用仍不在本轮证据内,产品代码由维护者合并。

English verdict: APPROVE - 0ef11d2. Independent production-renderer baseline/head cases reproduce the old truncation and validate full balanced destinations, adjacent URLs and retained safety semantics. Packaged isolated Chat correction/reload and mobile readback passed with a scripted model; native builds and risk checks passed. Full CommonMark, live model adoption and installation are not claimed.

@huangruiteng
huangruiteng merged commit b7cb29c into loopx-project:main Oct 8, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants