Skip to content

fix(gateway): coalesce pending provider metadata requests - #156605

Merged
vincentkoc merged 2 commits into
mainfrom
fix/control-ui-r06-provider-metadata-flight-20260923
Oct 13, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
fix/control-ui-r06-provider-metadata-flight-20260923

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

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 5307533893008103bad5460a2e2a8fca3649bdce baseline, preserving its 8f82ff11c0af7c1089fcb318b5040d3aa41925dd first-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

  • Baseline regression: the concurrent-machine test fails against the unchanged baseline owner because the provider is called twice instead of once. The selected red run took 13.70 seconds wall.
  • 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.
  • Core types passed in 108.95 seconds; Gateway test types passed in 81.07 seconds. Two-file type-aware lint, scoped formatting, and whitespace checks passed.
  • Fresh independent source reviews found no actionable issues in the final two-file change. The signed publication preserves that reviewed tree.

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.

@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S labels Sep 23, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: The provider receives two metadata requests.
  • After: Both callers share one pending request; a later read fetches fresh metadata.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch appears correct and useful; confidence in exercised behavior remains limited to reported unit tests.
Proof confidence 🦐 gold shrimp (3/6) The maintainer-authored exemption applies: catalog behavior is covered by reported tests using synthetic provider hooks, while the inspected historical screenshots demonstrate machine-spec presentation rather than this optimization.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Overlapping cloud-environment discovery and warmup repeat provider metadata work without improving machine choices.
Reason: The maintainer-authored change removes redundant requests at the existing owner while preserving metadata, refresh behavior, and configuration.

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
Reviewed head: de541d0ded420daec30dfd88eb1ed6678ba999be

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No shipped Gateway run traces concurrent discovery and warmup sharing real provider metadata requests; the reported baseline-fail/head-pass evidence is unit-level.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit e89128c adds src/gateway/worker-environments/provider-machine-catalog.ts:15 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e89128c69e2b; files: src/gateway/worker-environments/provider-machine-catalog.ts)

PR surface

Source +18, Tests +93. Total +111 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 36 18 +18
Tests 1 93 0 +93
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 129 18 +111

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Duplicate provider metadata work is a bounded efficiency problem without evidence of an urgent outage or lost data.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (4 earlier review cycles)
  • reviewed September 23, 2026, 12:00 PM ET / 16:00 UTC sha unknown :: needs changes before merge. :: none
  • reviewed 2026-09-24T07:53:01.815Z sha 8f82ff1 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-25T09:06:49.237Z sha 8f82ff1 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-08T12:48:15.059Z sha 8f82ff1 :: needs maintainer review before merge. :: none

Reviewed October 12, 2026, 9:50 PM ET / October 13, 2026, 01:50 UTC (Revision 5).

@vincentkoc vincentkoc self-assigned this Sep 24, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review September 24, 2026 07:45
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 24, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vincentkoc vincentkoc changed the title fix(gateway): coalesce provider machine metadata requests fix(gateway): coalesce pending provider metadata requests Oct 13, 2026
@vincentkoc
vincentkoc merged commit fce7ab2 into main Oct 13, 2026
115 of 116 checks passed
@vincentkoc
vincentkoc deleted the fix/control-ui-r06-provider-metadata-flight-20260923 branch October 13, 2026 02:06
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant