Skip to content

fix(mcp-server): session close 失敗を shutdown exit status に伝播 (#391) - #393

Merged
rebuildup merged 1 commit into
release-0-6-0from
391
Nov 20, 2026
Merged

rebuildup merged 1 commit into
release-0-6-0from
391

Conversation

@rebuildup

Copy link
Copy Markdown
Contributor

Closes #391。PR #379 の CodeRabbit 再レビュー指摘(Issue #384 の続き)への対応。

問題

close() は closeSessionWithTimeout が ok:false を返しても stderr 記録のみで resolve し、shutdown(143) がそのまま exit 143 で終了していた。conformance harness の isCleanServerShutdown は exit 143 + signal なしを clean と判定するため、owned AE session が実際には閉じられなかったのに verdict:"pass" を記録し得た。

変更(mcp-server/server.mjs)

  • close() が close 成否を Promise<boolean> で返す(session なし・正常 close → true、close 失敗/timeout/throw → false)。
  • catch 経路でも closeFailed = true とし、residue marker が close-failed になるよう修正(従来は throw でも closed になっていた)。
  • shutdown は closed === false のとき clean signal 経路の code(130/143)ではなく exit 1 で終了。harness 側の isCleanServerShutdown は変更不要 — exit code の伝播で既存判定が正しく fail する。

検証

  • server.test.mjs 29/29 pass(fake/mock レベル)。新規 test: 正常 close → true、close が throw → false。
  • shutdown の exit code 写像は entry の process.exit(closed === false ? 1 : code) 3 行。spawned 経路での close 失敗注入は sessionFactory が CLI flag 経由で差し替え不能なため unit contract で担保。実機 AE 未使用。

@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7144fd0b-3526-4b34-be79-aac5cafa2241

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@rebuildup
rebuildup merged commit 417c77f into release-0-6-0 Nov 20, 2026
10 checks passed
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.

1 participant