Auto-batching breaks down on a sufficiently large monorepo on Linux #1061
Replies: 1 comment 2 replies
-
|
Confirmed—thanks for the detailed report. hk renders the full command and passes it as one I also found a second issue in the batching implementation: it derived one file-count batch size from the first paths and reused it for all later chunks. A later chunk with longer paths could therefore still exceed the byte limit. PR #1066 addresses both problems by:
I kept direct executable invocation out of this focused fix. It remains a useful complementary feature, but an explicit structured argv configuration would be safer than heuristically deciding whether an existing command string requires shell evaluation. This comment was generated by Codex. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Disclaimer: I used Claude / Codex to help investigate this issue, but I wrote this summary myself.
I am trying to use
hkwith a very large monorepo (~110,000+ files) and noticed several problems withhkwhen trying it out. Everything worked great on macOS, but when I transferred over to our Linux CI environment, problems began to appear immediately.Specifically, the Linux kernel has a per-argument size cap (
MAX_ARG_STRLEN) of 128KiB by default, and this is in addition to theARG_MAXheadroom. Batching does not correctly account for this today, so a sufficiently large tree will causehk run check <HOOK> --allto fail (either with exit code 7,E2BIG, orshcomplaining about the argument list being too long).This can be reproduced with a minimal
hk.pkl:How do we resolve this?
I see two clear solutions, both of which are complementary:
hkshould gain support for bypassing the shell, resolving to the appropriate executable on thePATH.hkcould detect if a command actually needs to run in the shell (checking for characters with special meaning in a shell) and only spawning a shell then._SC_ARG_MAXsize.Beta Was this translation helpful? Give feedback.
All reactions