Skip to content

fix(web): cancel non-streaming action runs on client disconnect #125

Closed

Description

@huangjeff5

The non-streaming branch of the web handlers (genkit_fastapi/_handler.py, genkit_flask/_handler.py, genkit_django/_handler.py) awaits action.run(...) to completion even after the HTTP client disconnects.

In JS Express, response.on('close') aborts the non-streaming run.

Follow-up from #51 (which handles the streaming StoppableStream / to_sse path): wire client-disconnect cancellation into the non-streaming run() branch across FastAPI, Flask, and Django.

Activity

  1. huangjeff5 commented on Nov 13, 2026

    @huangjeff5
    CollaboratorAuthor

    Addressed directly in PR #51 (7c3ffb0): FastAPI now cancels non-streaming action_obj.run(...) via request.is_disconnected(), and Django ASGI's native ASGIHandler cancellation is covered by a test (Flask is WSGI and has no pre-response disconnect channel).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions