Skip to content

fix(snapshot): add maxBuffer to git add/commit exec calls#1914

Merged
piorpua merged 1 commit intomainfrom
fix/sentry-ELECTRON-G4
Mar 30, 2026
Merged

fix(snapshot): add maxBuffer to git add/commit exec calls#1914
piorpua merged 1 commit intomainfrom
fix/sentry-ELECTRON-G4

Conversation

@kaizhou-lab
Copy link
Copy Markdown
Collaborator

@kaizhou-lab kaizhou-lab commented Mar 30, 2026

Summary

  • Sentry issue: ELECTRON-G4 — RangeError: stderr maxBuffer length exceeded (14 events, actively occurring)
  • Add maxBuffer: 10 * 1024 * 1024 (10MB) to git add . and git commit calls in createWorkingTreeSnapshot, and to git add -A in stageAll — these were using Node's default 1MB buffer, which overflows on large workspaces with verbose git stderr
  • Aligns with existing maxBuffer configuration used by other git commands in the same file (compareGitRepo, compareSnapshot, getBaselineContent)

Test plan

  • Added integration tests verifying snapshot init and stageAll handle 200+ files without maxBuffer errors
  • All 23 WorkspaceSnapshotService tests pass
  • Lint, format, type check all pass
  • Verify ELECTRON-G4 occurrence rate drops after deploy

@kaizhou-lab kaizhou-lab marked this pull request as ready for review March 30, 2026 07:37
@kaizhou-lab kaizhou-lab force-pushed the fix/sentry-ELECTRON-G4 branch from ca6129c to e1c9da1 Compare March 30, 2026 07:51
@kaizhou-lab kaizhou-lab changed the title fix(snapshot): increase maxBuffer for git operations on large workspaces fix(snapshot): add maxBuffer to git add/commit exec calls Mar 30, 2026
@piorpua piorpua added the bot:reviewing Review in progress (mutex) label Mar 30, 2026
The git add and commit commands in createWorkingTreeSnapshot and
stageAll lacked maxBuffer configuration, using Node's 1MB default.
On large workspaces, git can produce >1MB of stderr warnings,
causing "RangeError: stderr maxBuffer length exceeded" (ELECTRON-G4,
14 occurrences). Set maxBuffer to 10MB, matching other git commands
in the same file.
@piorpua piorpua force-pushed the fix/sentry-ELECTRON-G4 branch from e1c9da1 to ff70b7b Compare March 30, 2026 09:29
@piorpua piorpua added bot:reviewing Review in progress (mutex) and removed bot:reviewing Review in progress (mutex) labels Mar 30, 2026
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 30, 2026

Code Review:fix(snapshot): add maxBuffer to git add/commit exec calls (#1914)

变更概述

本 PR 修复 Sentry 问题 ELECTRON-G4(RangeError: stderr maxBuffer length exceeded),为 WorkspaceSnapshotService 中三处 execFileAsync 调用添加 maxBuffer: 10 * 1024 * 1024(10MB):stageAllgit add -AcreateWorkingTreeSnapshotgit add --ignore-errors .git commit。同时增加集成测试,验证 200 个文件场景下快照初始化和 stageAll 不会抛出 maxBuffer 错误。


方案评估

结论:✅ 方案合理

三处修改与文件中已有的 maxBuffer 配置完全一致(compareGitRepocompareSnapshotgetBaselineContent 均已使用相同或更大的 maxBuffer 值),是最小化、精准的对齐修复。10MB 大小合理且符合既有惯例,不引入任何结构性变化。


问题清单

🔵 LOW — 测试未实际触发 maxBuffer 边界

文件tests/unit/WorkspaceSnapshotService.test.ts,第 303–342 行

问题说明:两个新增测试使用 200 个内容仅约 9 字节的文件,总 stderr 产出远不足 1MB,不会触发 Node.js 默认 1MB maxBuffer 限制,因此无法验证修复本身的必要性。测试覆盖了代码路径正确性(pass/fail 语义无误),但若将来有人将 maxBuffer: 10 * 1024 * 1024 意外删除,这两个测试不会失败。

建议:在测试注释中明确说明此测试为功能性集成测试(不是 maxBuffer 边界重现测试),帮助未来维护者理解意图。由于实际复现该 overflow 需要超大工作区且难以在 CI 稳定运行,此现状可以接受。


汇总

# 严重级别 文件 问题
1 🔵 LOW tests/unit/WorkspaceSnapshotService.test.ts:303 测试未实际触发 maxBuffer 边界,属功能性集成测试而非边界重现测试

结论

批准合并 — 无阻塞性问题

修复精准、与现有代码风格完全一致,测试覆盖代码路径正确性,LOW 级别问题不影响合并。


本报告由本地 pr-review skill 生成,包含完整项目上下文,无截断限制。

CONCLUSION: APPROVED
IS_CRITICAL_PATH: false
PR_NUMBER: 1914

@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 30, 2026

✅ 已自动 review,无阻塞性问题,正在触发自动合并。

@piorpua piorpua merged commit 217f882 into main Mar 30, 2026
15 of 17 checks passed
@piorpua piorpua deleted the fix/sentry-ELECTRON-G4 branch March 30, 2026 09:46
@piorpua piorpua added bot:done Auto-merged by bot and removed bot:reviewing Review in progress (mutex) labels Mar 30, 2026
wuhao1477 added a commit to wuhao1477/AionUi that referenced this pull request Mar 30, 2026
* 'main' of github.com:wuhao1477/AionUi: (40 commits)
  fix(agents): prevent unhandled promise rejection in bootstrap initialization (iOfficeAI#1933)
  fix(gemini): restore context after stopping a reply (iOfficeAI#1932)
  fix(codex): reject start promise immediately on process exit during startup (iOfficeAI#1929)
  fix(conversation): sync renamed titles with detail view (iOfficeAI#1927)
  fix(paste): deduplicate filenames when pasting multiple images simultaneously
  fix(mobile): add SafeArea support and update app icon (iOfficeAI#1926)
  fix(database): guard against undefined params in databaseBridge providers (iOfficeAI#1924)
  fix(conversation): validate type field before creating conversation (iOfficeAI#1921)
  fix(docs): restore wechat_group_5.png reference to wx-5.png in readme
  fix(snapshot): add maxBuffer to git add/commit exec calls (iOfficeAI#1914)
  refactor(acp): consolidate AGENT_SKILLS_DIRS into ACP_BACKENDS_ALL (iOfficeAI#1913)
  fix(gemini): guard against EACCES in workspace realpath during init (ELECTRON-BM) (iOfficeAI#1912)
  fix(channels): send raw QR ticket instead of page URL in WeChat WebUI login SSE (iOfficeAI#1910)
  .md format
  chore(pr-automation): fix missed sleep 5 in comment to sleep 10
  chore(pr-automation): increase auto-merge retry delay to 10s
  chore(pr-automation): add 5s retry for transient GitHub mergeStateStatus UNKNOWN
  fix(docs): remove trailing whitespace in OfficeCLI readmes
  chore(pr-automation): verify auto-merge success before labeling bot:done
  fix(snapshot): guard against non-existent workspace in WorkspaceSnapshotService.init (iOfficeAI#1906)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:done Auto-merged by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants