Skip to content

fix(workflows): bound dashboard history hydration - #319

Open
testikun wants to merge 4 commits into
openpi-dev:mainfrom
testikun:codex/issue-178-dashboard-hydration-bound
Open

fix(workflows): bound dashboard history hydration#319
testikun wants to merge 4 commits into
openpi-dev:mainfrom
testikun:codex/issue-178-dashboard-hydration-bound

Conversation

@testikun

Copy link
Copy Markdown
Contributor

Summary

Relates to #178 by fixing the dashboard's unbounded persisted-run materialization.

  • Build the /workflows list from normalized workflow.json metadata without reading result.json or transcripts.json.
  • Enforce independent dashboard count and UTF-8 byte bounds for non-pinned history while keeping disk artifacts canonical.
  • Hydrate result/transcript artifacts only when opening a run, and rehydrate once when a live run settles while its detail view is open.
  • Surface omitted-run counts in the TUI and preserve full-ID/suffix lookup and ambiguity across omitted history.
  • Keep referenced history eligible without allowing session-wide references to bypass the projection bound.

Validation

  • npx --yes bun@1.3.14 run check
  • npx --yes node@24 scripts/run-tests.mjs — 1083 passed, 1 skipped
  • npx --yes node@24 --test tests/extensions/workflows/dashboard.test.ts tests/extensions/workflows/target-resolution.test.ts — 33 passed
  • TUI smoke verified omitted-history status and lazy transcript detail rendering.

The change does not alter workflow artifact formats, execution, delivery, resume/replay, or the settled session-memory retention policy.

@github-actions github-actions Bot added the area:workflows Workflow engine, capability, skills, or tests label Aug 31, 2026
@testikun

Copy link
Copy Markdown
Contributor Author

TUI smoke

验证 Dashboard 修复后的实际界面:列表显示省略数量,打开详情后才加载完整 transcript。

OpenPI Dashboard TUI smoke

@tt-a1i tt-a1i 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.

复审 exact head b2dc49ee74643aa4842216dc4b04b9f697a061af。目标是让 /workflows 列表只保留有界元数据,打开详情再加载磁盘正文,减少历史规模带来的内存/读取开销。方向和价值成立,但当前有两个可复现回归,需要修改后再合并。

Standards

1 项:enterEntry 对 live entry 调用会修改输入的 stale recovery,违背 AGENTS 中 canonical execution facts 与 operator-facing UI 分离的边界。仅查看 UI 不应改变真实任务状态。

Spec

2 项:

  • P1:打开正在运行的 run,原始 active Map 对象及 agent 都从 running 变成 uncertain,并被写入 finishedAt/error。这违反 PR 的“不改变 execution/delivery”承诺。
  • P2:从列表打开的 run 完成后被32条历史限额省略,current 仍标记 live,不进入一次性 artifact hydration,无法看到 canonical transcript。这违反“live run settles while its detail view is open 时 rehydrate once”的承诺。

详见行内评论。最小修复可局限在 live/history 分支与当前详情的 pin/refresh,无需新增存储或生命周期框架;不要求本 PR 一并完成 #178 的全部 retention 工作。

验证

隔离 checkout、Node 24:bun run check 通过;bun run test:Node 1083 passed / 1 skipped,Vitest 30 passed;git diff --check 通过。另用实际 WorkflowDashboard class 完成两条独立复现:live 对象被原地改写;33条记录 mock FS 中 current 被省略、artifactReads=0、current.live=true。现有绿测未覆盖这两个交叉场景。本轮不是安装后真实 Pi/TUI 或模型验收。

Comment thread extensions/workflows/dashboard.ts Outdated
Comment thread extensions/workflows/dashboard.ts
@tt-a1i

tt-a1i commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

审查结论:Changes Requested,exact head b2dc49e。价值是降低 /workflows 历史加载开销;已确认 P1 查看 live 详情会改写真实运行态,以及 P2 当前详情被历史限额省略后不加载完成 transcript。建议仅修 live/history 分支和当前详情 pin/refresh。check、完整测试(Node 1083 passed/1 skipped,Vitest 30)通过,但两个独立复现暴露了测试遗漏。详见正式 review:#319 (review) 。本轮未改代码或合并。

@tt-a1i tt-a1i 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.

复审 exact head 93ab72ca8ca8e64d1554111f43a31de69fc2bd8a。目标是降低 /workflows 历史加载成本:列表只读 metadata,详情按需 hydrate,并把 operator projection 限制为 32 条 / 2 MiB。作者这次已经修复上轮两项回归:打开 live 详情不再改 canonical state,省略的 live run 完成后也能 pin 并 hydrate。

仍有 1 项运行时资源边界问题:最终列表有界,但每次刷新仍同步枚举并解析全部 workflow.json;存在 live run 或 notice 时,这个过程每 120 ms 执行一次。独立 exact-head 基准(最小 metadata)显示 warm refresh:100 条约 2.7 ms、1,000 条约 136–166 ms、5,000 条约 706–780 ms,已经超过刷新周期并会持续占用 TUI 线程;5,000 条首次读取约 7.1 s。

最小修复不需要新存储框架:把“全量持久历史扫描”移出 spinner tick,刷新周期只处理 active/current pin 的变化;持久 metadata projection 可在打开、显式刷新或可证明的增量事件上重建。

验证:bun run check 通过;dashboard/target-resolution 35/35 通过;GitHub CI 全绿。绿测覆盖了最终投影边界,但没有覆盖扫描工作量边界。

Comment thread extensions/workflows/dashboard.ts

@tt-a1i tt-a1i 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.

Exact-head follow-up on 59d4da6: the three prior blockers are addressed in the bounded checks. Dashboard/target-resolution tests passed 35/35; a direct probe confirmed that opening a live run preserves canonical state, idle ticks skip disk-history rescans, and a state change refreshes the projection. No new P0/P1 was confirmed.

There is an additional impact boundary to make explicit: this is not solely a dashboard rendering change. resolveWorkflowRunTarget in model.ts now changes case-sensitive/full-ID and suffix matching, and is called by resolveRunDetails for both workflow_stop and workflow_status (as well as the command/UI paths). An unchanged index.ts diff does not mean tool behavior is unchanged.

Please split the shared target-resolution behavior into its own reviewed change, or document and validate the tool-level compatibility explicitly. This is a scope/impact observation, not a demonstrated new correctness defect. I am not advancing this branch under the current UI-only/low-impact batch.

An unpublished clean integration with main c1c60cd passed bun run check, but its first full suite had two plan-mode rendering failures and a setup subprocess timeout; the same failures were observed on pure main in this environment. Those results do not establish a PR regression, and I am not requesting speculative production fixes for them. No branch push or merge was performed.

Keep dashboard list projections metadata-only and bounded by count and UTF-8 bytes. Hydrate result and transcript artifacts only when a run is opened, preserve explicit target lookup across omitted history, and surface omitted runs without changing canonical artifacts.
@testikun
testikun force-pushed the codex/issue-178-dashboard-hydration-bound branch from 59d4da6 to ae55277 Compare September 6, 2026 06:19
@testikun

testikun commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

@tt-a1i 已修复你指出的两项:live stale recovery 不再改写 canonical state;current live run 会 pin 并 hydrate,即使超出 32 条历史列表。相关回归与 required CI 已通过。

@testikun

testikun commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

@tt-a1i 已修复资源边界:idle spinner tick 不再全量扫描/解析 workflow.json,仅在 active/current 状态变化时刷新投影;相关测试与 required CI 已通过。

@testikun

testikun commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

@tt-a1i 已补充影响范围:resolveWorkflowRunTarget 同时服务 workflow_status、workflow_stop、dashboard/command;case-sensitive、full-ID、suffix 兼容性由 target-resolution 35/35 覆盖,未新增隐式匹配。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:workflows Workflow engine, capability, skills, or tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants