[Bug]: Fix AI operation execution boundaries
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- aws, python
- Lĩnh vực
- backend-api-design, testing
Hướng nghiên cứu
Start with the listed AI implementation files, especially _shared.py, retry.py, transports.py, llm.py, and decider.py, and read their corresponding AI unit tests. Work through the eight required changes and add the specified branch-level tests, then add an end-to-end replay test under tests/e2e. Done means all acceptance criteria pass, including tests, type checks, formatting, and lint.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Expected Behavior
The experimental AI operations should enforce their public contract at each execution boundary:
- The extras package requires a core SDK version that supports custom step subtypes.
- An
AiTimeoutErrorretries in a later invocation, not during the ten-second reserve left for checkpointing. - An interrupted HTTP response is a retryable transport failure.
- The request thread preserves the step's context variables.
- An unavailable invocation deadline counts as no deadline.
llm().askcheckpoints only a response known to be complete.- A decider input is serialized once before the durable step starts.
- The documentation states the minimum usable function timeout.
Actual Behavior
Python SDK #928: add experimental decider and LLM operations merged these operations in the AI operations merge commit 8fbb2459. The following cases remain:
- The extras package allows core SDK 2.x, but every AI operation constructs
StepConfig(sub_type=...). Core 2.x has nosub_typeparameter, so a call fails withTypeErrorbefore it creates an operation. default_ai_retry_strategyschedules the first timeout retry after two seconds. A sibling operation can keep the invocation alive, allowing retries to start during the ten-second reserve and fail without calling the model.- The HTTP transport catches
URLErrorandOSError, but nothttp.client.HTTPException.IncompleteReadfrom either response-body read therefore becomes a non-retryableStepError. - The deadline path starts a bare daemon thread. Context variables set by the step, including an active OpenTelemetry context, are absent inside boto3, urllib, and custom transport calls.
- Deadline property access and invocation are not protected. A throwing getter fails the step, and non-finite numeric values reach the wait calculation.
llm().askaccepts a response with nostopReasonand checkpoints any text in it, although the response is not known to be complete.- Each decider call serializes its input for preflight validation, then serializes it again inside the step. A supported container subclass with observable iteration runs twice and can produce a different request on the second serialization.
- The retry documentation promises a new invocation, but it does not state that a function timeout of ten seconds or less leaves no request budget.
Steps to Reproduce
These results reproduce on main at 8fbb2459 with Python 3.14:
- Constructing
StepConfig(sub_type="LlmAsk")with core SDK 2.0.0 raisesTypeError: StepConfig.__init__() got an unexpected keyword argument 'sub_type'while the extras dependency accepts that version. - In a local-runner
parallel, give the AI call about 10.05 seconds remaining and keep a sibling active for seven seconds. Attempts 2 and 3 restart in the first invocation, during the reserve, without another model call. Attempt 4 runs in the next invocation. - Make an HTTP response's
read()raisehttp.client.IncompleteRead. The exception escapes_http_transport, anddefault_ai_retry_strategyreturns no retry. - Set a
ContextVarbeforecall_before_deadline. It has the set value without a deadline and its default value inside the deadline thread. - Return Bedrock output text without
stopReason._conversereturns the text instead of raisingLlmStoppedError. - Give
decider().checkalistsubclass whose__iter__records calls. It is iterated twice.
All 145 current AI tests pass, so they do not cover these outcomes.
SDK Version
main at 8fbb2459; introduced by Python SDK #928: add experimental decider and LLM operations. No release tag contains this commit as of 2026-11-13.
Python Version
3.14. The defects are not specific to 3.14.
Is this a regression?
No. These behaviors were introduced with the experimental AI operations.
Last Working Version
N/A
Required Changes and Tests
- Require
aws-durable-execution-sdk-python>=3.0.0directly. Do not add a core 2.x fallback. - Give
AiTimeoutErrora minimum retry delay greater thanINVOCATION_RESERVE_SECONDS, and test it with a decreasing deadline and a running parallel sibling. - Convert
http.client.HTTPExceptionfailures from both response-body reads intoDeciderError; preserve an HTTP error status when headers were received. Add truncated 200 and truncated error-response tests. - Run the request thread under
contextvars.copy_context().run, with a test that reads a context variable inside a transport. - Treat an exception, non-number, or non-finite deadline reading as no deadline, with a test for each branch.
- Raise
LlmStoppedErrorwhenstopReasonis missing, with and without response content. - Capture the validated serialized decider input and pass that string into the step so serialization occurs once.
- State that the function timeout must leave more than the ten-second reserve.
- Add an end-to-end test under
tests/e2ethat exercises the public decider and LLM operations through replay with deterministic fake boundaries.
Files
packages/aws-durable-execution-sdk-python-extras/pyproject.tomlpackages/aws-durable-execution-sdk-python-extras/src/aws_durable_execution_sdk_python_extras/ai/_shared.pypackages/aws-durable-execution-sdk-python-extras/src/aws_durable_execution_sdk_python_extras/ai/retry.pypackages/aws-durable-execution-sdk-python-extras/src/aws_durable_execution_sdk_python_extras/ai/transports.pypackages/aws-durable-execution-sdk-python-extras/src/aws_durable_execution_sdk_python_extras/ai/llm.pypackages/aws-durable-execution-sdk-python-extras/src/aws_durable_execution_sdk_python_extras/ai/decider.pypackages/aws-durable-execution-sdk-python-extras/docs/ai.md- AI unit and end-to-end tests
Out of Scope
- Changes to the core SDK.
- New AI operations, model hosts, retry options, or fallback paths for core SDK 2.x.
- Changes to checkpoint or error wire formats.
Acceptance Criteria
- The extras package requires core SDK 3.0.0 or later.
- A timeout retry cannot start during the invocation reserve.
- Interrupted HTTP bodies produce the documented retry decision.
- Request work sees the step's context variables.
- Unavailable or unusable deadline readings do not fail an otherwise valid call.
- A Bedrock response without
stopReasonis never checkpointed as a successful answer. - Each decider input is serialized exactly once.
- The minimum function timeout is documented.
- Unit and end-to-end tests fail when any corrected branch is removed or inverted.
- Tests, type checks, formatting, and lint pass.
- Ngôn ngữ chính
- Python
- Star
- 59
- Fork
- 32
- Merge trung bình
- 1 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 76
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aws/aws-durable-execution-sdk-python
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
aws/aws-durable-execution-sdk-python#977 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[AgentCore session] Remove the unused session timeoutCó thể đã có người làm @srivilliamsai đã nhận hôm nay. Đang mởneeds-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
aws/aws-durable-execution-sdk-python#970 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
aws/aws-durable-execution-sdk-python#952 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[AgentCore session] W4: Document sessions in the worker READMECó thể đã có người làm @ParidelPooya đã nhận 3 ngày trước. Đang mởenhancement needs-triage
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 76/100
aws/aws-durable-execution-sdk-python#950 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[AgentCore session] W3: Add the session ID and job count to worker logsCó thể đã có người làm @ParidelPooya đã nhận 3 ngày trước. Đang mởenhancement needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
aws/aws-durable-execution-sdk-python#949 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của aws/aws-durable-execution-sdk-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Unused loot bag group names left in dreamcraft en_US.langCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởStatus: Triage Suggestion
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
GTNewHorizons/GT-New-Horizons-Modpack#27789 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug frontend sev-5
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
-
core good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
b4b code health next
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ESCOMP/CTSM#4330 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày