Skip to content

perf(workflows): skip binary diff for ignored repositories - #298

Merged
tt-a1i merged 3 commits into
openpi-dev:mainfrom
samsen3:perf/replay-fingerprint-cheap-checks-first
Aug 30, 2026
Merged

tt-a1i merged 3 commits into
openpi-dev:mainfrom
samsen3:perf/replay-fingerprint-cheap-checks-first

Conversation

@samsen3

@samsen3 samsen3 commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem

repositoryFingerprint() paid for a full git diff --binary before discovering that repositories containing ignored files cannot be replayed. Repositories with node_modules, build output, or .env therefore paid for a large synchronous diff whose result was discarded.

Fixes #294

Value

The original Windows benchmark used 32 replay-eligible calls in a synthetic repository with a 2.29 MiB dirty diff and node_modules:

Scenario Before Optimized
Total fingerprint time 9704 ms 1963 ms
Worst event-loop block 333.0 ms 80.3 ms

Ignored-file repositories now exit after two cheap Git commands and never run the binary diff.

Approach

  • Run one early ignored-file check immediately after resolving the repository root.
  • Keep the original post-diff tracked-mode and ignored-file gates. The early check is only an optimization: files, symlinks, or gitlinks that appear while the diff runs still fail closed.
  • Preserve the single 5-second Git deadline for the complete fingerprint operation.
  • Export repositoryFingerprint(cwd, runGit?) so tests can lock command ordering and inject concurrent repository changes.

Clean replayable repositories perform one additional ignored-file scan; their fingerprint value and persisted replay identity remain unchanged.

Validation

  • bun run check: passed.
  • Focused replay-safety tests: 15/15 passed.
  • Full local suite: Node 1050 passed, 1 skipped, 0 failed; Vitest 30/30 passed.
  • Regression coverage proves:
    • repositories that already contain ignored files never reach the binary diff;
    • ignored files, tracked symlinks, and gitlinks created while the diff runs are rejected by the post-diff gates;
    • the successful command sequence and fingerprint shape remain deterministic.

Impact

No user-visible or model-visible surface changes. Replay remains fail closed, existing journal identities remain compatible, and the common ignored-repository path avoids the discarded diff.

@github-actions github-actions Bot added the area:workflows Workflow engine, capability, skills, or tests label Aug 30, 2026
…y diff

Replay is disabled wholesale for repositories with ignored files, but
repositoryFingerprint() still paid for a full `git diff --binary` (up to
32 MiB buffered) before discovering that. Move every cheap terminating
check ahead of the diff: repository root, ignored files, HEAD, tracked
modes/symlinks, then the diff, then untracked collection and hashing.

All git invocations share a single deadline, so reordering a fixed
command set cannot change the outcome for any input; the unbounded
non-git work still runs after every git call. Ignored-file repositories
now fail within two git processes instead of five to six and never
buffer the diff.

repositoryFingerprint() is exported with an injectable git runner so a
regression test can lock the command order: a disqualifying repository
must never reach the diff.

Fixes openpi-dev#294
@samsen3
samsen3 force-pushed the perf/replay-fingerprint-cheap-checks-first branch from 9a1b32e to 818c186 Compare August 30, 2026 04:52
@tt-a1i tt-a1i changed the title perf(workflows): run cheap replay fingerprint checks before the binary diff perf(workflows): skip binary diff for ignored repositories Aug 30, 2026

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

已按精确 head 2f239d0 重新审查并验证。该 PR 保留了 ignored 仓库在昂贵 binary diff 前快速退出的性能收益,同时修复了重排导致的 fail-closed 竞态:diff 后继续复查 tracked symlink/gitlink 与 ignored 文件,因此外部进程在同步 diff 期间创建这些可观察资源时不会生成不完整 replay identity。新增注入式回归覆盖 ignored、tracked symlink、gitlink 三类并发变化以及成功路径命令顺序。分支已合入最新 main;本地 bun run check 通过,专项 15/15,全量 Node 1050 passed、1 skipped、0 failed,Vitest 30/30;GitHub Node 22、Node 24、Windows 和 label checks 在该 head 全绿。未发现新的 P0-P2 阻塞,批准合并。

@tt-a1i
tt-a1i merged commit 2894084 into openpi-dev:main Aug 30, 2026
4 checks passed
agnitum2009 pushed a commit to agnitum2009/openpi that referenced this pull request Sep 3, 2026
…v#298)

* perf(workflows): run cheap replay fingerprint checks before the binary diff

Replay is disabled wholesale for repositories with ignored files, but
repositoryFingerprint() still paid for a full `git diff --binary` (up to
32 MiB buffered) before discovering that. Move every cheap terminating
check ahead of the diff: repository root, ignored files, HEAD, tracked
modes/symlinks, then the diff, then untracked collection and hashing.

All git invocations share a single deadline, so reordering a fixed
command set cannot change the outcome for any input; the unbounded
non-git work still runs after every git call. Ignored-file repositories
now fail within two git processes instead of five to six and never
buffer the diff.

repositoryFingerprint() is exported with an injectable git runner so a
regression test can lock the command order: a disqualifying repository
must never reach the diff.

Fixes openpi-dev#294

* fix(workflows): recheck replay disqualifiers after diff

---------

Co-authored-by: zhangms <[email protected]>
Co-authored-by: tt-a1i <[email protected]>
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.

perf(workflows): replay 指纹在 ignored 检查注定丢弃结果之前就白跑一次完整 git diff --binary

2 participants