Repository navigation
Fix unreadable code blocks across workspace themes - #7305
Conversation
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; reasoning_effort=max (active_turn_verified=true).
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机
在聊天、原 Agent 记录或完整答复中阅读命令和代码的用户,需要直接看清原文并保留本地滚动。 标准主题把代码面板设为近黑色,但子代码仍固定深灰,命令几乎看不清;现在代码使用面板完整配色,标准与高对比主题显示清晰浅字,纸张主题保留可读深字。 同一冻结打包场景中,主干代码对比度只有1.543:1;此head的三个主题在桌面和390px均达到13.998:1以上,原文、选择和代码自身横向滚动继续可用。 本次交付共同 Markdown 代码区的可读性,不改消息、原会话身份、模型、权限、排队、分析或执行规则。 安装后真实 WebView 采用仍须单独回读;完整研究工作台、长工具记录及真实输入法等累计验收继续沿原任务推进。
改动思路
同一个 MarkdownText 已服务聊天、原会话和完整答复,缺口位于共用样式的父子颜色冲突;让子代码继承面板配色并合并重复默认规则即可,不需要另一套渲染器或主题配置。 本 PR 只修改共同代码区配色和既有完整答复场景,保留原解析、字号、原文和读回路径。 不能把所有代码一律改成浅字,否则纸张主题和完整答复的浅色面板会失去可读性。现有主题已经选好了代码面板的前景与背景;真正多余的是子元素再固定一个深色。保留原主题选择,让子元素读取面板颜色,同时把重复的通用代码区默认值收回一处。输入、来源、回执和解析继续使用原所有者,样式修复没有新的模型调用、排队或用户确认轮次。
| 阅读状态 | 以前 | 此head |
|---|---|---|
| LoopX深色代码区 | 对比度1.543:1,深字难读 | 浅字17.176:1 |
| 纸张主题 | 浅底深字 | 使用原主题正文色,13.998:1 |
| 高对比主题 | 子代码仍固定深色 | 完整面板配色17.332:1 |
| 完整原文与操作 | 原样解析和独立滚动 | 保留原文、字号、选择、局部滚动与返回 |
具体改动
规范基准为 docs/development/design.md,版本 d8de1cf5c490f7fa077d43cb23e3c1280773035b,尤其代码区、可访问性和真实内容整页评审;完整路径同时遵循既有前端交付合同。readable-code-pair 已实现:实际子代码和背景比较,三个既有主题与两种视口均高于AA最低值。original-content-and-scroll 已实现:完整未换行命令仍可选择并在代码区滚动,正文和宽表格保持原行为。populated-reader-review 已实现:真实编译页面的长中英内容、来源失败、完整答复和十张前后图分开检查计算值与实际像素。规范未被修改以接受旧失败。
关键代码讲解
- 共同代码样式 中保留代码区的字体、空白和独立滚动,并为通用面板明确正文色;下一行的子代码继承面板前景。原来的两个重复默认规则被删除,已有主题选择器继续拥有深浅配色。行内代码规则没有跟着改成浅字,避免纸张和普通正文出现反例。
- MarkdownText 的实现没有变化:已有代码块仍将完整
block.text放入同一pre/code,消息、原Agent记录和独立答复共用它。这里没有重新解析、翻译、压缩或用摘要替代原内容;源链接及HTML文本的既有安全边界不变。 - codePresentation 从实际渲染的子代码和背景计算相对亮度,而非断言某个主题必须等于某个新十六进制值。它同时检查行内代码、字号与选择能力,因此既能暴露旧的父子颜色冲突,也不会只因父元素颜色正确就宣布通过。
- answerPresentationScenario 扩展原有完整答复场景:原三主题逐个读回,在1512和390px核对完整命令及局部滚动。长正文、表格、公开来源、恶意HTML只作为文本、独立报告、刷新和返回仍完整运行;原会话的真实HTTP/隔离协议peer场景另行通过。截图在字体加载及两个绘制帧之后取样,临时的display:block试验与几何诊断未进入最终产品。
对主干的风险
主要风险是共享样式修好深色区域却损害浅色区域,或者计算值通过但实际字仍未画出来。不可变主干CSS放入相同冻结场景,直接以1.5427低于4.5退出1;恢复此head后,完整场景通过,三个输入来源指纹不变。一次中间窄屏截图确实在计算正确时呈现空代码区,因此没有只据数值批准;排除无效的布局试验后,等待字体和两个绘制帧,再逐张回读最终像素。
两个完整打包场景通过,其中原会话入口55.581秒覆盖原绑定、历史、IME守卫、忙碌/未知回执与恰好一次输入。生产构建、JS语法及31份CSS检查通过;标准premerge的4个直接检查与8个选择检查通过,确切范围CQR有效。原始结果仍保留十张PNG的人工检查项,不能描述为自动全绿。两次CQR证据引用格式错误均未写入回执,修正为返回合同允许的实际路径后才取得有效回执。当前策略不查询或等待CI。没有存储迁移,回滚本提交即可恢复原样式。
我的整体评价
这是 justified_increment:一个真实、共同的代码阅读缺口得到完整打包验证,完整研究工作台和原会话累计验收仍继续。long_horizon 为 preserved,原内容与效果所有者保持,没有token或benchmark效率收益声明;user_experience 在代码可读性范围为 improved。最终桌面和390px视图中,深色代码区的命令前缀可清楚辨认,浅色主题仍有明确层次;正文、长行内标识、表格和输入框维持原结构,代码只在自身区域横向滚动;这是常显配色修复,没有新增展开区,既有桌面和窄屏均已核对。 截图与计算来自编译生产页面和公开合成内容;原会话集成使用真实HTTP所有者及隔离原宿主协议peer。它们不等同安装后WebView、真实账号发送或真实输入法验收,也不证明整个研究工作台已重设计。 新增内容局限于既有测试的诊断与压力场景,生产没有新状态或词汇所有者。
English verdict: APPROVE at c41f2d67716a84ad737178bd075f262843bd9ade. The shared code block now owns a complete theme-aware color pair; full content, typography, selection and isolated scrolling remain. Frozen base/head, three themes at two widths, complete answer/report/Goal and original-host journeys, manual pixels and declared local validation support this bounded fix. Native post-install adoption and broader workbench acceptance remain separate.
Goal And Delivered Outcome
Fenced code was dark text on a dark panel in the standard and high-contrast workspace themes. The child
coderule fixed its own foreground, defeating the theme's foreground onpre. This affected the shared renderer used by conversations, original Agent records and saved answers.Give the code panel one complete color pair and let its child inherit it. Consolidate only the duplicate code-block defaults; retain complete text, existing typography, selection and isolated horizontal scrolling. No extra explanatory copy or settings are introduced.
Author Declaration
docs/development/design.mdatd8de1cf5c490f7fa077d43cb23e3c1280773035b, especially Code And Terminal Surfaces, WCAG AA and Populated Page Review; companiondocs/development/frontend-delivery.md.Validation
answer-presentationjourney. Three existing themes × desktop/narrow pass; inline-code contrast remains6.883–14.214:1.attached-host-follow-uppasses55.581s through the existing original-host HTTP/native protocol peer, including history, input/IME guards, exact binding and uncertain receipt recovery. No real account messages were sent.cqr_7f6a0e7ca6c71e6d57aepasses. Raw premerge retains ten PNG manual-review holds; all ten pixels and metadata were separately inspected. CI is not queried or awaited under the resolved policy.Visual Evidence
Tested source:
c41f2d67716a84ad737178bd075f262843bd9ade. These are the production Chat bundle with public synthetic conversation/runtime responses; the original-host integration separately uses disposable File/SQLite state and a synthetic native protocol peer. They are not actual account screenshots. The temporary preview server exits with the runner.The same reading surface keeps its content and controls; command text now stands out against the panel. Long inline identifiers still wrap, fenced code scrolls within its own box, and the original source/failure state stays visible. A contrast check alone did not establish the pixel verdict.
Risks And Limits
The shared stylesheet reaches multiple existing Markdown consumers. The full answer, saved report, Goal Chat and original-reader journeys cover content/layout and effect parity; inline code and theme selection remain separate. There is no storage or permission migration. Reverting this commit restores the prior style.
Post-change native WebView adoption is a separate readback; no full-workbench redesign, real IME execution or long-horizon efficiency benefit is claimed here.