Repository navigation
fix(gateway): coalesce pending provider metadata requests - #156605
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR shares pending machine and operating-system metadata requests within each worker profile catalog. Example: Two overlapping discovery requests read machine options for the production profile.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR provides a focused optimization absent from current main, with no actionable correctness or security findings. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Gateway catalog receives discovery and machine-shape warmup requests, calls worker-provider metadata hooks, and supplies picker choices and session machine specifications. flowchart LR
A[Environment discovery] --> C[Profile machine catalog]
B[Session shape warmup] --> C
C --> D[Pending section request]
D --> E[Worker provider metadata]
E --> F[Normalized choices]
F --> G[Pickers and session specifications]
Technical reviewBest possible solution: Keep pending-request sharing in the existing catalog while preserving subsequent refreshes and retry after rejection. Do we have a high-confidence way to reproduce the issue? Current-main source shows overlapping discovery and warmup independently reaching the same provider hooks; the PR reports a matching baseline regression, but no target code was executed during this read-only review. Is this the best way to solve the issue? The patch addresses duplicate work at its existing owner with short-lived promises and preserves the accepted lifecycle behavior without adding configuration or another cache. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3b75ce70f397. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +18, Tests +93. Total +111 across 2 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
Reviewed October 12, 2026, 9:50 PM ET / October 13, 2026, 01:50 UTC (Revision 5). |
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
What Problem This Solves
Overlapping environment discovery and machine-shape warmup can issue duplicate cloud-provider metadata requests for the same profile.
User Impact
Concurrent callers now share each section's pending machine or operating-system lookup. Once that request settles, the next lookup fetches fresh metadata from the current provider. Failed requests remain retryable, and fresh empty responses clear obsolete machine shapes. No configuration changes are required.
Why This Change Was Made
The current provider-machine catalog owns one pending Promise per discovery section and clears it in
finally. Each new request resolves the live provider and uses the existing settings, normalizers, change notifications, and display metadata.This updates the original contributor PR through a signed merge of the frozen
5307533893008103bad5460a2e2a8fca3649bdcebaseline, preserving its8f82ff11c0af7c1089fcb318b5040d3aa41925ddfirst-parent history. The resulting product change is confined to the catalog and its existing test file. Retired provider-generation mechanisms and the removed workshop fixture are not restored.Evidence
pnpm test src/gateway/worker-environments/provider-machine-catalog.test.ts --maxWorkers=1: all 14 cases passed in 9.87 seconds wall. The six added deferred cases totaled 25 ms of reported test time; they cover coalescing, fresh reads, live-provider replacement, warmup joins, retry after rejection, and clearing stale shapes.Hosted CI timing is pending on the new head. No live-provider or deployment proof is claimed; native review, preparation, and landing remain with the original PR workflow owner.