Skip to content

Commit 7781a3b

Browse files
feat: Expire stuck IN_PROGRESS managed auth sessions via background worker
1 parent 9817c9f commit 7781a3b

2 files changed

Lines changed: 22 additions & 4 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 112
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-e14974fd90680e5745b35d8718a1ccce2181f6d17a6e0a1fd35fc5bca88795ae.yml
3-
openapi_spec_hash: 1b3aa75f0ab48b122d514047f9c82873
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-a674e3c4c0063942621d1b4e7f67b72f7e240c12dd88564fe16627618ba33dd6.yml
3+
openapi_spec_hash: 8b97c87f0dafe5fc5e5a7365f3687755
44
config_hash: 08d55086449943a8fec212b870061a3f

src/kernel/types/auth/managed_auth.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,12 @@ class ManagedAuth(BaseModel):
197197
"""
198198

199199
flow_expires_at: Optional[datetime] = None
200-
"""When the current flow expires (null when no flow in progress)"""
200+
"""When the current flow expires (null when no flow in progress).
201+
202+
A flow past this timestamp is no longer valid and its `flow_status` will be
203+
`EXPIRED`. Clients may start a new login to supersede a stale `IN_PROGRESS` flow
204+
past this timestamp.
205+
"""
201206

202207
flow_status: Optional[Literal["IN_PROGRESS", "SUCCESS", "FAILED", "EXPIRED", "CANCELED"]] = None
203208
"""Current flow status (null when no flow in progress)"""
@@ -223,7 +228,20 @@ class ManagedAuth(BaseModel):
223228
"""URL to redirect user to for hosted login (present when flow in progress)"""
224229

225230
last_auth_at: Optional[datetime] = None
226-
"""When the profile was last successfully authenticated"""
231+
"""Deprecated alias for `last_auth_check_at`.
232+
233+
Despite the name, this is the last health-check timestamp, not the last
234+
successful authentication. Use `last_auth_check_at` instead.
235+
"""
236+
237+
last_auth_check_at: Optional[datetime] = None
238+
"""
239+
When the most recent auth health check ran for this connection, regardless of
240+
outcome. Updated on every health check and does not by itself indicate that the
241+
profile is currently authenticated - use `status` for that. May be newer than
242+
`flow_expires_at` when a flow is still in progress because health checks
243+
continue to run in parallel.
244+
"""
227245

228246
live_view_url: Optional[str] = None
229247
"""Browser live view URL for debugging (present when flow in progress)"""

0 commit comments

Comments
 (0)