Skip to content

Fix HTTP push pack negotiation memory - #176

Merged
mizchi merged 2 commits into
mainfrom
agent/fix-http-push-negotiation-memory
Aug 12, 2026
Merged

Fix HTTP push pack negotiation memory#176
mizchi merged 2 commits into
mainfrom
agent/fix-http-push-negotiation-memory

Conversation

@mizchi

@mizchi mizchi commented Aug 12, 2026

Copy link
Copy Markdown
Member

Summary

  • discover remote receive refs before building HTTP push packs
  • exclude objects reachable from advertised remote refs, including nested trees and shared blobs
  • skip object loading and pack upload entirely when the destination ref is already up to date
  • apply the same negotiation behavior to hub notes pushes used by agent communication
  • add a smart HTTP regression test for request size and no-op pushes

Root cause

HTTP push collected and delta-compressed every object reachable from local HEAD before discovering what the receiver already owned. On the reported repository that meant processing roughly 13 GB of reachable blob data even though only about 1.55 MB was missing. The existing exclusion walker also marked nested tree IDs before recursing, so shared objects under those trees were not excluded correctly.

Impact

A controlled 16 MiB fixture reduced peak RSS from 246.4 MB to 13.0 MB and the receive-pack request from 16.78 MB to 416 bytes. An up-to-date push in the original large repository now completes in 0.50 s with 39.7 MB maximum RSS.

Validation

  • pkf run check
  • native bit_lib and bit_lib/native tests: 315 passed
  • native hub and hub/native tests
  • t/t0020-push-fetch-pull.sh: 21 passed
  • t/t9003-fetch-up-to-date.sh: 8 passed
  • t/t0012-hub-sync.sh: passed
  • t/t9020-http-push-negotiation.sh: 5 passed
  • native release build
  • real no-op push against the original GitHub branch

@mizchi
mizchi marked this pull request as ready for review August 12, 2026 07:54
@mizchi
mizchi merged commit 371cf8a into main Aug 12, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant