Skip to content

feat(runtime): execute Python awaitables as single-response RPC calls #338

Closed

Description

@bbopen

Generated async Python calls currently fail when the bridge serializes their coroutine.

Reproduced on 6b84614: fixtures.typing_torture.async_text throws Object of type coroutine is not JSON serializable. Its generated wrapper promises a string result. handle_call immediately serializes the call result.

Acceptance criteria:

  • Define event-loop ownership for subprocess and Pyodide before implementation.
  • The generated async_text wrapper returns "awaited" through Node and actual Pyodide.
  • Coroutine exceptions retain the existing error envelope and call context.
  • Timed-out coroutines cannot desynchronize later requests or produce duplicate responses.
  • Define cancellation and disposal behavior explicitly.
  • Generators and async generators continue to reject explicitly.
  • Preserve one request and one response without handles, retries, streaming, or result caching.

Actual Pyodide coverage in #341 is a prerequisite for claiming browser support. Coordinate unsupported-callable diagnostics with #335.

Architectural approach:

Represent execution requirements in #335 so unsupported combinations produce diagnostics. Coroutine invocation, scheduling, and disposal remain runtime implementation work in this issue. Coordinate through #345.

Activity

  1. added this to the Backlog milestone on Sep 11, 2026
  2. self-assigned this
    on Sep 11, 2026
  3. bbopen commented on Sep 20, 2026

    @bbopen
    OwnerAuthor

    Node and actual Pyodide now execute coroutine results through the existing request/response protocol. Generated async wrappers retain precise awaited return types. Tests cover structured errors, event-loop ownership, timeout recovery, cancellation, disposal, and rejection of generators and async generators. The release also isolates retired subprocess callbacks and queued writes from a replacement process.

    Evidence: runtime/tywrap_bridge_core.py, src/runtime/subprocess-transport.ts, test/runtime_coroutines.test.ts, test/runtime_pyodide_real.conformance.ts, and docs/maintainers/coroutines.md.

    Verified release evidence:

    The architecture decision records the accepted scope and prototype limits.

    Closing with the implemented and verified 0.11 release outcome.

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

Metadata

Metadata

Assignees

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions