fix(workspace): 暂存写操作对有界瞬时 index.lock 竞争自动重试 #869
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.35) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.35 · 168 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.307
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #869"
general
weight: 0.35
mzdluo123
Summary
修复 main CI 的 E2E flake(
git-workbench-line-smart.spec.ts在 chromium-mobile 上因[busy_locked]中止而失败,触发failOnFlakyTests使整分片变红):index.lock时立即失败、自身没有任何宽限期。WebMux 的使用场景中 CLI agent、编辑器与后台刷新会在同一仓库并发执行 Git 命令,亚秒级的瞬时锁竞争就会把暂存操作中止为用户可见错误。E2E 失败快照确认了这一点:逐行暂存请求因外部index.lock被「安全中止」且未重试。gitInputOutput对ErrLocked(锁竞争)在 2.5 秒预算内以 150ms 间隔自动重试。Git 在任何修改之前先取锁,锁失败的尝试未产生任何变更,重放同一命令是安全的。持续存在的锁(真实外部进程)在预算耗尽后仍返回ErrLocked/409busy,且不删除锁文件——既有语义不变。update-index会写索引,其--index-info输入为小体量元数据,重试前缓冲以便重放;流式输入(hash-object等不会碰到索引锁的命令)保持单次执行。US-J19(git-workbench/core.md)锁竞争行为描述。Test plan
TestStageRetriesTransientIndexLockAndFailsPersistentOne:瞬时锁 600ms 后释放 → 暂存成功且内容正确;持续锁 → 预算内重试后仍报ErrLocked,锁文件不被删除 — 通过(race)go test -race ./internal/workspace/全量通过(38.7s)go test -race -run 'TestGitWrite|TestStage|TestWire' ./internal/api/通过(既有 409 busy API 语义测试不受影响)golangci-lint run ./internal/workspace/...0 issues;make docs-check通过备注
TestEmbeddedRendererFontLicense在本地干净 main 上同样失败(前端产物未完整构建的环境问题),与本改动无关。worktrees.spec.ts批量清理断言)性质不同,本次未覆盖;若再现需单独跟进。Generated with Devin