mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-30 21:44:50 +02:00
[eric] workflows: a cloud with no workflows API reads as unavailable with the honest reason, not as the cloud declining the request
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C9zwUaHucUgrdxvK8FvjYT
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
4d2cd934b5
commit
425df32fc4
@@ -49,6 +49,13 @@ class CloudStatusUnknown(CloudStatusBase):
|
||||
detail: str
|
||||
|
||||
|
||||
# The cloud we are signed into has no workflows API at all (the preflight route 404s): this app is ahead
|
||||
# of that control plane. Nothing was sent, and the toggle should say so instead of "declined".
|
||||
class CloudStatusUnavailable(CloudStatusBase):
|
||||
state: Literal["unavailable"] = "unavailable"
|
||||
reason: str
|
||||
|
||||
|
||||
class CloudStatusReady(CloudStatusBase):
|
||||
state: Literal["ready"] = "ready"
|
||||
plan: Optional[str] = None
|
||||
@@ -62,7 +69,7 @@ class CloudStatusReady(CloudStatusBase):
|
||||
credential: CredentialReadiness
|
||||
|
||||
|
||||
CloudStatus = Union[CloudStatusReady, CloudStatusSignedOut, CloudStatusUnknown]
|
||||
CloudStatus = Union[CloudStatusReady, CloudStatusSignedOut, CloudStatusUnknown, CloudStatusUnavailable]
|
||||
|
||||
|
||||
@typechecked
|
||||
@@ -124,6 +131,8 @@ async def compute_status(wf: Workflow) -> CloudStatus:
|
||||
except cloud.CloudUnreachable as exc:
|
||||
return CloudStatusUnknown(detail=exc.detail, **shared)
|
||||
except cloud.CloudRefused as exc:
|
||||
if exc.status == 404:
|
||||
return CloudStatusUnavailable(reason="Cloud runs are not available on your OpenSwarm Cloud yet; this version of the app is ahead of it. Nothing was sent.", **shared)
|
||||
return CloudStatusUnknown(detail=exc.message, **shared)
|
||||
|
||||
p_mirror_cloud_state(wf, pre.hosted)
|
||||
|
||||
Reference in New Issue
Block a user