Skip to content

fix(gates): a long hoc script goes up as a staged file - #2360

Open
nicolas-abril wants to merge 1 commit into
bendlang:mainfrom
nicolas-abril:fix/gate-long-script
Open

nicolas-abril wants to merge 1 commit into
bendlang:mainfrom
nicolas-abril:fix/gate-long-script

Conversation

@nicolas-abril

Copy link
Copy Markdown
Collaborator

Problem

Through the bastion (BEND_HOC), hoc_ssh puts the whole shard script in the ssh command. The mux client hands that command to the master in one message, and macOS refuses one near 8 KB:

mm_send_fd: sendmsg: Message too long
mux_client_request_session: send fds failed

So a shard whose script lands in that window never starts, and all its tests fail. Adding or lengthening a test can move a shard into the window.

Reproduced on main (6180be5) with lib.ssh(node, ": " + "x".repeat(k) + "; echo ok") for k = 7950…8250 in steps of 10: k = 8020, 8030, 8040 fail with exit 255 and the error above; the rest pass.

Fix

In gates/_lib.ts, a quoted script over 4096 bytes is staged on the bastion the same way the input pack already is: once per run, under its sha1, in ~/.bend-gate, cleaned after an hour. It is then passed to hoc-ssh as "$(cat <file>)". Shorter scripts go as before, so ordinary sessions don't pay an extra round trip. The staging code that was inline for the input pack is now a small hoc_stage helper used for both.

Checks

  • The sweep above with this branch: no size fails.
  • Scripts of 1,000, 8,080 and 20,000 bytes with ', " and $ in them: they arrive intact (wc -c on the node prints the same length) on main and on this branch.
  • bun gates/test.ts --gate: 1753 / 1872 on this branch and 1753 / 1872 on main, run back to back. Every failure on both is in the shards that landed on minis without /usr/local/bun/bin/bun (69 No such file or directory lines on each), so this branch adds no failure.
  • bun gates/repo.ts --gate: 56 / 56.

The missing bun install on some minis (cluster-01 and cluster-1a, at least) is a separate problem, not addressed here.

🤖 Generated with Claude Code

A cluster session through the bastion (BEND_HOC) sent the whole shard script
in its ssh command. The mux client hands that command to the master in one
message, and macOS refuses one near 8 KB ("mm_send_fd: sendmsg: Message too
long", then "mux_client_request_session: send fds failed"), so a shard whose
script landed in that window never started and its tests failed. Scripts of
8,020-8,040 bytes fail on main; adding a test can move a shard into it.

A quoted script over 4096 bytes is now staged on the bastion like the input
pack (once per run, under its sha1) and passed to hoc-ssh as
"$(cat <file>)". Shorter scripts go as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nicolas-abril added a commit to nicolas-abril/bend that referenced this pull request Nov 30, 2026
…staged file (bendlang#2360)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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