Skip to content

[runtime][python] Add Python durable reconciler support#614

Merged
xintongsong merged 6 commits into
apache:mainfrom
joeyutong:codex/reconcile-callable-pr2
Apr 14, 2026
Merged

[runtime][python] Add Python durable reconciler support#614
xintongsong merged 6 commits into
apache:mainfrom
joeyutong:codex/reconcile-callable-pr2

Conversation

@joeyutong
Copy link
Copy Markdown
Contributor

Linked issue: #612

Purpose of change

This PR adds Python-side durable reconcile support based on a reconciler callable.

It builds on the Java durable reconciler runtime introduced in #600 and adds the Python API and runtime wiring needed to use the same recovery model from Python actions.

This PR includes:

  • a new optional reconciler keyword-only argument on Python RunnerContext.durable_execute(...) and durable_execute_async(...)
  • Python runtime support in FlinkRunnerContext for replaying previously completed durable results and recovering successful outcomes through a reconciler callable
  • success-only reconciler semantics that match the merged Java contract:
    • returning a result persists and replays the recovered successful outcome
    • throwing an exception propagates that exception to the caller and does not persist a recovered terminal outcome
  • local runner support that accepts the new reconciler argument and degrades to the existing non-durable behavior
  • import-time decoupling from AgentPlan in Python runner modules, so lightweight runner tests do not eagerly pull in the heavier plan/action/PyFlink dependency chain
  • a small Java bridge addition in RunnerContextImpl so the Python runtime can read the current durable call result fields during recovery

The detailed design discussion is available here:

Tests

This change is covered by:

  • test_durable_execution.py: verifies durable execution helpers and reconciler callable validation
  • test_flink_runner_context_reconcilable.py: verifies recovered success, terminal replay, and exception propagation in the Flink runner context
  • test_local_runner_reconcilable.py: verifies that local runner accepts the new reconciler argument and degrades to the existing non-durable behavior
  • Java runtime compile: verifies the new bridge method used by the Python runtime compiles against the runtime module

API

Yes.

This PR introduces Python public API changes:

  • RunnerContext.durable_execute(...) adds an optional keyword-only reconciler: Callable[[], Any] | None = None
  • RunnerContext.durable_execute_async(...) adds the same optional reconciler keyword-only argument

Documentation

  • doc-needed
  • doc-not-needed
  • doc-included

@github-actions github-actions Bot added doc-needed Your PR changes impact docs. fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue. labels Apr 8, 2026
Copy link
Copy Markdown
Contributor

@xintongsong xintongsong left a comment

Choose a reason for hiding this comment

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

LGTM

@xintongsong xintongsong merged commit 84f990c into apache:main Apr 14, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-needed Your PR changes impact docs. fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants