Skip to content

core: git packing preflight measures only the objects filesystem and mis-resolves untrimmed paths #4412

Open

Description

@schlessera

Part of #4278. Deferred from the tenth review of PR #4323 (#4287).

Context

  • gitPackingHeadroom (packages/core/src/lib/git-storage.ts:165-191) calls statfsSync only on the --git-path objects result (:187).
  • packRepository also runs --task=pack-refs (:145), which writes packed-refs in the Git common directory. With objects on a separate mount and a full common-directory filesystem, the preflight admits the run and Git fails after object packing has started.
  • The git() helper trims stdout (:42), and that string is used as a pathname at :126-128 and :166. An objects path ending in whitespace therefore resolves to a different path. Capacity is unknown, and packing is skipped on every run, although Git itself can pack.
  • The pack-directory listing at :128-139 has the same fault.

Scope

Measure every filesystem the maintenance tasks write to, and take paths from Git without altering them. Out of scope: the headroom rule itself, and where packing runs (#4288).

Acceptance criteria

  • With the objects directory on one filesystem and zero available bytes injected for the common directory, the git step reports the named packing_headroom skip and Git is not started.
  • A repository whose objects path ends in a space gets a measured availableBytes and packs when headroom allows.
  • The pack-directory listing used for leftover cleanup resolves the same untrimmed path.
  • brain storage pack --json keeps its shape, or changes additively in a CONTRACT: commit.

Activity

  1. added
    type: fix
    area: core
    priority: p3
    agent-ready
    on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: corepriority: p3type: fix

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions