Title: fix: avoid cancelling the task closing its own connection by anishpentyala · Pull Request #191 · agentclientprotocol/python-sdk · GitHub
Open Graph Title: fix: avoid cancelling the task closing its own connection by anishpentyala · Pull Request #191 · agentclientprotocol/python-sdk
X Title: fix: avoid cancelling the task closing its own connection by anishpentyala · Pull Request #191 · agentclientprotocol/python-sdk
Description: Summary Avoid cancelling and awaiting a task that is closing its own connection. Connection.close() delegates task cleanup to TaskSupervisor.shutdown(). A request handler, notification handler or async stream observer that awaits close() was included in the cancellation/gather set itself. In a bounded local reproduction this forms a self-await cancellation cycle, logs RecursionError, and fails to complete cleanly. Exclude the current task from cancellation/gather and leave its registry entry for the normal done callback. Other owned tasks are still cancelled and awaited. The close docstring makes the caller-return behavior explicit without promising a response after transport closure. No concurrent-close redesign, schema, transport, dependency or public-signature change. Related issues No matching report found in the bounded current issue/PR and recent closed-PR checks. Existing cancellation support and subprocess shutdown work address different paths. This was found through source inspection and local reproduction, not a claimed production incident. Testing Unchanged base 8a9940744d0afa0bb3d71b4e4df8f843b061bccf: full suite 530 passed, 1 optional Gemini CLI skip on Python 3.14.9. Ten new cases on base: 8 failed with inspected RecursionError evidence, 2 external-shutdown controls passed. Regression children are bounded so a broken cancellation cycle does not poison pytest's own loop. Candidate make check: passed (lock consistency, formatting, lint, types and dependencies). Candidate make test: 540 passed, 1 same optional Gemini skip on Python 3.14.9. Full Python 3.10 suite: 539 passed, 2 skipped (Gemini and the existing eager-task-factory test requiring Python 3.12+). Fresh installed wheel outside checkout, Python 3.14: 49 targeted tests passed, covering all 10 new cases, request cancellation and connection recovery. Package import verified from site-packages. Separate NdjsonTransport byte-stream probe: candidate passed; unchanged base logged RecursionError and timed out. Real StreamReader with mocked StreamWriter protocol, not a real OS stdio-process claim. Independent automated review reproduced the exact candidate tree, the negative/positive controls, full suites, make check and installed-wheel proof, with no blocking finding. Docs & checklist Conventional Commit title. Regression and external-shutdown control tests. Connection.close docstring updated. No schema regeneration. AI assistance disclosure: AI prepared the patch, tests and description, ran the checks, and independently reviewed the candidate. No human code review, user adoption, or maintainer endorsement is claimed. Disclosure is our reporting practice, not a claim that repository rules require it.
Open Graph Description: Summary Avoid cancelling and awaiting a task that is closing its own connection. Connection.close() delegates task cleanup to TaskSupervisor.shutdown(). A request handler, notification handler or a...
X Description: Summary Avoid cancelling and awaiting a task that is closing its own connection. Connection.close() delegates task cleanup to TaskSupervisor.shutdown(). A request handler, notification handler or a...
Opengraph URL: https://github.com/agentclientprotocol/python-sdk/pull/191
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:1c1b560a-fc8b-f910-0cfa-64c01a596d1e |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A30A:205334:12EE22:1ABEBB:6B0464B2 |
| html-safe-nonce | 80d93490c17a300d8a98c3aef43529ce542612d8e33ce3bfe35773e7e15612e3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzBBOjIwNTMzNDoxMkVFMjI6MUFCRUJCOjZCMDQ2NEIyIiwidmlzaXRvcl9pZCI6Ijg1MjYxNjk4MjEzOTY4ODY3MDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e0ef4fa634fac043881d43eb5254394a64529e5b88e97940d39d0e873be5b968 |
| hovercard-subject-tag | pull_request:5219517876 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/agentclientprotocol/python-sdk/pull/191/files |
| twitter:image | https://avatars.githubusercontent.com/u/96276529?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/96276529?s=400&v=4 |
| og:image:alt | Summary Avoid cancelling and awaiting a task that is closing its own connection. Connection.close() delegates task cleanup to TaskSupervisor.shutdown(). A request handler, notification handler or a... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2d58451b4bcb73c33c67bfb6b28fb75fe6d5e279daf9b560fa4fd832f3d8c9a6 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/agentclientprotocol/python-sdk git https://github.com/agentclientprotocol/python-sdk.git |
| octolytics-dimension-user_id | 235308037 |
| octolytics-dimension-user_login | agentclientprotocol |
| octolytics-dimension-repository_id | 1051445009 |
| octolytics-dimension-repository_nwo | agentclientprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1051445009 |
| octolytics-dimension-repository_network_root_nwo | agentclientprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 03e114520787ad27289207f153520ef97461127c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width