GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||
GeezerVison is showing github.com — feat(devbox): add devbox.on_evict eviction notifications (SSE) by jrvb-rl · Pull Request #824 · runloopai/api-client-python Conversation
Contributor
DescriptionFollow-on to the server-side flex eviction-notification work (monorepo #10325 and its successor SSE endpoint). Adds the object-oriented client surface for eviction notifications. New API: How it works (internal state management):
Dependency / status
TestingDeferred until the generated endpoint exists (see above). New/edited files byte-compile cleanly. 🤖 Generated with Claude Code
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. Adds an object-oriented `Devbox.on_evict(callback)` (sync and async) backed by a per-client `EvictionMonitor`. The first registration opens a single account-wide `watch_evictions` SSE stream; incoming notifications are matched against the local interest set, the devbox is removed before its callback fires (at-most-once), and the stream is closed once the interest set empties. Depends on the Stainless-generated `devboxes.watch_evictions` method and `DevboxEvictionEvent` type, which land downstream once the server endpoint merges. Co-Authored-By: Claude Opus 4.8 <[email protected]>
jrvb-rl
changed the base branch from
main
to
release-please--branches--main--changes--next
jrvb-rl
force-pushed
the
feat/devbox-on-evict-sse
branch
from
1c62073 to
1e699b8
Compare
- Use the real generated event type DevboxEvictionEventView (the endpoint's view) in place of the assumed DevboxEvictionEvent. - Invoke the callback as callback(devbox, eviction_deadline_ms): the Devbox object and the Unix millisecond deadline, instead of passing the raw event. Requires the main-repo stainless config change that generates watch_evictions as Stream[DevboxEvictionEventView] (runloopai/runloop#10404). Co-Authored-By: Claude Opus 4.8 <[email protected]>
jrvb-rl
force-pushed
the
feat/devbox-on-evict-sse
branch
from
1e699b8 to
ffdd21b
Compare
jrvb-rl
marked this pull request as ready for review
stainless-app
Bot
force-pushed
the
release-please--branches--main--changes--next
branch
from
0ebcf9d to
92a2cfe
Compare
The mux SSE route moved from /v1/devboxes/watch_evictions to
/v1/devboxes/evictions/watch (runloopai/runloop#10409) to avoid colliding
with GET /v1/devboxes/{id}. Update the generated request path so the
watch_evictions method reaches the new endpoint. Method surface unchanged.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Two bugs made devbox.on_evict never fire: 1. The generated watch_evictions() sends Accept: application/json, but the endpoint only streams for Accept: text/event-stream — otherwise it returns an empty text/plain 200. The monitor now forces the SSE Accept header. 2. The monitor ran the stream once and stopped. The server force-closes on leader change / slow consumer (and a long-lived HTTP/2 stream can drop), and expects the client to reconnect and re-read the snapshot. The monitor now reconnects with backoff until no devbox is still interested. Adds debug logging around connect / event / reconnect. Verified against dev: a forced flex drain now delivers on_evict for 20/20 devboxes before suspend. Co-Authored-By: Claude Opus 4.8 <[email protected]>
jason-rl
approved these changes
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. Addresses review on #824: AsyncEvictionMonitor still had the pre-fix single-shot _run, so AsyncDevbox.on_evict would silently never fire. Port the sync monitor's fixes to sdk/async_eviction.py: - request the SSE Accept header (text/event-stream) on watch_evictions - reconnect with capped backoff until no devbox is still interested Also ruff-format sdk/eviction.py (the sync fix wrapped a call that fits on one line). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
gautam-rl
approved these changes
stainless-app
Bot
force-pushed
the
release-please--branches--main--changes--next
branch
from
92a2cfe to
b736214
Compare
Base automatically changed from
release-please--branches--main--changes--next
to
main
This branch has not been deployedNo deployments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reviewers+1 more reviewerUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | ||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |