Repository navigation
fix(herdr): connect eventwait on long socket paths - #4
Merged
Merged
Conversation
added 5 commits
September 16, 2026 00:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Captain, 16 September 2026: "continue and complete the remaining tasks". Context: the no-mistakes document step on the fm-tests-red-on-main branch raised finding herdr-eventwait-long-socket-path. Firstmate approved it as a follow-up instead of expanding that task. bin/backends/herdr-workspace-move.py now connects to the Herdr control socket by basename (after chdir into the socket's directory) to stay under the 104-byte AF_UNIX path limit, but bin/backends/herdr-eventwait.py still calls sock.connect with the full path and exits 2 under a deep home.
What Changed
bin/backends/herdr-eventwait.pynow splits the control socket path, changes into the socket directory, and connects by basename, so a Herdr session socket under a deep home no longer exceeds the ~104-byteAF_UNIXaddress limit and fails with exit 2.<socket_path>, writes an explanatory message to stderr, and returns exit 2 for a relative path. The usage docstring records the rule, and the chdir comment inbin/backends/herdr-workspace-move.pyis updated to give the same reason.tests/fm-backend-herdr.test.shadds two executed cases: one connects the reader to a throwaway listener on a path longer than 104 bytes and asserts@subscribedoutput, one asserts the relative-path refusal. The Python unit tests intests/fm-backend-herdr-eventwait.test.pynow pass an absolute socket path and patchos.chdir.Risk Assessment
✅ Low: A four-line transport fix mirroring an already-shipped sibling, plus an explicitly authorized absolute-path guard, both covered by executed regression tests that fail before the fix and pass after it.
Testing
The configured test command had already passed as baseline, so this step focused on the socket-path surface itself. I stood up throwaway AF_UNIX listeners under directories deep enough to push the socket path to 137 and 141 bytes, then drove the reader directly and through its only production caller. The fixed reader connects, acks, and streams a projected event; the adapter turns that into the normalized blocked record and returns 0. The base-commit reader fails with exit 2 on the identical setup, which reproduces the reported defect and confirms the regression is genuine. The absolute-path guard rejects relative and dotted-relative paths with exit 2 and its stated rule, and absolute paths with no listener still exit 2 without a traceback. I also proved the regression actually guards the fix: with the connect line reverted, the runner-executed suite exits 1 on that test, and passes with the fix restored. This change is a CLI and shell surface with no rendered UI, so there is no screenshot or rendered HTML artifact; the CLI transcripts are the end-user-visible evidence. The worktree is clean and the reverted file was restored.
python3 bin/backends/herdr-eventwait.py <137-byte path> 1.5 pane-1against a real AF_UNIX listener: exit 0, stdout@subscribedthenpane-1 ws-7 blocked claude; artifact eventwait-long-path-fixed…git show 514e48e:bin/backends/herdr-eventwait.pydriven against the identical listener: exit 2, empty stdout, listener stuck atready; artifact eventwait-long-path-prefix.txt. bin/backends/herdr.sh; fm_backend_herdr_wait_transition demo 3 <state> demo:pane-1with a fakeherdrCLI reporting the deep socket_path and a real listener: printspane-1 ws-7 blocked claude,…FM_BACKEND_HERDR_EVENT_READERpointed at the base-commit reader: empty record,wait_transition exit: 2; artifact eventwait-adapter-deep-path-prefix.txtherdr-eventwait.py herdr.sock 1 pane-1and./sub/herdr.sock: both exit 2 withsocket path must be absolute; the control socket is connected by basename from its own directory; artifact eventwait…/nonexistent-dir-xyz/herdr.sockand/tmp/.../absent.sock: exit 2, no traceback; artifact eventwait-path-guards.txtbash tests/fm-backend-herdr.test.shexits 0 with both newok -lines; withsock.connectreverted the suite exits 1 onnot ok - eventwait could not connect over a long socket path; artifact eve…Evidence: Reader connects and streams over a 137-byte socket path (fixed)
Source: Reader connects and streams over a 137-byte socket path (fixed)
socket path bytes: 137 exit status: 0 stdout: @subscribed pane-1 ws-7 blocked claudeEvidence: Same socket path with the base-commit reader: exit 2, never connects
Source: Same socket path with the base-commit reader: exit 2, never connects
== PRE-FIX reader (base commit 514e48e) on same deep socket path == socket path bytes: 137 exit status: 2 stdout: listener saw: readyEvidence: Production adapter escalates over a 141-byte socket path
Source: Production adapter escalates over a 141-byte socket path
socket path bytes: 141 adapter stdout (normalized escalation record): pane-1 ws-7 blocked claude wait_transition exit: 0Evidence: Production adapter with the base-commit reader falls back: exit 2
Source: Production adapter with the base-commit reader falls back: exit 2
socket path bytes: 141 adapter stdout (normalized escalation record): wait_transition exit: 2Evidence: Absolute-path guard transcript
Source: Absolute-path guard transcript
$ herdr-eventwait.py herdr.sock 1 pane-1 exit status: 2 output: herdr-eventwait.py: socket path must be absolute; the control socket is connected by basename from its own directoryEvidence: Regression red before the fix, green after, in the executed suite
Source: Regression red before the fix, green after, in the executed suite
--- WITH the fix (target 671129f), suite exit 0 --- ok - herdr-eventwait.py connects to a throwaway AF_UNIX listener beyond the 104-byte path limit ok - herdr-eventwait.py refuses a relative socket path --- WITH connect reverted to sock.connect(sock_path), suite exit 1 --- AssertionError: eventwait failed for a long socket path: rc=2 stdout='' stderr='' not ok - eventwait could not connect over a long socket pathPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
tests/fm-backend-herdr-eventwait.test.py:94- Commit 33e5f24 deleted test_eventwait_connects_to_long_socket_path from tests/fm-backend-herdr.test.sh (a file the runner executes) and re-added it as test_connects_to_a_socket_path_beyond_the_af_unix_limit in tests/fm-backend-herdr-eventwait.test.py, which nothing executes. bin/fm-test-run.sh:996-1003 (all_repo_tests) globs onlytests/*.test.sh; run_script_bounded runs each match withbash. bin/fm-test-run.sh:1134 only maps a CHANGE to the .py file onto the real-herdr-gated and backend-dispatch families, so editing it selects other suites and never itself. No .test.sh, no .github/workflows/*.yml, and no other script invokes the file orunittest. Concrete sequence: revert bin/backends/herdr-eventwait.py:103 tosock.connect(sock_path), run any lane or the whole suite - every lane still passes, because the only test that connects over a >104-byte path is never loaded. The new absolute-path guard test (line 88) is unexecuted for the same reason. Relocation is also the component the change did not need: the intent requires the connect fix plus a regression that fails before it, not a change of test home, and review round 2 recorded that placement move as declined. Smallest honest remedy is to remove the relocation - restore the test function and its entry in the run list at the end of tests/fm-backend-herdr.test.sh, and drop the duplicated copy from the .py file. Wiring the .py file into bin/fm-test-run.sh instead would add new runner plumbing plus coverage-guard and lane-composition semantics, so that path extends the change and needs the author's approval.🔧 Fix applied.
1 info still open:
bin/backends/herdr-eventwait.py:81- The new absolute-path diagnostic writes to stderr, but the only production caller discards it: bin/backends/herdr.sh:3422 spawns the reader as"${reader[@]}" "$sock" "$timeout" "${pane_ids[@]}" > "$fifo" 2>/dev/null &. So in production a relative socket path yields exit 2 and a silent fallback to polling, identical to every other reader failure; only tests observe the text. Behavior is correct and matches the captain decision that required the message and the exit-2 rule, so no change is needed - noting it so the message is not mistaken for an operator-visible signal.✅ **Test** - passed
✅ No issues found.
python3 bin/backends/herdr-eventwait.py <137-byte path> 1.5 pane-1against a real AF_UNIX listener: exit 0, stdout@subscribedthenpane-1 ws-7 blocked claude; artifact eventwait-long-path-fixed…git show 514e48e:bin/backends/herdr-eventwait.pydriven against the identical listener: exit 2, empty stdout, listener stuck atready; artifact eventwait-long-path-prefix.txt. bin/backends/herdr.sh; fm_backend_herdr_wait_transition demo 3 <state> demo:pane-1with a fakeherdrCLI reporting the deep socket_path and a real listener: printspane-1 ws-7 blocked claude,…FM_BACKEND_HERDR_EVENT_READERpointed at the base-commit reader: empty record,wait_transition exit: 2; artifact eventwait-adapter-deep-path-prefix.txtherdr-eventwait.py herdr.sock 1 pane-1and./sub/herdr.sock: both exit 2 withsocket path must be absolute; the control socket is connected by basename from its own directory; artifact eventwait…/nonexistent-dir-xyz/herdr.sockand/tmp/.../absent.sock: exit 2, no traceback; artifact eventwait-path-guards.txtbash tests/fm-backend-herdr.test.shexits 0 with both newok -lines; withsock.connectreverted the suite exits 1 onnot ok - eventwait could not connect over a long socket path; artifact eve…bin/fm-test-run.sh --changed --exclude-family real-herdr-gatedbash tests/fm-backend-herdr.test.sh(suite exit 0; includestest_eventwait_connects_to_long_socket_pathandtest_eventwait_rejects_a_relative_socket_path)bash tests/fm-backend-herdr.test.shwithsock.connect(socket_name)reverted tosock.connect(sock_path)(suite exit 1,not ok - eventwait could not connect over a long socket path; file restored,git status --porcelainempty)Manual live drive:python3 bin/backends/herdr-eventwait.py <137-byte socket path> 1.5 pane-1against a real AF_UNIX listener that ackssubscription_startedand emits onepane.agent_status_changedManual live drive of the same listener with the base-commit readergit show 514e48e:bin/backends/herdr-eventwait.pyManual live drive of the production caller:. bin/backends/herdr.sh; fm_backend_herdr_wait_transition demo 3 <state> demo:pane-1with a fakeherdrCLI reporting a 141-bytesocket_path, once with the target reader and once withFM_BACKEND_HERDR_EVENT_READERpointed at the base-commit readerGuard drives:herdr-eventwait.py herdr.sock 1 pane-1,./sub/herdr.sock,/nonexistent-dir-xyz/herdr.sock,/tmp/.../absent.sockpython3 tests/fm-backend-herdr-eventwait.test.py(5 tests OK)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.