Skip to content

[codex] Improve filesystem startup directory diagnostics#4278

Draft
tarunag10 wants to merge 1 commit into
modelcontextprotocol:mainfrom
tarunag10:codex/filesystem-invalid-dir-reporting
Draft

[codex] Improve filesystem startup directory diagnostics#4278
tarunag10 wants to merge 1 commit into
modelcontextprotocol:mainfrom
tarunag10:codex/filesystem-invalid-dir-reporting

Conversation

@tarunag10
Copy link
Copy Markdown

Summary

This improves filesystem server startup diagnostics for invalid allowed-directory arguments.

The current source already skips invalid directories and only exits when none of the specified directories are accessible, which matches the behavior requested in #4238. However, the stderr warnings for inaccessible paths were still generic and the hard-fail path did not list the invalid arguments or their concrete failure reasons. In host environments that hide or truncate child-process stderr, every extra bit of actionable startup output matters.

Root Cause / User Impact

A missing or invalid allowed directory can be difficult to diagnose from a host-level "transport closed" failure. The current startup validation says that a directory cannot be accessed, but it drops the underlying error message such as ENOENT, and when all directories are invalid it exits without enumerating the failed inputs.

Fix

  • Record invalid allowed directories during startup validation with a concrete reason.
  • Emit warnings in a consistent Skipping invalid allowed directory format that includes the directory and reason.
  • When no requested directories are accessible, print a compact invalid-directory list before exiting.
  • Tighten the startup validation test harness so child processes are terminated after the server emits its startup banner instead of relying only on a blind timeout.
  • Extend startup tests to assert missing-directory stderr includes the path and ENOENT, and that all-invalid startup reports each failed directory.

Validation

  • npm ci
  • npm run build --workspace @modelcontextprotocol/server-filesystem
  • npx vitest run src/filesystem/__tests__/startup-validation.test.ts --config src/filesystem/vitest.config.ts
  • npm test --workspace @modelcontextprotocol/server-filesystem
  • git diff --check

Fixes #4238.

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.

[server-filesystem] Single missing allowed-directory causes silent process exit due to Promise.all rejection

1 participant