Skip to content

fix(desktop,markdown): active while a child runs; keep currency out of inline math - #1580

Merged
huichen merged 3 commits into
mainfrom
fix/desktop-and-markdown
Nov 10, 2026
Merged

huichen merged 3 commits into
mainfrom
fix/desktop-and-markdown

Conversation

@huichen

@huichen huichen commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

两个独立修复,摘成一条分支先送 main——它们本来挂在 dev-huichen 上,而那条分支带着 0797d2a2a(改 .github/workflows/ci.yml),
当前 PAT 没有 workflow scope,整条分支推不上去。这两个提交都不碰 workflow 文件,所以单独成支可以立刻落地。

1. fix(desktop): file a conversation under Active while its child session runs

问题:桌面端 recentSplit() 只看每行自己的 run 状态,而子会话在桌面是画在父会话折叠里的、不占行。
于是父会话留在「更早」,它唯一在动的活儿(worker 子会话)又看不见 —— 看起来全静止。TUI 的 最近 不折叠,所以没这问题。

改法:recentSplit() 改看 recentTree,一条会话只要有自己或任意一层子会话在跑(running / queued / waiting_approval)就进「活跃」;
新增 inFlightRowKeys() 供 ActivityRail 的页窗口过滤,把「因 worker 而活跃」的子树留在列表里(否则长 goal run 的父会话会因 last_message 掉出 30 条窗口而缺席);远端行同规则。

验证:5 个新/改断言(父会话被 worker 提升、隔一层 grandchild、页窗口未覆盖仍保留、远端机器、worker 自身不占行);
证伪:去掉提升规则 4 个失败、去掉窗口保留对应那个失败。桌面全套 vitest run 423 文件 / 5973 用例全绿,tsc --noEmit、eslint 通过。

2. fix(markdown): keep currency amounts out of inline math

问题:remark-math 把 $0.20/$0.60 之间的散文当行内公式,KaTeX 一排版整段塌成一串小字(实测最近 40 个会话正文,12 处"行内公式"全是金额)。

改法:micromark 层新增 remarkCurrencyMath,只认领「紧贴数字的 $」这两个字符、不做配对 ⇒ $10 买到的是**一份 $100 额度** 里的 **…** 仍走正常强调解析。
已知取舍写进注释:$1.5x$ 这类以两位数字开头的行内公式会被当文本;显示公式不受影响。

验证:packages/markdown 679 测试 + tsc --noEmit + eslint 干净;改后同一批正文里误判为公式的 0 处。

回退

单提交各自 revert(9dd89ae7f、c3f7cf53e);两者互不依赖,可分别回退。

A reply that quotes prices — `$0.20/$0.60` — had every span between two
`$` read as inline math by remark-math, so the prose around an amount was
typeset by KaTeX as a formula: a real pricing report produced 13 such spans
and the paragraph collapsed into raised, shrunken glyphs.

Claim a single `$` that is glued to a number (`$10`, `$0.20`, `$1,200`,
and a bare digit followed by CJK prose such as `$5 首月`) as ordinary text,
and leave everything else to remark-math: `$$…$$`, `\(…\)`, `$a+b$` and
`$2^n$` still render. Claiming only the sigil keeps emphasis inside a quoted
amount: `**…**` is parsed by the emphasis pass, not frozen into text.
…n runs

A child session — a fork, or a worker an agent started — is drawn inside its
conversation's fold, so a run under it is work the recent view shows no row
for. The split read only each conversation's own run, so a conversation whose
worker was still producing output sank to "Earlier" while its work moved out
of sight; the phone's recent page already filed it under "Active".

The split now ranks a conversation by its own run or by any run under it, and
the page window keeps those rows: a long goal run speaks through its worker,
so the conversation itself can be older than the page. The promotion brings the
conversation's whole subtree with it, which is also what an opened fold draws.
@huichen
huichen enabled auto-merge (squash) November 10, 2026 02:51
@huichen
huichen merged commit b89ab49 into main Nov 10, 2026
14 checks passed
@huichen
huichen deleted the fix/desktop-and-markdown branch November 20, 2026 01:10
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.

1 participant