Commit 9f0afb1
committed
fix(sdk): eviction monitor requests text/event-stream + reconnects
Two bugs made devbox.onEvict never fire:
1. The generated watchEvictions() 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.
Mirrors the api-client-python fix, verified against dev (a forced flex drain
delivers on_evict for 20/20 devboxes before suspend).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 4d684ca commit 9f0afb1
1 file changed
Lines changed: 31 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
63 | 70 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
74 | 95 | | |
75 | 96 | | |
76 | 97 | | |
| |||
0 commit comments