Skip to content

fix(session): compare server entrypoint file identity - #8849

Closed
1052326311 wants to merge 1 commit into
morluto:mainfrom
1052326311:fix/server-identity-path
Closed

1052326311 wants to merge 1 commit into
morluto:mainfrom
1052326311:fix/server-identity-path

Conversation

@1052326311

Copy link
Copy Markdown
Contributor

Summary

Fixes #8844. binary_session now compares the selected entrypoint file when two absolute path spellings differ, so a Bun launch through a directory symlink followed by .. no longer receives false restart advice.

Problem and expected behavior

On main@c3647ade1, an actual Bun 1.4.4 MCP server launched through link/../scripts/rea.mjs reported registration_path_mismatch for that exact caller path even though it selected the same file as the canonical entrypoint. Lexical resolve() changes the meaning of this POSIX path after symlink traversal.

Change and scope

The server identity owner compares equal spellings directly and, on POSIX when spellings differ, compares filesystem device/inode identity. A different file remains a mismatch; if either path cannot be inspected, the result remains unknown with explicit guidance. Windows retains its existing lexical path behavior. This is an ordinary fix within the existing read-only session status contract; no new provider or target authority is added.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/serverIdentity.ts; the binary_session MCP result consumes this alignment decision. No parallel path interpretation remains in this flow.
  • Contribution scope fit and linked maintainer decision: ordinary existing-contract fix; new-capability scope decision not applicable.
  • CLI and MCP/tool-catalog contract: server_identity.alignment stops giving false restart advice for a verified same-file caller path. Schema and catalog unchanged.
  • Provider, bridge, target-format, or platform compatibility: observed on macOS/Bun; Windows branch unchanged and not run here.
  • Evidence, artifact, provenance, or reconstruction contract: no target evidence is read or changed.
  • Target selection, authority, upstream behavior, and cleanup: no target selected; only local entrypoint file metadata is inspected.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Read existing files or captured data (entrypoint metadata only).
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added: a real symlink/parent-traversal fixture checks same-file alignment, distinct-file mismatch, and a missing expectation producing unknown.
  • Base reproduction: this regression failed on main@c3647ade1 with registration_path_mismatch and passed with this change.
  • User-visible MCP output: the built candidate was launched as a real Bun 1.4.4 MCP server. Both the launch spelling and canonical control returned {"state":"aligned","reasons":[],"remediation":null} from binary_session on the same session.
  • Boundary coverage: owner comparison and next MCP consumer exercised. No target provider or lifecycle operation was involved. Linux, Windows and other Bun versions were not run.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- tests/boundary/mcp/serverIdentity.test.ts src/contracts/sessionPathInputs.test.ts on Node 24.22.1: 26 passed, 3 skipped.
  • npm run check:fast on Node 24.22.1: passed.
  • npm run check on Node 24.22.1: passed (format, typecheck, lint, Knip, architecture guards and typed lint; existing advisory warnings remain).
  • Real Bun 1.4.4 MCP probe on macOS 27.2 arm64: both same-file path spellings returned aligned.
  • git diff --cached --check before commit: passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; previously false mismatch becomes aligned and uninspectable paths become unknown.
  • Real Hopper/Ghidra, browser, or OS coverage: no provider needed; macOS/Bun exercised, Linux/Windows not run.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: local stat of the two supplied entrypoint paths only; no target access or mutation.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@greptile-apps

greptile-apps Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

Changes binary_session to compare filesystem device/inode identity when POSIX entrypoint spellings differ.

  • Session identity recognizes alternate paths to the same entrypoint.

Reviews (1) · Last reviewed commit: "fix(session): compare entrypoint file id..." · Reviewed by Greptile

@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: All 12 tests in the changed test file passed on three Node versions. With src/serverIdentity.ts set back to the merge base, 1 of 12 tests failed on each version. I did not run two createServerIdentity probes or a merge with current main.

I ran tests/boundary/mcp/serverIdentity.test.ts on head 052bcd1. The red run used the same head and test file. src/serverIdentity.ts came from the merge base c3647ad.

Check Node 22.23.4 Node 24.22.1 Node 26.12.1
Head 052bcd1 pass: 1 of 1 files, 12 of 12 tests pass: 1 of 1 files, 12 of 12 tests pass: 1 of 1 files, 12 of 12 tests
Red run (source from c3647ad) fail: 1 of 1 files, 1 test failed, 11 passed fail: 1 of 1 files, 1 test failed, 11 passed fail: 1 of 1 files, 1 test failed, 11 passed
  • The red run on Node 24.22.1 failed compares the selected entrypoint through symlink and parent traversal.
  • The red run failed the same test on Node 22.23.4 and 26.12.1.
  • The PR changes 2 files against the merge base: src/serverIdentity.ts and tests/boundary/mcp/serverIdentity.test.ts.
  • The head is 345 commits behind main c78c8ae.
  • GitHub shows the PR as draft, mergeable true, state unstable.
  • Workflow runs: CI completed/success, PR readiness completed/success, PR title completed/success, CodeQL production completed/skipped.
  • 19 check runs succeeded. They include Build bundled Windows x64 native controls. Build package, CI required and Classify changes succeeded too. Conventional PR title and Greptile Review succeeded. Also Native package baseline (linux x64), Portable tests and Source tests succeeded. Static checks and Validate author declaration succeeded. The eight checks Test shard (1/8) through Test shard (8/8) succeeded.
  • 25 check runs were skipped.
  • The commit status PR readiness is pending.

Not run

  • A probe calls createServerIdentity with a nonexistent expected.server_path, a wrong package_version and a real commandPath. The probe would check whether state is unknown or restart-required.
  • A probe calls createServerIdentity with a server_path that existed and was then removed or moved. The probe would exercise the observed-missing path that no test covers.
  • A merge with current main, c78c8ae.
Test setup
  • Box: Fedora 44 VM (4 vCPUs, 8 GB) on my Nobara 44 PC, Linux 7.2.11
  • Node: 22.23.4, 24.22.1, 26.12.1
  • Head / base: 052bcd1 / c3647ad (merge base with main)
  • Red run: 052bcd1 with the changed source file from c3647ad
  • Install: npm ci --offline and npm run test:prepare on Node 24.22.1
Commands
npm ci --offline
npm run test:prepare
xvfb-run -a npm run test:focused -- tests/boundary/mcp/serverIdentity.test.ts

🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

gensokyo-dev added a commit that referenced this pull request Nov 14, 2026
Fixes #8844
Supersedes #8849

Co-Authored-By: gensokyo-dev <[email protected]>
gensokyo-dev added a commit that referenced this pull request Nov 14, 2026
Fixes #8844
Supersedes #8849

Co-Authored-By: gensokyo-dev <[email protected]>
N0zoM1z0 pushed a commit that referenced this pull request Nov 14, 2026
@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Thank you for this fix. It landed in #10499 with your authorship kept on the commit (adapted where noted in the PR), so I'm closing this PR as superseded.

@N0zoM1z0 N0zoM1z0 closed this Nov 14, 2026
@morluto morluto added area: server Server layer and tool wiring bug Something isn't working labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: server Server layer and tool wiring bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] binary_session reports a registration mismatch for the same Bun entrypoint through symlink/parent traversal

4 participants