Skip to content

fix(runtime): report interrupted requests - #416

Merged
WH-2099 merged 2 commits into
mainfrom
fix/report-interrupted-requests
Nov 2, 2026
Merged

WH-2099 merged 2 commits into
mainfrom
fix/report-interrupted-requests

Conversation

@WH-2099

@WH-2099 WH-2099 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Plugin requests interrupted by gevent.Timeout or GreenletExit can finish without sending session error and end frames, leaving the caller waiting.
Serverless also treats GreenletExit as a successful task result and can send a misleading end without an error.

Handle these interruptions at the shared request boundary, and propagate a Serverless task's GreenletExit when its response is still open.
Errors preserve their original type, message, and traceback; request finalization releases the worker for the next request.
The existing client-disconnect cancellation tests continue to pass.
Remove the redundant README sections for HTTP error responses, request interruption, and agent token estimates.

Target release: SDK 0.11.0.
Refs #413.

Compatibility check

  • Reviewed backward and forward compatibility: the fix uses the existing session error/end schema and provider interfaces.
  • Reviewed breaking-change requirements: this corrects request failure reporting within the planned 0.11.0 release.
  • Recorded the compatibility impact and release target in this description; package metadata already specifies 0.11.0.

Validation

  • Reproduced eight failing timeout/cancellation cases before the fix, including failures after a streamed chunk.
  • Verified actual timed interruptions and greenlet kills, cleanup, and reuse of a single worker for the next request.
  • Passed the 62 IO Server and Serverless tests, including client disconnects.
  • just check passed.
  • just test --cov --cov-report=json:reports/coverage.json --cov-report=term-missing:skip-covered passed: 1,815 tests on Python 3.12.
  • Coverage gates passed: SDK 96.97% lines / 93.30% branches; runtime 97.14% / 93.09%; HTTP 96.64% / 92.73%.
  • just build passed for the 0.11.0 wheel and source distribution.

Live deployment validation is still pending.

@WH-2099 WH-2099 added this to the 1.19.0 milestone Nov 2, 2026
Copilot AI balanced review requested due to automatic review settings November 2, 2026 04:14
@WH-2099 WH-2099 self-assigned this Nov 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the shared-runtime and Serverless interruption-handling changes.

No open issues 🎉

What changed in this PR

Fixes interrupted request reporting in the SDK’s shared runtime and Serverless transport for the planned 0.11.0 release, preventing callers from waiting indefinitely or receiving a misleading successful completion.

Changes:

  • Handles uncaught gevent.Timeout and GreenletExit at the shared request boundary.
  • Propagates Serverless task cancellation when the response remains open.
  • Adds interruption and worker-reuse regression tests, plus release documentation.
File Description
tests/​servers/​test_io_server.py Tests interruption reporting, error details, cleanup, and worker reuse.
src/​dify_plugin/​core/​server/​serverless/​response_writer.py Propagates GreenletExit results while the response is open.
src/​dify_plugin/​core/​server/​io_server.py Includes timeouts and greenlet cancellation in request error handling.
README.md Documents interruption behavior for SDK 0.11.0.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 2, 2026 04:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block approval of the interruption-reporting changes.

No open issues 🎉

Review effort: Balanced

@WH-2099
WH-2099 enabled auto-merge (squash) November 2, 2026 04:34
@WH-2099
WH-2099 merged commit 8ae50c7 into main Nov 2, 2026
8 checks passed
@WH-2099
WH-2099 deleted the fix/report-interrupted-requests branch November 2, 2026 05:07
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.

3 participants