Skip to content

feat(plugin): report incomplete user function outcomes - #661

Merged
wangyb-A merged 4 commits into
mainfrom
feat/user-function-incomplete-outcome
Aug 20, 2026
Merged

feat(plugin): report incomplete user function outcomes#661
wangyb-A merged 4 commits into
mainfrom
feat/user-function-incomplete-outcome

Conversation

@wangyb-A

Copy link
Copy Markdown
Contributor

Summary

  • add UserFunctionOutcome.INCOMPLETE without adding a new plugin hook or info type
  • guarantee every on_user_function_start is paired with exactly one existing on_user_function_end, including suspension and other BaseException exits
  • release OTel context scopes for incomplete CONTEXT and STEP user functions without marking or ending incomplete STEP spans
  • document the three-outcome lifecycle contract and update the suspension/threading regression tests

Semantics

INCOMPLETE means the current user-function execution left without producing a success or failure outcome. It covers suspension, orphaned branches, background checkpoint failures, and interpreter-exit control flow. Plugins receive it on the thread that executed the user function, allowing thread-bound state to be released. A suspended operation may resume later and report another start/end pair with its eventual outcome.

No new DurableInstrumentationPlugin callback or payload type is introduced. SUCCEEDED and FAILED behavior is unchanged.

Validation

  • hatch run test:all — 3253 passed, 2 skipped, 5 subtests passed
  • hatch run types:check — clean
  • hatch run dev-core:typecheck — clean
  • hatch run dev-otel:typecheck — clean
  • hatch run dev-otel:test — 146 passed
  • hatch fmt --check — clean
  • independent diff review — no blocking findings

Resolves #658

@wangyb-A
wangyb-A deployed to ai-pr-review August 19, 2026 22:15 — with GitHub Actions Active
@wangyb-A
wangyb-A temporarily deployed to ai-pr-review-runtime August 19, 2026 23:54 — with GitHub Actions Inactive
@wangyb-A
wangyb-A had a problem deploying to ai-pr-review-runtime August 19, 2026 23:54 — with GitHub Actions Failure
Comment thread packages/aws-durable-execution-sdk-python/tests/state_test.py
@github-actions

This comment has been minimized.

@wangyb-A
wangyb-A force-pushed the feat/user-function-incomplete-outcome branch from 574f651 to 08ac2f9 Compare August 20, 2026 20:34
@wangyb-A
wangyb-A deployed to ai-pr-review August 20, 2026 20:34 — with GitHub Actions Active
@wangyb-A
wangyb-A deployed to ai-pr-review-runtime August 20, 2026 20:54 — with GitHub Actions Active
@wangyb-A
wangyb-A had a problem deploying to ai-pr-review-runtime August 20, 2026 20:54 — with GitHub Actions Failure
@github-actions

This comment has been minimized.

@wangyb-A
wangyb-A marked this pull request as ready for review August 20, 2026 21:26
@wangyb-A
wangyb-A had a problem deploying to ai-pr-review-runtime August 20, 2026 21:26 — with GitHub Actions Failure
@wangyb-A
wangyb-A had a problem deploying to ai-pr-review-runtime August 20, 2026 21:26 — with GitHub Actions Failure
Removed section on user-function hooks and thread-bound state from README.
Remove unnecessary blank line in README.
@wangyb-A
wangyb-A merged commit 2b119dd into main Aug 20, 2026
28 of 35 checks passed
@wangyb-A
wangyb-A deleted the feat/user-function-incomplete-outcome branch August 20, 2026 21:36
@wangyb-A
wangyb-A had a problem deploying to ai-pr-review-runtime August 20, 2026 21:40 — with GitHub Actions Failure
@wangyb-A
wangyb-A deployed to ai-pr-review-runtime August 20, 2026 21:40 — with GitHub Actions Active
class UserFunctionOutcome(Enum):
SUCCEEDED = "SUCCEEDED"
FAILED = "FAILED"
INCOMPLETE = "INCOMPLETE"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Codex AI review

[P1] Version the new lifecycle contract across packages

The plugin API remains v1, so a core-only upgrade still loads existing v1 plugins. Released OTel plugins treat every non-FAILED STEP end as success, causing INCOMPLETE attempts to be exported as successful. Conversely, this PR's OTel package still permits core >=1.8.0, where INCOMPLETE does not exist, so its new enum access raises AttributeError on every STEP end. Increment the core/plugin-provider API version and OTel core dependency floor together, or add a compatibility shim, with mixed-version tests in both directions.

@github-actions

Copy link
Copy Markdown
Contributor

Codex AI review

One blocking cross-version compatibility issue remains in the core/OTel plugin lifecycle contract.

Reviewed commit 48df93edf85e5fe0d197415f8f49e4fdc6e0c45a. Workflow run

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.

[plugin] Notify plugins when a user function does not complete

2 participants