Skip to content

fix(gateway): keep agents list on prepared model facts - #119208

Merged
steipete merged 1 commit into
mainfrom
codex/qa-ui-e2e-bootstrap-stall
Aug 4, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-ui-e2e-bootstrap-stall

Conversation

@steipete

@steipete steipete commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Closes #119206

Related but distinct: #118465

What Problem This Solves

The first Control UI connection could leave the Gateway unresponsive for roughly 43 seconds. agents.list started model-provider discovery on the request path even though Gateway startup had already published the authoritative catalog. Because part of discovery is synchronous, the intended 750 ms timeout could not fire; unrelated RPCs and liveness timers waited behind the same blocked event loop.

Why This Is The Owner-Level Fix

Gateway startup owns model-catalog publication. Read-only roster RPCs should consume that published fact, not rediscover providers. sessions.list already follows this boundary through readPreparedServerMethodModelCatalog(); this change moves its sibling agents.list onto the same canonical path.

The broader open PR linked above prewarms different first-message/plugin work after readiness and currently has unresolved availability findings. This patch does not schedule new background work. It removes request-time work instead.

What Changed

  • agents.list reads the lifecycle-published catalog.
  • The obsolete array-valued optional loader, normalizer, starter, and focused test are removed.
  • The handler regression test proves agents.list reads published facts and never starts loadGatewayModelCatalog().
  • The snapshot-valued optional loader remains for the explicit metadata surface that owns startup retry behavior.

No config, protocol, storage, dependency, plugin, provider, or user-data contract changes.

Observed Behavior

Current-main baseline on a clean Linux Testbox:

  • agents.list: 43.4 seconds.
  • Other bootstrap RPCs: 43.7 to 44.3 seconds.
  • Liveness heartbeat delayed 57.6 seconds.
  • RSS reached 2.47 GiB.
  • First browser scenario: 52.1 seconds.

Exact-head candidate:

  • agents.list: 227 ms.
  • Every observed bootstrap RPC: at most 913 ms.
  • No liveness or memory-pressure warning.
  • First browser scenario: 8.9 seconds.

Evidence

Exact head: b173fbb6efba69.

  • Exact-head Blacksmith Testbox tbx_01kz6a9qavzqnp7gmw3bzrkk19, https://github.com/openclaw/openclaw/actions/runs/30907149584:
    • pnpm test:ui:e2e -- ui/src/e2e/control-ui-auth-transports.e2e.test.ts
    • 1 file / 2 real-browser scenarios passed in 27.94 seconds.
    • Both trusted-proxy and allowed-origin flows completed; all Gateway bootstrap RPCs stayed below one second.
  • Exact-head focused local proof:
    • node scripts/run-vitest.mjs src/gateway/server-methods/optional-model-catalog.test.ts src/gateway/server-methods/sessions-read.test.ts
    • 2 files / 13 tests passed.
  • Candidate-diff broad Blacksmith Testbox tbx_01kz69b87crrr0jjjgq7mh5tdg, https://github.com/openclaw/openclaw/actions/runs/30905969182:
    • pnpm check:changed passed the core and coreTests lanes.
    • pnpm build passed, including the production Control UI build and performance guard.
    • The subsequent rebase added three unrelated main commits and did not overlap any changed file.
  • Fresh exact-head AutoReview: clean, no accepted/actionable findings, overall correctness 0.99.
  • git diff --check and targeted oxfmt passed.
  • Public model-identifier audit: PASS; the diff, tests, proof, and public text add or change no model identifiers.

Repair Doctrine Summary

  • Root cause: agents.list started provider discovery instead of reading the published catalog; synchronous discovery prevented its timeout from firing.
  • Architectural owner: Gateway startup publishes model facts; roster RPCs only read them.
  • Canonical fix: reuse readPreparedServerMethodModelCatalog().
  • Removed paths: the unused array optional-loader stack and its stale test.
  • Production delta: +4/-32 (net -28).
  • Test delta: +23/-25 (net -2).
  • Sibling coverage: sessions.list already uses the prepared reader; agents.list now matches it, while explicit metadata discovery retains its separate snapshot/retry owner.
  • Risk: low. This is a read-only metadata source change backed by focused handler tests and a real browser/Gateway before-after reproduction.

AI-assisted: yes.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Aug 4, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 8:09 AM ET / 12:09 UTC.

ClawSweeper review

What this changes

The PR changes the Gateway’s agents.list RPC to use lifecycle-published model facts instead of discovering providers during a request.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open. This focused repair removes synchronous provider discovery from a Control UI bootstrap RPC; source, sibling-path, and supplied real-browser evidence support the owner-level fix, with no actionable findings.

Priority: P1
Reviewed head: b173fbb6efba69c2bb47578b3d88a5528f53221c

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong real behavior proof, a narrowly scoped owner-boundary repair, and focused regression coverage support a high-confidence patch.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The PR body includes an exact-head real Control UI/Gateway Testbox before-and-after run with an observed sub-second bootstrap result.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR body includes an exact-head real Control UI/Gateway Testbox before-and-after run with an observed sub-second bootstrap result.
Evidence reviewed 6 items Current-main defect: The current agents.list handler invokes the optional loader, which starts catalog discovery before its timeout can race it.
Lifecycle owner: Gateway startup publishes configured static model facts before accepting work, and the prepared reader only reads the in-memory snapshot.
Sibling boundary: sessions.list already uses the prepared reader, so the proposed agents.list change aligns equivalent read-only RPCs.
Findings None None.
Security None None.

How this fits together

The Gateway serves Control UI RPCs such as the agent roster. Startup publishes configured model facts, and roster/session read methods use those facts to decorate responses without blocking request handling on provider discovery.

flowchart LR
  A[Gateway startup] --> B[Prepared model facts]
  C[Control UI connection] --> D[Agent roster request]
  B --> E[Prepared catalog reader]
  D --> E
  E --> F[Agent roster response]
  G[Provider discovery] -.kept off hot path.-> E
Loading

Before merge

  • Complete next step (P2) - No repair lane is needed: source review found no defect in the candidate patch, which now awaits normal exact-head merge gating.
Agent review details

Security

None.

PR surface

Source -28, Tests -2. Total -30 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 4 32 -28
Tests 2 23 25 -2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 27 57 -30

Review metrics

Metric Value Why it matters
Production vs test LOC production +4/-32; tests +23/-25 The patch removes an obsolete hot-path loader while adding a direct regression guard against rediscovery.

Stored data model

Persistent data-model change detected: serialized state: src/gateway/server-methods/sessions-read.test.ts, unknown-data-model-change: src/gateway/server-methods/sessions-read.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #119206
Summary: This PR is the focused candidate fix for the canonical Gateway roster-stall report; the linked prewarming PR addresses a separate first-message path.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Land the prepared-fact read path after the exact-head required checks complete, keeping provider discovery outside ordinary roster requests.

Do we have a high-confidence way to reproduce the issue?

Yes—current main still calls discovery from agents.list, and the supplied Testbox reproduction covers the same unchanged path; this review did not rerun it locally.

Is this the best way to solve the issue?

Yes—the prepared reader is the existing canonical path used by sessions.list; it removes work at the lifecycle boundary rather than adding another timeout or cache.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4170e11be931.

Labels

Label changes:

  • add P1: The documented defect can stall Gateway bootstrap RPCs and make the Control UI appear unresponsive for tens of seconds.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes an exact-head real Control UI/Gateway Testbox before-and-after run with an observed sub-second bootstrap result.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body includes an exact-head real Control UI/Gateway Testbox before-and-after run with an observed sub-second bootstrap result.

Label justifications:

  • P1: The documented defect can stall Gateway bootstrap RPCs and make the Control UI appear unresponsive for tens of seconds.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body includes an exact-head real Control UI/Gateway Testbox before-and-after run with an observed sub-second bootstrap result.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes an exact-head real Control UI/Gateway Testbox before-and-after run with an observed sub-second bootstrap result.

Evidence

What I checked:

  • Current-main defect: The current agents.list handler invokes the optional loader, which starts catalog discovery before its timeout can race it. (src/gateway/server-methods/agents.ts:882, 4170e11be931)
  • Lifecycle owner: Gateway startup publishes configured static model facts before accepting work, and the prepared reader only reads the in-memory snapshot. (src/gateway/server-startup-post-attach.ts:690, 4170e11be931)
  • Sibling boundary: sessions.list already uses the prepared reader, so the proposed agents.list change aligns equivalent read-only RPCs. (src/gateway/server-methods/sessions-read.ts:258, 4170e11be931)
  • Candidate implementation and regression coverage: The PR switches the handler to the prepared reader and its focused handler test proves discovery is not called. (src/gateway/server-methods/agents.ts:882, b173fbb6efba)
  • Current-base comparison: The PR merge base is 6d88ec…; current main has no changes in the four touched paths since that base, so the behind-base status does not alter this patch’s surface. (b173fbb6efba)
  • Real behavior proof: The PR body supplies exact-head Testbox browser/Gateway evidence showing bootstrap RPCs below one second after the change, versus the documented 43-second baseline stall. (b173fbb6efba)

Likely related people:

  • clawSean: Current-main blame resolves the legacy loader lines to a shallow-history boundary; it is the only local history signal, so ownership is uncertain. (role: historical source boundary; confidence: low; commits: 5cd669434987; files: src/gateway/server-methods/agents.ts, src/gateway/server-model-catalog.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit a8bcbf6 into main Aug 4, 2026
131 of 138 checks passed
@steipete
steipete deleted the codex/qa-ui-e2e-bootstrap-stall branch August 4, 2026 12:14
@steipete

steipete commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 4, 2026
* origin/main: (208 commits)
  fix(telegram): route reactions to their originating forum topics
  test(gateway): isolate scheduled service timers (#119218)
  test(qa): cover Canvas agent and node controls (#119047)
  fix(cli): avoid repeated migration scans during local agent turns (#119051)
  fix(gateway): keep agents list on prepared model facts (#119208)
  fix(telegram): retry update offset persistence
  fix(ci): accept profiled partial Kova gates (#119121)
  fix(qqbot): keep channel API calls on the active account [AI] (#118575)
  fix(agents): recover from invalid compaction summaries (#119137)
  fix(gateway): expose OAuth-backed tools to CLI agents (#119166)
  fix(plugins): preserve metadata reloads during models status (#119183)
  fix(test): bound direct gateway server runs (#119184)
  test(tui): prove command surfaces through PTY (#119165)
  fix(testbox): restore claims across path aliases (#119170)
  fix(message): preserve sends with incidental Telegram locations
  fix(perf): give each concurrency sample a full deadline (#119164)
  fix(testbox): remove changed-gate sync residue (#119163)
  fix(telegram): preserve later chunks after rejected sends
  fix(tui): block terminal controls in system messages (#118998)
  fix(auto-reply): suppress false no-reply fallback during continuations (#119154)
  ...
vincentkoc added a commit that referenced this pull request Aug 4, 2026
* origin/main: (23 commits)
  chore(tui): add Gateway boundary PTY coverage (#119191)
  fix(telegram): route reactions to their originating forum topics
  test(gateway): isolate scheduled service timers (#119218)
  test(qa): cover Canvas agent and node controls (#119047)
  fix(cli): avoid repeated migration scans during local agent turns (#119051)
  fix(gateway): keep agents list on prepared model facts (#119208)
  fix(telegram): retry update offset persistence
  fix(ci): accept profiled partial Kova gates (#119121)
  fix(qqbot): keep channel API calls on the active account [AI] (#118575)
  fix(agents): recover from invalid compaction summaries (#119137)
  fix(gateway): expose OAuth-backed tools to CLI agents (#119166)
  fix(plugins): preserve metadata reloads during models status (#119183)
  fix(test): bound direct gateway server runs (#119184)
  test(tui): prove command surfaces through PTY (#119165)
  fix(testbox): restore claims across path aliases (#119170)
  fix(message): preserve sends with incidental Telegram locations
  fix(perf): give each concurrency sample a full deadline (#119164)
  fix(testbox): remove changed-gate sync residue (#119163)
  fix(telegram): preserve later chunks after rejected sends
  fix(tui): block terminal controls in system messages (#118998)
  ...
vincentkoc added a commit that referenced this pull request Aug 4, 2026
* origin/main:
  chore(tui): add Gateway boundary PTY coverage (#119191)
  fix(telegram): route reactions to their originating forum topics
  test(gateway): isolate scheduled service timers (#119218)
  test(qa): cover Canvas agent and node controls (#119047)
  fix(cli): avoid repeated migration scans during local agent turns (#119051)
  fix(gateway): keep agents list on prepared model facts (#119208)
  fix(telegram): retry update offset persistence
  fix(ci): accept profiled partial Kova gates (#119121)
vincentkoc added a commit that referenced this pull request Aug 4, 2026
…time

* origin/main: (177 commits)
  fix(telegram): route reactions to their originating forum topics
  test(gateway): isolate scheduled service timers (#119218)
  test(qa): cover Canvas agent and node controls (#119047)
  fix(cli): avoid repeated migration scans during local agent turns (#119051)
  fix(gateway): keep agents list on prepared model facts (#119208)
  fix(telegram): retry update offset persistence
  fix(ci): accept profiled partial Kova gates (#119121)
  fix(qqbot): keep channel API calls on the active account [AI] (#118575)
  fix(agents): recover from invalid compaction summaries (#119137)
  fix(gateway): expose OAuth-backed tools to CLI agents (#119166)
  fix(plugins): preserve metadata reloads during models status (#119183)
  fix(test): bound direct gateway server runs (#119184)
  test(tui): prove command surfaces through PTY (#119165)
  fix(testbox): restore claims across path aliases (#119170)
  fix(message): preserve sends with incidental Telegram locations
  fix(perf): give each concurrency sample a full deadline (#119164)
  fix(testbox): remove changed-gate sync residue (#119163)
  fix(telegram): preserve later chunks after rejected sends
  fix(tui): block terminal controls in system messages (#118998)
  fix(auto-reply): suppress false no-reply fallback during continuations (#119154)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 5, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 6, 2026
* origin/main: (23 commits)
  chore(tui): add Gateway boundary PTY coverage (openclaw#119191)
  fix(telegram): route reactions to their originating forum topics
  test(gateway): isolate scheduled service timers (openclaw#119218)
  test(qa): cover Canvas agent and node controls (openclaw#119047)
  fix(cli): avoid repeated migration scans during local agent turns (openclaw#119051)
  fix(gateway): keep agents list on prepared model facts (openclaw#119208)
  fix(telegram): retry update offset persistence
  fix(ci): accept profiled partial Kova gates (openclaw#119121)
  fix(qqbot): keep channel API calls on the active account [AI] (openclaw#118575)
  fix(agents): recover from invalid compaction summaries (openclaw#119137)
  fix(gateway): expose OAuth-backed tools to CLI agents (openclaw#119166)
  fix(plugins): preserve metadata reloads during models status (openclaw#119183)
  fix(test): bound direct gateway server runs (openclaw#119184)
  test(tui): prove command surfaces through PTY (openclaw#119165)
  fix(testbox): restore claims across path aliases (openclaw#119170)
  fix(message): preserve sends with incidental Telegram locations
  fix(perf): give each concurrency sample a full deadline (openclaw#119164)
  fix(testbox): remove changed-gate sync residue (openclaw#119163)
  fix(telegram): preserve later chunks after rejected sends
  fix(tui): block terminal controls in system messages (openclaw#118998)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. 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.

[Bug]: agents.list blocks the Gateway on request-time model discovery

1 participant