Skip to content

Add opt-in task polling and input responses to the PHP client - #781

Open
xixi-box wants to merge 1 commit into
modelcontextprotocol:mainfrom
xixi-box:fix/issue-349-f3c45eb-6eb3d56e
Open

xixi-box wants to merge 1 commit into
modelcontextprotocol:mainfrom
xixi-box:fix/issue-349-f3c45eb-6eb3d56e

Conversation

@xixi-box

Copy link
Copy Markdown
Contributor

Fixes #349

Refs #349. The typed client tried to parse a task handle as a completed tool response and rejected it because it had no content array. Add a generic request API and an opt-in Tasks facade that decodes task handles, polls their state, submits keyed input responses, and requests cancellation. Existing typed client methods retain their return types, and applications control polling and input handling.

Tests: vendor/bin/phpunit --testdox tests/Integration/TasksTest.php.
Result: Before source changes, vendor/bin/phpunit --testsuite=unit passed with 3,994 tests and 11,716 assertions.
Result: Before source changes, vendor/bin/phpunit tests/Integration/StatelessClientTest.php tests/Integration/DualEraEndpointTest.php tests/Integration/CompletionTest.php tests/Integration/HandshakeTest.php tests/Integration/HeaderAgreementTest.php passed with 43 tests and 77 assertions.
Result: Base vendor/bin/phpunit --testdox tests/Integration/TasksTest.php exited 2 with the missing content error. See OSSCOUT_BASE.log.
Result: Patched vendor/bin/phpunit --testdox tests/Integration/TasksTest.php exited 0 with 5 tests and 35 assertions. See OSSCOUT_PATCHED.log.
Result: make ci exited 0. PHP CS Fixer changed zero files, PHPStan reported no errors, and Deptrac reported zero violations. PHPUnit reported 4,443 tests, 13,741 assertions and 8 skips across unit, integration and interop.
Result: make conformance-tests exited 0 after applying the repository CI permissions to the Docker fixture directories. The server scored 80/80, the client scored 252/252, and all three client authorization extension runs passed.
Result: make conformance-draft exited 0 after the same fixture permission setup. The server scored 152/152 and the client scored 417/417.
Result: make docs-guides exited 0 and reported no issues in the strict build.
Result: php -l passed for all 13 PHP files in the patch inside Docker image php:8.2-cli-alpine using PHP 8.2.36.
Result: git diff --check passed, and the tracked Composer manifest, Node lockfile and CI workflows showed no changes.
Regression coverage: tests/Integration/TasksTest.php.

Signed-off-by: wangshun <96341168+xixi-box@users.noreply.github.com>

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Client] SEP-2663 Tasks: Poll task handles and answer inputRequests

1 participant