Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

The hive router runs a synchronous `git add -A` + `git commit` on the main process for every routed message; nothing reads that history

Đang mở
#620 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
electron, git, typescript
Lĩnh vực
desktop, devtools, performance

Hướng nghiên cứu

Start in src/main/hive.ts at HiveManager.commit() and the private git() helper (spawnSync). Remove git init for new hives and all commit() call sites (send(), routeOnce(), writeTasks(), register/role/archive/rename/session). Leave an existing hive/.git untouched. Done when routing a message does not spawn git and mail still delivers; log.jsonl remains the event record.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Fix verified in a fork (installed build, Windows 10):

  • git runs per routed message: 2 → 0 (git add -A + git commit → none).
  • Process trace over 75 s around one routed message: 0 processes started by the app.
  • The hive's git log shows no new commits after the install; mail is delivered as before.
What happened?

Every hive state change ends in HiveManager.commit() (src/main/hive.ts):

  • send(), routeOnce() ("hive: routed N message(s)"), writeTasks(), and the register, role, archive, rename and session changes.
  • commit() runs git add -A and then git commit through the private git() helper, which is spawnSync('git', …), on the Electron main process, with up to 5 retries and a synchronous sleep between them.

So each delivered message blocks the main process (IPC, PTY output and keystrokes included) for the duration of two git subprocesses. In normal agent-to-agent traffic that is about 2 commits per delivery (the sender's route pass, then the recipient's state change).

Nothing in src/ reads the hive's git history; log.jsonl is the event record the app actually uses. The repository is write-only, and it has already been the subject of several reports:

  • #372: the startup archive loop's per-agent commits freezing launch;
  • #378: a stale HEAD.lock silently stopping all commits;
  • ccff49b5: stop versioning each Codex worker's CODEX_HOME after .git growth;
  • #479: a proposal to move the commit off the main thread.

Measured on Windows 10 (a hive with 6 agents, ~1,200 tracked files, .git 58 MB), in a fork build that shares this code path:

measure value
main-process block per commit (git add -A + git commit, synchronous) ~0.3–0.5 s
commit rate on an active hive ~57 per hour
processes per commit git add -A = git + child + conhost (≈130–240 ms); git commit = 4 git + conhost

On-access antivirus inspects each process launch and each new object and index file, so on Windows the cost goes beyond git's own time.

Expected: routing a message costs a few small file writes and never blocks the main process on a subprocess.

Suggested fix (plain words):

  • Stop committing the hive: no git init for new hives, no commit() calls, no untrack or lock-clearing passes.
  • log.jsonl stays the event record, and registry, tasks and inbox/outbox stay plain files, as today.
  • Leave an existing hive/.git untouched (no deletion or migration), so nobody loses history they may want.
  • We measured this change in a fork:
    • 8 messages 7 s apart went from 16 git invocations (2 per message) to 0, with no .git created and mail delivered as before;
    • on the installed build, a 75 s process trace around one routed message shows 0 processes started by the app, and the hive's git log shows no new commit.
Steps to reproduce
  1. On Windows, launch the app fresh and create a hive with 2 agents (any provider).
  2. In PowerShell, start a process watcher: Register-CimIndicationEvent -Query "SELECT * FROM __InstanceCreationEvent WITHIN 0.1 WHERE TargetInstance ISA 'Win32_Process'" -SourceIdentifier p, and print TargetInstance.Name/CommandLine from Get-Event.
  3. Have agent A send agent B one message: write one JSON file into hive/agents/<A>/outbox/.
  4. The watcher shows git … add -A and git … commit -q -m "hive: routed 1 message(s)" spawned by the app. Then B handles the message and a second commit follows.
  5. git -C <hive> log --oneline | head shows a commit per routing pass. git grep in src/ finds no reader of that history.
Screenshot or screen recording

Text evidence instead of an image. These are a process trace and git log output for one routed message, captured with the watcher from step 2. The paths are redacted.

Before (the current code path):

# processes started by the app's main process for ONE routed message
07:46:37.779 git.exe  git -c commit.gpgsign=false -c user.name=Hive -c user.email=hive@local -c gc.auto=0 -c maintenance.auto=false add -A
07:46:38.160 git.exe  git -c commit.gpgsign=false -c user.name=Hive -c user.email=hive@local -c gc.auto=0 -c maintenance.auto=false commit -q -m "hive: routed 1 message(s), rejected 0, archived 0"

$ git -C <hive> log -1 --format='%h %ad %s' --date=iso-strict
e46fe0c 2026-09-26T09:46:38+02:00 hive: routed 1 message(s), rejected 0, archived 0

After (the fork with the fix, installed):

# processes started by the app's main process during a 75 s trace around ONE routed message
# total 0 processes

$ git -C <hive> log -1 --format='%h %ad %s' --date=iso-strict
d2d461c 2026-09-26T11:50:51+02:00 hive: routed 1 message(s), rejected 0, archived 0   <- last commit, before the fixed build was installed
Logs / stack trace
# WMI process trace, two routed messages on the current code path (paths redacted):
06:40:36.227 git.exe  git -c commit.gpgsign=false -c user.name=Hive -c user.email=hive@local … add -A
06:40:36.913 git.exe  git -c … commit -q -m "hive: routed 2 message(s), …"
06:40:53.665 git.exe  git -c … add -A
06:40:53.845 git.exe  git -c … commit -q -m "hive: routed 1 message(s), …"
Operating system / versions
  • OS: Windows. OS version: Windows 10 Home 22H2 (build 19045).
  • Munder Difflin version: measured on a fork build based on v0.4.5. The code path is unchanged on main @ a7452eea (v0.5.3): HiveManager.commit()/git() in src/main/hive.ts.
  • Node version: v20.19.5.
  • Agent CLI: not relevant (it reproduces with any provider).
Pre-flight
  • I attached a screenshot or recording above. (Text evidence pasted instead: the process trace and git log output.)
  • I'm on the latest release, or I've said above why I can't be. (A fork based on v0.4.5; the same code is on main @ a7452eea.)
  • I re-ran npm install … (Not applicable: a packaged build.)
  • I searched existing issues and this isn't a duplicate. (#372, #378 and #479 are related, not the same.)
Ngôn ngữ chính
TypeScript
Star
8.5k
Fork
1.2k
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
80

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của HarnessMD/munder-difflin

Tất cả issue của HarnessMD/munder-difflin

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.