Repository navigation
Description
Problem
In mcpx's directory source walk, one symlink loop entry makes the whole @dir: resolve fail — while the two neighboring bad-link cases are tolerated:
- a dangling symlink is skipped (
pkgs/mcpx/internal/source/source.go:174-180:os.Statfailure is continued past only whenerrors.Is(err, fs.ErrNotExist), comment "A dangling link has no regular target to read"); - a directory cycle (a dir symlink pointing back to an ancestor) is skipped by the
os.SameFileancestor guard in the same walk (source.go:152-157); - a symlink loop (a link to itself, or two links pointing at each other) makes
os.Statfail with ELOOP ("too many levels of symbolic links"), which is neither of the above:source.go:181returns the error and the entire directory resolution aborts with zero files read — including every healthy regular file sitting next to the loop.
A loop link, like a dangling link, has no regular target to read. The current split — tolerate a missing target and a directory cycle, but let a loop target deny the whole source — is an untested gap, not a pinned decision: the pinned cases in the shipped tests are dangling-skip (source_test.go:245 TestDirectorySkipsDanglingLinkAndFollowsLinkOutsideRoot), directory-cycle-safety (source_test.go:191), and permission-error propagation (source_unix_test.go:73 TestDirectoryReportsInaccessibleSymlinkTarget, which pins EACCES as a returned error and must keep behaving that way). No test covers the ELOOP case.
Evidence (verified this run, laptop, main 8a0a1c0)
Probe at ~/git/fleet/probe-mcpx-eloop on the laptop: the real pkgs/mcpx/internal/source/source.go copied verbatim (md5 768194633188160a349eafd555defe53, identical to the file on main) into a standalone module, driven through the exported source.Resolve("@dir:"+root, …):
- control (regular.ts + dangling.ts → missing): resolves OK, files = [regular.ts] — matches the shipped pin;
- self-loop (regular.ts + loop.ts → loop.ts): fails —
reading …/loop.ts: stat …/loop.ts: too many levels of symbolic links, zero files returned; - pair loop (regular.ts + a.ts → b.ts, b.ts → a.ts): fails the same way at a.ts, zero files returned;
- control (directory back-link to the root itself): resolves OK, files = [regular.ts] — the ancestor guard tolerates the directory cycle.
So one stray looped link (easily produced by a bad ln -s pair or a tool that links a directory's contents into itself at file level) takes down every launcher/prefix/hook that reads its source from that directory, with an error that names the link but gives no way to keep the healthy remainder.
Related: closed #1727 covered non-regular files in directory sources (FIFO/socket/symlink-to-directory); this is the distinct remaining Stat-error class for file entries. The Go source lives only in this repo (pkgs/mcpx); dezren39/darwin-nix only wraps/launches the built mcpx, so no cross-repo set applies. Found via a pr-diff-review REVIEW-FINDING on PR #3744 that was left as decide-and-test material; verified independently this run before filing.
Why it matters
@dir: sources feed mcpx launchers, prefixes, and error hooks. A single looped symlink — which the directory-cycle guard already proves the walk intends to survive at directory level — currently denies the whole source instead of just the unreadable entry. Robustness here should be uniform: an entry with no readable regular target is skipped (dangling, loop), while genuinely informative errors (permission) still surface, per the existing pin.
Acceptance criteria
- A directory containing a self-loop symlink or a mutually-looping symlink pair, plus at least one regular file, resolves successfully and returns exactly the regular files (the loop entries skipped), for both the self-loop and pair-loop shapes.
- Regression tests for both loop shapes land in
pkgs/mcpx/internal/source(mirroring the style ofTestDirectorySkipsDanglingLinkAndFollowsLinkOutsideRoot), and fail on the pre-fix code. - The pinned permission behavior is unchanged:
TestDirectoryReportsInaccessibleSymlinkTargetstill passes — only the ELOOP class changes disposition, not EACCES or other Stat errors (or, if the fix deliberately widens/narrows which Stat errors skip, the disposition of each class is named in the PR and the affected pins updated with rationale). - The existing source suite (
go test ./pkgs/mcpx/internal/source/..., or the package's normal CI route) is green with the new tests.
Activity
developing-today commentedon Nov 8, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 10, 2026
🤖 Agent note · triaged
task/small-fix· priority/normal · effort/s ·kind/bugrepo-health:v1:fix:developing-today/code:issue:7693→ queuerepo-health-code-pilot, task 14506 (enqueued by triage-step this run).14 remaining items
dezren39 commentedon Nov 11, 2026
Lane code-b, task 14506 — implementation complete, parked on CI for PR #8451.
pkgs/mcpx/internal/sourcewalk now skipssyscall.ELOOPfromos.Statexactly like a dangling link (fs.ErrNotExist); regression testTestDirectorySkipsSymlinkLoopcovers a self-loop and a two-link loop alongside a regular file.go test ./internal/source/green, go vet + gofmt clean. Full-module run showed two failures (internal/configTestServerKeysAnotherHostWritesAreRecordedNotRefused,internal/conformanceTestMessagesClient) — both reproduced identically on pristine main, pre-existing and unrelated; details in the PR body.dezren39 commentedon Nov 11, 2026
Agent note — picked up task 14506 and parked it again for 20 minutes: PR #8451 remains open with basic CI checks queued since 02:38 UTC. Resume by checking CI and review fresh, then merge if verified. Existing parked and assigned labels remain in place.
dezren39 commentedon Nov 11, 2026
state: parked (CI wait; Codex dispositioned clean)
task 14506 (small_fix) — issue #7693 — lane tmp-code-y, 2026-11-11
Resumed task 14506 at its recorded next step and re-verified fresh: issue #7693 OPEN, no hard-stop labels, no status/needs-triage; PR #8451 OPEN on branch queue/14506-7693-eloop-skip, head aba3c8a. Codex gate: Codex review summary on PR #8451 for commit aba3c8a reports code review COMPLETED, has_any_findings=false, has_unresolved_findings=false — no findings to disposition. Check rollup at this read: 17 QUEUED, 3 SKIPPED, 1 NEUTRAL — the fleet CI queue stall, not a PR failure.
Terminal for this shift: task 14506 parked as a CI wait on PR #8451. Resume: when PR #8451 checks complete, merge PR #8451, verify the fix on main, then complete task 14506 and close issue #7693.
Merge pull request #8451 from developing-today/queue/14506-7693-eloop…
dezren39 commentedon Nov 11, 2026
🤖 Agent note · done
awaiting_ci).errors.Is(err, syscall.ELOOP)treated like the dangling-link skip inpkgs/mcpx/internal/source/source.go) plusTestDirectorySkipsSymlinkLoopnaming its oracle. Codex review on that head completed with zero findings. Checks were still queued in the fleet runner backlog (17 queued, no failures) — merged per fleet policy for a verified, Codex-clean PR; test evidence is on the PR (go test ./internal/source/green, vet/gofmt clean; two full-module failures reproduced identically on pristine main, pre-existing).