Skip to content

fix(workflows): freeze settled transcript cards - #97

Closed
tt-a1i wants to merge 2 commits into
mainfrom
codex/freeze-workflow-history-spinner
Closed

fix(workflows): freeze settled transcript cards#97
tt-a1i wants to merge 2 commits into
mainfrom
codex/freeze-workflow-history-spinner

Conversation

@tt-a1i

@tt-a1i tt-a1i commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

问题

Workflow V2 默认 detached 后,工具调用已经 settled,但对应 run 仍可能在后台执行数分钟。历史 transcript 卡片此前仍然:

  • activeRuns 读取实时状态;
  • 每 120ms 建立 spinner timer 并调用 context.invalidate()
  • 在其他组件触发全局 repaint 时继续用 Date.now() 改变 spinner 和 elapsed。

在 Pi regular 模式中,viewport 上方旧行发生变化可能触发 fullRender(true),继而用 CSI 3J 清除终端 scrollback,表现为无输出时闪烁、上滚阅读位置突然丢失。

修复

  • 只有 isPartial 的当前工具调用读取 live run、更新 spinner 和 elapsed;
  • 已 settled 的工具结果只渲染返回时携带的 details;
  • settled card 固定同一个渲染时间快照,不再因底部 strip/dashboard 的全局 repaint 改变;
  • 实时进度继续由 below-editor strip、/workflows dashboard 和 completion follow-up 表达。

回归覆盖

新增真实 detached Workflow e2e:

  1. 后台 run 保持 active;
  2. launch receipt 已进入 settled transcript;
  3. 跨多个 spinner cadence,历史卡 invalidate 必须为 0;
  4. run 完成并投递 follow-up 后,再次渲染历史卡必须与 launch 时逐行相同;
  5. 原有 partial card 测试继续证明当前工具调用仍按共享 cadence 动画。

验证

  • bun run check
  • bun run test:861 Node + 30 Vitest 全通过
  • 新增专项 e2e 连续运行 3 次通过

Fixes #96

Detached runs kept their settled tool cards bound to live state and wall clock animation. That changed historical rows on every global repaint, which can force Pi regular mode to clear terminal scrollback. Keep partial cards live while freezing settled cards and cover the detached lifecycle end to end.
@tt-a1i

tt-a1i commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator Author

补充真实 Pi TuiMainScreen 差分验证(regular 模式,80×6 viewport):

同一个 detached running Workflow 历史卡放在 viewport 上方,底部 live strip 每 140ms 变化一次,共重绘 6 次。

runtime full redraws CSI 3J clear scrollback 历史卡稳定
修复前 Workflow V2 7(含首次) 6
PR #97 / 9e42609 1(仅首次) 0

另外 execute-level e2e 覆盖了真实 active run:settled launch receipt 跨多个 spinner cadence 的 invalidate 为 0,run 完成并投递 follow-up 后历史卡仍逐行不变。

因此修复同时切断了两条链路:历史卡自己的 timer invalidation,以及底部 live UI 触发全局 repaint 时历史卡读取 wall clock/live state。

@tt-a1i

tt-a1i commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for documenting and validating this failure mode. The same root cause was addressed by #104, which is now merged into main with regression coverage, so this PR is no longer needed. Issue #96 can remain open for the outstanding Ghostty and regular-mode smoke verification.

@tt-a1i tt-a1i closed this Aug 26, 2026
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.

Workflow 后台运行时历史工具卡持续动画可触发 Pi regular 全量重绘,用户上滚位置丢失

1 participant