Repository navigation
fix(relay): cells without a seat feed stay out of shadow coverage and switch state - #27058
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🟡 Moderate · up to A cell restart can briefly leave stale reserve state that changes assignment decisions. Resolve or explicitly accept this risk before merging. Pre-merge checks |
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
613978ce-d486-4c9e-9d73-993da74044e1
📒 Files selected for processing (3)
cloud/apps/relay/src/assignment-store.tscloud/apps/relay/src/shadow-seat-directory.test.tscloud/apps/relay/src/shadow-seat-directory.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
| if (stopped) return false | ||
| if (response.status === 404) { | ||
| await response.body?.cancel().catch(() => undefined) | ||
| directory.markNoFeed(cell.cellId, now()) | ||
| directory.markNoFeed(cell.cellId, now(), cell.incarnation) | ||
| return false | ||
| } | ||
| if (!response.ok) { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
set -eu
printf '%s\n' '--- shadow-seat-directory relevant declarations and methods ---'
sed -n '130,235p;470,590p' cloud/apps/relay/src/shadow-seat-directory.ts
printf '%s\n' '--- poller owner and refresh flow ---'
sed -n '130,185p' cloud/apps/relay/src/relay-server.ts
sed -n '480,590p' cloud/apps/relay/src/shadow-seat-directory.ts
printf '%s\n' '--- refresh/listCells references ---'
rg -n -F --glob '*.ts' -- 'listCells' cloud/apps/relay/src || test "$?" -eq 1
rg -n -F --glob '*.ts' -- 'setCells' cloud/apps/relay/src || test "$?" -eq 1
printf '%s\n' '--- cell-state response ---'
sed -n '1575,1615p' cloud/apps/relay/src/app.tsRepository: stablyai/orca
Length of output: 19509
Use the current incarnation when handling a 404.
The 404 branch passes the cached cell.incarnation to markNoFeed. If the process changed from A to B after the cell-list refresh, markNoFeed treats A as unchanged and retains A's reserve flags. The cell-state response then exposes those stale flags.
Read the current incarnation before calling markNoFeed. If the lookup fails or has no incarnation, pass undefined so existing retention behavior remains unchanged.
Suggested fix
if (response.status === 404) {
await response.body?.cancel().catch(() => undefined)
- directory.markNoFeed(cell.cellId, now(), cell.incarnation)
+ let runtimeIncarnation: string | undefined
+ try {
+ const listed = await options.listCells()
+ runtimeIncarnation = listed.find(({ cellId }) => cellId === cell.cellId)?.incarnation
+ } catch {
+ // An unknown incarnation preserves the existing reserve state.
+ }
+ directory.markNoFeed(cell.cellId, now(), runtimeIncarnation)
return false
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (stopped) return false | |
| if (response.status === 404) { | |
| await response.body?.cancel().catch(() => undefined) | |
| directory.markNoFeed(cell.cellId, now()) | |
| directory.markNoFeed(cell.cellId, now(), cell.incarnation) | |
| return false | |
| } | |
| if (!response.ok) { | |
| if (stopped) return false | |
| if (response.status === 404) { | |
| await response.body?.cancel().catch(() => undefined) | |
| let runtimeIncarnation: string | undefined | |
| try { | |
| const listed = await options.listCells() | |
| runtimeIncarnation = listed.find(({ cellId }) => cellId === cell.cellId)?.incarnation | |
| } catch { | |
| // An unknown incarnation preserves the existing reserve state. | |
| } | |
| directory.markNoFeed(cell.cellId, now(), runtimeIncarnation) | |
| return false | |
| } | |
| if (!response.ok) { |
b6ee5a7 to
71aa37b
Compare
… switch state Rebased onto main as one commit after its parent squash-merged.
79b08ef to
92822cd
Compare
Summary
Two relay cells, c17 and c18, run an image without the seat feed. They are overflow cells, usually empty, and they stay on the database path through step 5. A director that polls them gets a 404 and records them as "no feed". This PR makes two places handle that state cleanly.
cell-unpolled. That class is what the E-shadow coverage gate counts against ("≥ 99.9% of compares on polled cells are notcell-unpolled"), so hosts on c17/c18 read as a coverage gap the feed could never close.cell-no-feed, which is explained and kept out of the coverage measure. Cells that do have a feed but miss polls are stillcell-unpolled, as before.Directors only. Cells are unchanged, so nothing changes on the wire. The new class is one more label value in the existing compare log line.
Why this approach
Treating no-feed as its own class, rather than dropping those compares, keeps them visible in the counts while letting the gate exclude them by name. Whether a host is on c17/c18 is still answered from the database, as today.
Testing
shadow-directory-compare,shadow-seat-directoryandhost-whereabouts-apptests pass (40), including a new compare case for both sides and a rollback-to-404 poller test.tscis clean.