Skip to content

fix(workflows): bound settled run retention - #233

Merged
somewan820 merged 2 commits into
openpi-dev:mainfrom
627150795:fix/issue-178-settled-retention
Aug 29, 2026
Merged

somewan820 merged 2 commits into
openpi-dev:mainfrom
627150795:fix/issue-178-settled-retention

Conversation

@627150795

Copy link
Copy Markdown
Contributor

Problem

Issue #178 identifies unbounded growth of settled workflow details in the current-session memory projection, even though completed run artifacts are already persisted separately.

Value

A long-running session now has a hard count bound for its ephemeral settled-run projection, while operators can see how many entries were evicted and can still query persisted runs by ID.

Approach

  • Keep at most 32 settled workflow projections in memory.
  • Evict the oldest terminal projection first and never evict a running run.
  • Keep persistence and result delivery independent; eviction does not delete workflow.json or side artifacts.
  • Report the cumulative evicted count in workflow_status output and structured details.
  • Add model-level and execute-level tests covering the bound, oldest-first eviction, active-run preservation, artifact retention, and lookup after eviction.

Validation

  • bun run lint — passed.
  • bun run typecheck — passed; the repository still reports its pre-existing file-search Effect warnings on this base branch.
  • Settled-retention focused tests — 3/3 passed.
  • git diff --check — passed.
  • The broader workflow e2e file had 10/12 passing tests on Windows; the two failures are existing injected-session/replay fixture failures outside this retention change.

Impact

This PR intentionally implements the count-bound portion of #178. It does not add byte/age or disk cleanup policy. Persisted artifacts, pending completion delivery, resume data, and active runs remain outside the eviction path.

Related to #178

@627150795
627150795 force-pushed the fix/issue-178-settled-retention branch from 6afafa7 to 1960ea6 Compare August 28, 2026 19:55
@627150795

Copy link
Copy Markdown
Contributor Author

Synchronized with the latest upstream main. Verified with node --test --experimental-strip-types tests/extensions/workflows/model.test.ts (2/2) and the isolated settled retention E2E case (1/1); lint, typecheck, and diff check pass. The PR is mergeable and awaits maintainer review/workflow approval.

@627150795

Copy link
Copy Markdown
Contributor Author

独立行为回归记录(2026-08-29):在 PR 分支运行 retention E2E,连续完成超过 32 个 workflow 后,内存 settled projection 保持不超过 32 条;最旧 run 的 workflow.json 仍保留;被驱逐的 run 仍可通过完整 run ID 从持久化记录查询,状态为 completed。model retention 两项测试通过,相关 workflow E2E 12 项中 10 项通过;剩余 2 项是 Windows 下既有的注入 session/replay fixture 失败,不涉及本 PR。bun run typecheck、bun run lint、git diff --check 均通过。结论:count-bound 子集实际生效;byte/age/disk retention 仍不在本 PR 范围。

@627150795

Copy link
Copy Markdown
Contributor Author

代码有效性审计结论:PR #233 的 32 条 settled in-memory count bound、最旧终态驱逐、活动 run 保护、artifact 保留和按 ID 磁盘查询均有效;但它不是 Issue #178 的完整实现。当前 dashboard 的 loadRunEntries() 在打开历史时仍会遍历并 hydrate 所有符合条件的持久化 run,且 session_start 会清空 settled projection 与 evicted 计数。因此本 PR 应继续按“count-bound 子集”审查,不宣称已覆盖 dashboard 物化边界、byte/age 策略或重启可观测性。

@627150795
627150795 force-pushed the fix/issue-178-settled-retention branch 2 times, most recently from 69ed0d9 to ea21cc1 Compare August 29, 2026 11:50

@somewan820 somewan820 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.

已完成静态审查。bounded map 只淘汰 terminal projections,显式 run lookup 仍回退 persisted artifacts,session reset 同步清理 records/counters;测试覆盖 eviction、active preservation、status metadata 和 persisted lookup。未发现 P0-P2 或死代码问题。未运行测试。

@somewan820
somewan820 force-pushed the fix/issue-178-settled-retention branch 2 times, most recently from b350dc5 to 3f0a19e Compare August 29, 2026 12:46
@somewan820
somewan820 force-pushed the fix/issue-178-settled-retention branch from 3f0a19e to 387255b Compare August 29, 2026 12:48
@somewan820
somewan820 merged commit e2a5f4d into openpi-dev:main Aug 29, 2026
3 of 6 checks passed
agnitum2009 pushed a commit to agnitum2009/openpi that referenced this pull request Aug 29, 2026
* fix(workflows): bound settled run retention

* style(workflows): format retention test

(cherry picked from commit e2a5f4d)
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.

2 participants