Title: Fix #7693: mcpx(source): a symlink loop entry aborts the whole @dir: resolve — ELOO · Issue #7704 · developing-today/code · GitHub
Open Graph Title: Fix #7693: mcpx(source): a symlink loop entry aborts the whole @dir: resolve — ELOO · Issue #7704 · developing-today/code
X Title: Fix #7693: mcpx(source): a symlink loop entry aborts the whole @dir: resolve — ELOO · Issue #7704 · developing-today/code
Description: Implement GitHub issue #7693 in developing-today/code: mcpx(source): a symlink loop entry aborts the whole @dir: resolve — ELOOP is neither skipped like a dangling link nor pinned like a permission error Problem In mcpx's directory sourc...
Open Graph Description: Implement GitHub issue #7693 in developing-today/code: mcpx(source): a symlink loop entry aborts the whole @dir: resolve — ELOOP is neither skipped like a dangling link nor pinned like a permission...
X Description: Implement GitHub issue #7693 in developing-today/code: mcpx(source): a symlink loop entry aborts the whole @dir: resolve — ELOOP is neither skipped like a dangling link nor pinned like a permission...
Opengraph URL: https://github.com/developing-today/code/issues/7704
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fix #7693: mcpx(source): a symlink loop entry aborts the whole @dir: resolve — ELOO","articleBody":"Implement GitHub issue #7693 in developing-today/code: mcpx(source): a symlink loop entry aborts the whole @dir: resolve — ELOOP is neither skipped like a dangling link nor pinned like a permission error\n\n## Problem\n\nIn mcpx's directory source walk, one symlink loop entry makes the whole `@dir:` resolve fail — while the two neighboring bad-link cases are tolerated:\n\n- a **dangling** symlink is skipped (`pkgs/mcpx/internal/source/source.go:174-180`: `os.Stat` failure is continued past only when `errors.Is(err, fs.ErrNotExist)`, comment \"A dangling link has no regular target to read\");\n- a **directory** cycle (a dir symlink pointing back to an ancestor) is skipped by the `os.SameFile` ancestor guard in the same walk (`source.go:152-157`);\n- a symlink **loop** (a link to itself, or two links pointing at each other) makes `os.Stat` fail with ELOOP (\"too many levels of symbolic links\"), which is neither of the above: `source.go:181` returns the error and the entire directory resolution aborts with zero files read — including every healthy regular file sitting next to the loop.\n\nA 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.\n\n## Evidence (verified this run, laptop, main 8a0a1c0ceac8)\n\nProbe 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, …)`:\n\n- control (regular.ts + dangling.ts → missing): resolves OK, files = [regular.ts] — matches the shipped pin;\n- self-loop (regular.ts + loop.ts → loop.ts): **fails** — `reading …/loop.ts: stat …/loop.ts: too many levels of symbolic links`, zero files returned;\n- pair loop (regular.ts + a.ts → b.ts, b.ts → a.ts): **fails** the same way at a.ts, zero files returned;\n- control (directory back-link to the root itself): resolves OK, files = [regular.ts] — the ancestor guard tolerates the directory cycle.\n\nSo 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.\n\nRelated: 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.\n\n## Why it matters\n\n`@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.\n\n## Acceptance criteria\n\n- [ ] 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.\n- [ ] Regression tests for both loop shapes land in `pkgs/mcpx/internal/source` (mirroring the style of `TestDirectorySkipsDanglingLinkAndFollowsLinkOutsideRoot`), and fail on the pre-fix code.\n- [ ] The pinned permission behavior is unchanged: `TestDirectoryReportsInaccessibleSymlinkTarget` still 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).\n- [ ] The existing source suite (`go test ./pkgs/mcpx/internal/source/...`, or the package's normal CI route) is green with the new tests.\n\n\nRules from the repo owner: (1) Deliver the finished work as a pull request in this run; put \"Fixes #7693\" in the PR description so the issue closes on merge. (2) Cover the whole set in the one PR: if the issue names a set (files, subcommands, cases), fix every member, and batch any directly related dependency updates into the same PR — never one PR per item or per dependency. (3) Run the relevant tests and checks before opening the PR. (4) Merging is permitted but never required: merge only when checks pass and you are reasonably certain the PR is correct and low-risk — otherwise leave it open, and state your confidence and what a human should check. (5) If you hit a genuine blocker (missing credentials, a decision only the owner can make), stop and say exactly what is needed in your final summary instead of guessing. (6) Detached-session clause: never use the `question` tool — if you hit a question, record it and the default you chose in your final summary and keep working.\n\n---\nLaunched by pm-dispatch for developing-today/code. Queue task and OpenCode session ids follow in a comment below.","author":{"url":"https://github.com/apps/developing-today","@type":"Person","name":"developing-today"},"datePublished":"2026-11-08T13:38:19Z","url":"https://github.com/developing-today/code/issues/7704"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d52eaaf7-f824-6546-bdd8-09e1a16aa4d9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DA8C:305F8C:66390:8A4CB:6B0735ED |
| html-safe-nonce | ec4706e0ee99dc929c87278ac5f101ec7de56d3eae6985320bf71d2d88007975 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQThDOjMwNUY4Qzo2NjM5MDo4QTRDQjo2QjA3MzVFRCIsInZpc2l0b3JfaWQiOiI1NDI5MzMxNzEzMzAwMzEzNTgyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ccd730816013815fa01c420d2500365c36638f5b9072d1361a3ea306da7f871a |
| hovercard-subject-tag | issue:6271493773 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/7704/issue_layout |
| twitter:image | https://opengraph.githubassets.com/661c31156cddaf242db15e18d4e490ea9f2f7ae71e48e9dae930915da9430311/developing-today/code/issues/7704 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/661c31156cddaf242db15e18d4e490ea9f2f7ae71e48e9dae930915da9430311/developing-today/code/issues/7704 |
| og:image:alt | Implement GitHub issue #7693 in developing-today/code: mcpx(source): a symlink loop entry aborts the whole @dir: resolve — ELOOP is neither skipped like a dangling link nor pinned like a permission... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | developing-today[bot] |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2a60952cad7efb2604ea85e500208f51c1ec1943aa260ac605c13eb46a1ed83b |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 345c27626db08417fdfc84278a4415ae9a48d8f3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width