Skip to content

feat(images): regenerate SDK with Python image workflows - #18

Merged
Simon Liang (AgentWings) merged 3 commits into
scalar-nextfrom
feat/image-import
Nov 6, 2026
Merged

Simon Liang (AgentWings) merged 3 commits into
scalar-nextfrom
feat/image-import

Conversation

@AgentWings

@AgentWings Simon Liang (AgentWings) commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Refresh the generated API surface to cover all 31 public operations, including the six image operations, manual Machine resize, Machine-create image_id, PATCH autoresizing updates, lifecycle refusal fields, and flat image errors. Remove the obsolete log-reauthorization operation. The pinned contract check fails CI for missing, obsolete, duplicate operations or changed request fields; mutation tests verify the guard.

Preserve sync/async import and polling helpers, default waiting and wait=False, separate storage credentials, sync remaining-budget timeouts, and async cancellation. Keep package metadata consistent with runtime version 0.6.0. Unsupported platforms fail before uploading; the current helper supports linux/amd64.

Validation: 25 source tests and 25 installed-wheel tests passed; wheel and source distribution built. Formatting, contract guard tests, and actionlint passed. Both sync and async tests pass ready image IDs into generated Machine creation.

Tests cover mocked upload and registration, readiness, no-wait, terminal failures, timeouts/cancellation, credential separation, ready image IDs passed to Machine creation, PATCH/resize methods, and public error/refusal fields. Live archive preparation and Machine execution remain required before release; mocks do not establish live readiness. No package was published and no live resources were created.

@vitus-dedalus Vitus Larrieu (vitus-dedalus) left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Withdrawn.

@AgentWings Simon Liang (AgentWings) changed the title feat(images): add Python import and polling helpers feat(images): regenerate SDK with Python image workflows Nov 6, 2026
@AgentWings
Simon Liang (AgentWings) marked this pull request as ready for review November 6, 2026 01:35

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Live sync and async imports reached ready. Both status-request timeout failures still reproduce on this head without the accepted image ID. Requesting changes. Apply the three suggestions together.

Comment thread src/dedalus_sdk/images.py Outdated
import httpx
from typing_extensions import TypedDict

from . import AsyncDedalus, Dedalus

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (reliability, blocking): import the transport timeout type for both polling fixes.

The SDK raises APITimeoutError for an HTTPX request timeout. The two polling suggestions below need this import. Apply all three suggestions together.

Suggested change
from . import AsyncDedalus, Dedalus
from . import APITimeoutError, AsyncDedalus, Dedalus

Comment thread src/dedalus_sdk/images.py Outdated
Comment on lines +105 to +109
response = client.get(
f"/v1/images/{quote(image_id, safe='')}",
cast_to=httpx.Response,
options={"timeout": remaining, "max_retries": 0},
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (reliability, blocking): preserve the image ID when the status request times out.

A reproduced HTTPX ReadTimeout escapes as APITimeoutError, without .image. The registration may already be preparing, so callers need its ID to resume polling. Wrap the transport timeout as ImagePreparationError and retain its cause. This requires the import suggestion above.

Suggested change
response = client.get(
f"/v1/images/{quote(image_id, safe='')}",
cast_to=httpx.Response,
options={"timeout": remaining, "max_retries": 0},
)
try:
response = client.get(
f"/v1/images/{quote(image_id, safe='')}",
cast_to=httpx.Response,
options={"timeout": remaining, "max_retries": 0},
)
except APITimeoutError as error:
raise ImagePreparationError(
Image(image_id=image_id, state="unknown"),
"Status request timed out. Preparation continues. Use this image ID to resume polling.",
) from error

Comment thread src/dedalus_sdk/images.py Outdated
Comment on lines +141 to +145
except TimeoutError:
raise ImagePreparationError(
Image(image_id=image_id, state="unknown"),
"Timed out waiting. Preparation continues; use this image ID to resume polling.",
) from None

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (reliability, blocking): handle SDK request timeouts in async polling too.

This handler catches the overall deadline but misses APITimeoutError from an individual status request. That reproduced failure also loses .image. Preserve the image ID and original cause for either timeout. This requires the import suggestion above.

Suggested change
except TimeoutError:
raise ImagePreparationError(
Image(image_id=image_id, state="unknown"),
"Timed out waiting. Preparation continues; use this image ID to resume polling.",
) from None
except (TimeoutError, APITimeoutError) as error:
raise ImagePreparationError(
Image(image_id=image_id, state="unknown"),
"Timed out waiting. Preparation continues. Use this image ID to resume polling.",
) from error

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved. Verified the timeout fix preserves the image ID and original error in both sync and async polling. All 27 tests pass.

@AgentWings
Simon Liang (AgentWings) merged commit e088f07 into scalar-next Nov 6, 2026
7 checks passed
@scalar-docs scalar-docs Bot mentioned this pull request Nov 6, 2026
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.

2 participants