perf(trace): post-commit starts three git processes for each committed file
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 62/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- git, go
- 领域
- cli, performance
调研方向
Start with settleCommittedLines in app/cli/pkg/action/trace_hook_handler.go and FileAt in app/cli/internal/trace/git/lines.go; check how both ExecClient and GoGitClient read committed files. Then inspect recordRootChanges in app/cli/pkg/action/trace_agent_hook.go and the relevant existing tests. Done when both callers can read multiple paths without resolving the same commit separately for every file, and paths missing from the commit still produce no content.
由索引模型根据 Issue 内容生成。
描述
Problem
The post-commit hook of Chainloop Trace starts 3 git processes for each committed file that has pending AI lines. A large commit makes the hook slow.
settleCommittedLines (app/cli/pkg/action/trace_hook_handler.go) calls client.FileAt(repoRoot, sha, path) one time for each pending path in each session. ExecClient.FileAt (app/cli/internal/trace/git/lines.go) runs these commands for each call:
git rev-parse --verify --quiet <sha>^{commit}git cat-file -e <sha>:<path>git cat-file blob <sha>:<path>
The commit SHA is the same for all the files. Thus step 1 runs again for each file without a reason.
Measurement
Local clone of this repository (3.3k files). One commit changes 301 files, and all the changes are AI lines that are pending.
| Item | Value |
|---|---|
Git processes that post-commit starts |
More than 900 |
Time of post-commit |
Approximately 5.2 s |
This is on main. It is not caused by #3631.
Suggested fix
Read all the files with one git cat-file --batch process. Send one <sha>:<path> line for each path on stdin. For a path that is not in the commit, Git prints <sha>:<path> missing. Use this result as "no content", as FileAt does now. Resolve the commit one time before the loop.
For example, add a Client method that takes a revision and a list of paths and returns the content by path. The GoGitClient version can read the commit tree one time.
recordRootChanges (app/cli/pkg/action/trace_agent_hook.go) calls FileAt for each changed path in the same way, during PostToolUse for Bash calls. The same method can fix that caller too.
- 主要语言
- Go
- 星标
- 582
- 派生
- 61
- 平均合并
- 12 小时 47 分钟
- 30 天内合并 PR
- 137
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
chainloop-dev/chainloop 的其他 Issue
-
feature-parity trace-provider
难度 2/5 1-3 小时 新手友好度 70/100
chainloop-dev/chainloop#3802 ·
维护者通常 1 天内回复
-
bug trace-provider
难度 4/5 3-5 天 新手友好度 48/100
chainloop-dev/chainloop#3803 ·
维护者通常 1 天内回复
-
feat(trace): support GitHub Copilot (CLI and VS Code) in Chainloop Trace可能已有人在做 @migmartri 今天认领。 未关闭Feature spec trace-provider
chainloop-dev/chainloop#3800 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Allow enabling policy enforcement at the workflow contract level可能已有人在做 @migmartri 于 10 天前认领。 未关闭component/backend new-policy spec
chainloop-dev/chainloop#3762 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
chainloop component/CLI performance trace-provider
难度 2/5 1-3 小时 新手友好度 25/100
chainloop-dev/chainloop#3749 ·
维护者通常 1 天内回复
查看 chainloop-dev/chainloop 的全部 Issue
相似的 Issue
-
model:sonnet runtime:claude security size:S
难度 2/5 1-3 小时 新手友好度 78/100
FootprintAI/Containarium#3624 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
Judgment-Pack/judgment-pack-runtime#367 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
enhancement help wanted
难度 2/5 1-3 小时 新手友好度 87/100
pulseaiclub/phi#482 ·
维护者通常 1 天内回复
-
bug raised-by:desk
难度 2/5 1-3 小时 新手友好度 72/100
medici-finance/assay#6102 ·
维护者通常 1 天内回复