Skip to content

[Server] Replace fiber suspension arrays with typed VOs - #557

Open
chr-hertel wants to merge 1 commit into
modelcontextprotocol:mainfrom
chr-hertel:server-suspension-vos
Open

chr-hertel wants to merge 1 commit into
modelcontextprotocol:mainfrom
chr-hertel:server-suspension-vos

Conversation

@chr-hertel

Copy link
Copy Markdown
Member

ClientGateway now suspends with NotificationSuspension / RequestSuspension instead of untyped ['type' => ...] arrays - Protocol::handleRequest(), Protocol::handleFiberYield() and StatelessProtocol check instanceof instead of re-validating the array shape in three places.

  • FiberSuspend now points at the union of the two VOs
  • only matters for code suspending with the old array shape itself - custom transports just pass the value through
  • client side (await_response array in Client\Protocol) is left for a follow up

@chr-hertel chr-hertel added Server Issues & PRs related to the Server component enhancement Request for a new feature that's not currently supported labels Oct 8, 2026
@chr-hertel
chr-hertel requested a balanced review from Copilot October 8, 2026 00:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An existing regression test still yields an array and silently bypasses the outbound dispatch behavior it should cover.

1 open finding
What changed in this PR

Replaces server-side fiber suspension arrays with typed value objects, simplifying dispatch while leaving client-side suspensions unchanged.

Changes:

  • Adds typed notification and request suspension objects.
  • Updates gateway producers, protocol consumers, and transport type annotations.
  • Adapts tests and adds outgoing-queue coverage.
File Description
tests/​Unit/​Server/​ProtocolTest.php Adds typed suspension dispatch tests.
tests/​Unit/​Server/​InputRequiredShimTest.php Checks typed request suspensions.
tests/​Unit/​Server/​ClientGatewayTest.php Updates suspension assertions.
src/​Server/​Transport/​TransportInterface.php Updates the suspension type alias.
src/​Server/​Suspension/​RequestSuspension.php Defines the request suspension object.
src/​Server/​Suspension/​NotificationSuspension.php Defines the notification suspension object.
src/​Server/​Stateless/​StatelessProtocol.php Consumes typed suspension objects.
src/​Server/​Protocol.php Replaces array checks with object checks.
src/​Server/​ClientGateway.php Produces typed suspension objects.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread src/Server/Protocol.php
@chr-hertel
chr-hertel force-pushed the server-suspension-vos branch from e955ac6 to 1d06b0b Compare October 8, 2026 00:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The migration is consistent across producers, consumers, and tests, with no blocking issues identified.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Request for a new feature that's not currently supported Server Issues & PRs related to the Server component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants