Skip to content

fix: prevent configured models from stalling startup - #116553

Merged
fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:codex/fix-prepared-model-metadata-rescan
Jul 30, 2026
Merged

fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:codex/fix-prepared-model-metadata-rescan

Conversation

@fuller-stack-dev

Copy link
Copy Markdown
Member

Closes #116552

What Problem This Solves

Fixes an issue where gateways with multiple agents and many configured model references could spend tens of seconds in prepared model publication during cold startup, delaying readiness and causing early health probes to time out.

Why This Change Was Made

Prepared workspace facts now compile one static model-ID matcher from the lifecycle-owned plugin metadata snapshot and carry it through configured-model and bundled static-catalog lookups. This preserves manifest normalization semantics while preventing model comparison loops from rediscovering plugin metadata.

User Impact

Gateway startup no longer grows by repeatedly scanning plugin metadata for each agent/model comparison. On the reproduced 12-agent, 312-model configuration, configured projection dropped from 49.1 seconds to 17.9 milliseconds while all 312 configured models remained available.

Evidence

  • Red reproduction on unmodified canonical main: 98.5 seconds total prepared publication, including 49.1 seconds in configuredProjectionMs.
  • Source-blind head validation: configuredProjectionMs=17.88, agentCount=12, configuredRuntimeModelCount=312.
  • Focused tests: 24/24 passed across prepared-model-runtime.startup-static, model.static-catalog.snapshot-cache, and model-ref-shared.
  • Remote changed gate on Blacksmith Testbox: core production/test typechecks, lint, dead exports, format, boundaries, import cycles, and runtime guards passed.
  • Structured autoreview: clean; no accepted/actionable findings.
  • Duplicate search on July 30, 2026 found no open issue or PR covering this configured-model/plugin-metadata rescan. PR fix(perf): make Kova startup diagnostics actionable #116319 is diagnostics-only and does not touch this runtime path.

AI-assisted: Codex was used for investigation, implementation, testing, and review. The change and evidence were inspected before submission.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Jul 30, 2026
@fuller-stack-dev fuller-stack-dev self-assigned this Jul 30, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jul 30, 2026
@clawsweeper clawsweeper Bot added 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. P1 High-priority user-facing bug, regression, or broken workflow. labels Jul 30, 2026
@clawsweeper

clawsweeper Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 30, 2026, 5:14 PM ET / 21:14 UTC.

ClawSweeper review

What this changes

The PR compiles one manifest-aware static model-ID matcher from the prepared plugin-metadata snapshot and reuses it during configured-model and static-catalog lookups to prevent repeated metadata discovery at gateway startup.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep this PR open for maintainer review. The proposed cache is aligned with the prepared-runtime ownership model and its alias snapshot test covers the key semantic risk; the linked bug remains open until this fix is reviewed and merged. The PR is member-authored and carries the protected maintainer label, so conservative cleanup must not auto-close it.

Priority: P1
Reviewed head: 02c6cbb77934aede3d41177abab36e4d356c4dea

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has focused semantic coverage and credible runtime performance evidence; resolving the current failed checks and refreshing the base are the remaining merge-confidence steps.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body provides a concrete after-fix source-blind runtime measurement with the observed model count and configured-projection timing, paired with a stated red baseline; redact deployment details if richer logs are later attached.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides a concrete after-fix source-blind runtime measurement with the observed model count and configured-projection timing, paired with a stated red baseline; redact deployment details if richer logs are later attached.
Evidence reviewed 5 items Prepared-runtime cache boundary: The branch creates the matcher once from pluginMetadataSnapshot.plugins in the workspace preparation path and passes it to configured-model collection, avoiding metadata lookup inside repeated comparisons.
Normalization semantics retained: The branch factors comparison through a supplied normalizer and builds its cached normalizer from manifest policies, while the uncached exported matcher retains the existing default normalization path.
Snapshot-generation regression coverage: The updated static-catalog test verifies that an alias resolves using the captured plugin generation and that the resolver does not fetch current plugin metadata during lookup.
Findings None None.
Security None None.

How this fits together

Prepared model publication builds each workspace’s available model catalog before the gateway reports readiness. Configuration supplies model references, plugin metadata supplies manifest normalization rules, and the resulting catalog determines which configured models the gateway can expose.

flowchart LR
  A[Gateway startup] --> B[Workspace configuration]
  B --> C[Prepared plugin metadata snapshot]
  C --> D[Static model-ID matcher]
  D --> E[Configured and static catalog lookup]
  E --> F[Prepared model catalog]
  F --> G[Gateway readiness]
Loading

Before merge

  • Resolve merge risk (P1) - The PR is behind current main; although GitHub reports it mergeable, the current-head lint and CI-gate failures must be resolved or refreshed before landing.
  • Resolve merge risk (P1) - Caching manifest normalization deliberately pins comparisons to the prepared plugin-metadata generation. Review should retain the existing lifecycle contract that metadata changes take effect through the owner’s restart or explicit reload path, not through request-time rediscovery.
  • Complete next step (P2) - This member-authored, maintainer-labeled PR needs a maintainer to review the refreshed exact head and its currently failed checks; no discrete mechanical defect was established for an automated repair lane.
Agent review details

Security

None.

PR surface

Source +70, Tests +22. Total +92 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 5 83 13 +70
Tests 2 25 3 +22
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 108 16 +92

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #116552
Summary: This PR is the explicitly linked candidate fix for the canonical configured-model startup-stall report.

Members:

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Rebase or refresh against current main, clear the current lint and CI-gate failures, and merge the prepared-snapshot matcher only after confirming the captured metadata generation remains the canonical lifecycle boundary.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Rebase or refresh against current main, clear the current lint and CI-gate failures, and merge the prepared-snapshot matcher only after confirming the captured metadata generation remains the canonical lifecycle boundary.

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

No independent high-confidence reproduction was run in this read-only review. The linked report provides a concrete current-main benchmark shape—12 agents and 312 configured references—and the branch includes focused regression coverage for the resolved metadata path.

Is this the best way to solve the issue?

Yes, provisionally. Capturing manifest normalization once from the lifecycle-owned plugin snapshot follows the repository’s prepared-facts rule and avoids a competing cache, while preserving the snapshot alias behavior in tests.

AGENTS.md: unclear because the file could not be read completely.

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

Labels

Label changes:

  • add P1: The linked reproduction reports gateway readiness delays long enough to make early health probes time out on multi-agent deployments with many configured models.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides a concrete after-fix source-blind runtime measurement with the observed model count and configured-projection timing, paired with a stated red baseline; redact deployment details if richer logs are later attached.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides a concrete after-fix source-blind runtime measurement with the observed model count and configured-projection timing, paired with a stated red baseline; redact deployment details if richer logs are later attached.

Label justifications:

  • P1: The linked reproduction reports gateway readiness delays long enough to make early health probes time out on multi-agent deployments with many configured models.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides a concrete after-fix source-blind runtime measurement with the observed model count and configured-projection timing, paired with a stated red baseline; redact deployment details if richer logs are later attached.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides a concrete after-fix source-blind runtime measurement with the observed model count and configured-projection timing, paired with a stated red baseline; redact deployment details if richer logs are later attached.

Evidence

What I checked:

  • Prepared-runtime cache boundary: The branch creates the matcher once from pluginMetadataSnapshot.plugins in the workspace preparation path and passes it to configured-model collection, avoiding metadata lookup inside repeated comparisons. (src/agents/prepared-model-runtime.facts.ts:228, 02c6cbb77934)
  • Normalization semantics retained: The branch factors comparison through a supplied normalizer and builds its cached normalizer from manifest policies, while the uncached exported matcher retains the existing default normalization path. (src/agents/embedded-agent-runner/model.static-id.ts:1, 02c6cbb77934)
  • Snapshot-generation regression coverage: The updated static-catalog test verifies that an alias resolves using the captured plugin generation and that the resolver does not fetch current plugin metadata during lookup. (src/agents/embedded-agent-runner/model.static-catalog.snapshot-cache.test.ts:179, 02c6cbb77934)
  • Linked bug remains the canonical report: The PR body links the open startup-stall report and supplies a concrete before/after benchmark claim; the implementation candidate is not a basis to close that issue before this PR merges. (02c6cbb77934)
  • Current review state: The supplied check context shows successful build, boundary, type, dependency, QA smoke, security, and real-behavior-proof runs, but check-lint and openclaw/ci-gate are currently failed and the PR is behind main. (02c6cbb77934)

Likely related people:

  • fuller-stack-dev: The linked bug report records the benchmark, profiler diagnosis, and intended prepared-snapshot boundary; this PR implements that diagnosis. Current-main file-history inspection was unavailable in the read-only execution sandbox, so this is routing context rather than an ownership conclusion. (role: reproduction and proposed-fix author; confidence: low; commits: 02c6cbb77934; files: src/agents/prepared-model-runtime.facts.ts, src/agents/model-ref-shared.ts, src/agents/embedded-agent-runner/model.static-id.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Rebase or otherwise refresh the branch against current main and resolve check-lint plus openclaw/ci-gate on the exact head.
  • Confirm the existing ClawSweeper review comment’s rank-up moves have been applied or explicitly addressed before merge.

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.

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Maintainer landing review for 02c6cbb77934aede3d41177abab36e4d356c4dea:

  • ClawSweeper exact-head check move: both hosted-fork check-lint attempts were runner-canceled during oxlint with exit 143 and no lint diagnostics. The exact-head Blacksmith check:changed proof passed lint, production/test types, dead-code, boundaries, import cycles, and runtime guards; all other substantive GitHub CI shards passed.
  • ClawSweeper base-refresh move: current main has not changed any of the seven touched files or their package/lock inputs. Per the landing policy, this verified head is not being rewritten solely for unrelated behind-main drift; the PR remains conflict-free.
  • Lifecycle contract: prepared lookups are intentionally pinned to the owner-captured plugin metadata generation; standalone lookups remain dynamic. The snapshot-generation alias regression and normalization suite are green.

No ClawSweeper finding remains. I am proceeding through the repository-native prepare and deterministic merge gates.

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Final landing evidence for 02c6cbb77934aede3d41177abab36e4d356c4dea:

  • Exact-head Blacksmith check:changed passed lint, production/test types, dead-code, boundaries, import cycles, and runtime guards.
  • The hosted-fork lint rerun emitted no diagnostic and was terminated by the runner during oxlint (exit 143, "The operation was canceled"); openclaw/ci-gate only reflects that cancellation.
  • The security-sensitive guard failed before classification because its GitHub API fetch failed; this PR does not touch a security-sensitive path.
  • The aggregate Testbox suite exposed six audit-log assertions in src/agents/tool-policy-pipeline.test.ts. That owner and test are unchanged between the reviewed head and current main; focused proof passes 36/36 on both the PR head and current main. Current-main proof: Blacksmith Testbox tbx_01kytmvesj8v0fcyreg7grkvd6, run 30589813927.
  • Current main drift does not overlap the seven PR files. The only merge-critical drift since the reviewed base is scripts/android-app-i18n.ts, unrelated to prepared model metadata publication.
  • ClawSweeper reported no actionable finding, and its rank-up moves have been explicitly addressed.

Proceeding with a maintainer-pinned squash of the reviewed head rather than rerunning the same hosted-runner failure.

@fuller-stack-dev
fuller-stack-dev merged commit f4a7f2b into openclaw:main Jul 30, 2026
195 of 212 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via pinned maintainer squash.

@fuller-stack-dev
fuller-stack-dev deleted the codex/fix-prepared-model-metadata-rescan branch July 30, 2026 23:16
vincentkoc added a commit that referenced this pull request Jul 31, 2026
…-supported-paths

* origin/main: (168 commits)
  fix(plugins): keep registry sqlite root consistent (#116427)
  fix(cli): keep Gateway auth failures parseable in JSON (#116597)
  fix(trajectory): preserve prompts in oversized events (#116220)
  test(buzz): add live QA Lab channel lane (#116298)
  chore(i18n): refresh native locales (#116567)
  feat: add OpenClaw TUI prototype skill (#116583)
  fix(update): accept concrete versions selected by ranges (#116585)
  fix(agents): preserve locked session model routes
  test(qa-lab): preserve Matrix fault proxy identity
  fix(ci): extend OpenAI live profile setup budget (#116580)
  fix: prevent configured models from stalling startup (#116553)
  fix(cli): close MCP listener after one-shot commands
  fix(auto-reply): keep explicit NO_REPLY silent (#116548)
  test(discord): cover deferred backpressure terminals
  fix(discord): cancel backpressured realtime playback
  test(discord): cover realtime output backpressure
  fix(codex): add remote WebSocket heartbeat and reconnect (#116135)
  fix(macos): wait for the current reconnect snapshot (#116550)
  fix(outbound): recognize current-source message-tool sends (#116560)
  fix(voice-call): type cancelled consult outcomes
  ...

# Conflicts:
#	extensions/google/setup-api.test.ts
#	ui/src/e2e/model-setup.e2e.test.ts
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 31, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
…-supported-paths

* origin/main: (168 commits)
  fix(plugins): keep registry sqlite root consistent (openclaw#116427)
  fix(cli): keep Gateway auth failures parseable in JSON (openclaw#116597)
  fix(trajectory): preserve prompts in oversized events (openclaw#116220)
  test(buzz): add live QA Lab channel lane (openclaw#116298)
  chore(i18n): refresh native locales (openclaw#116567)
  feat: add OpenClaw TUI prototype skill (openclaw#116583)
  fix(update): accept concrete versions selected by ranges (openclaw#116585)
  fix(agents): preserve locked session model routes
  test(qa-lab): preserve Matrix fault proxy identity
  fix(ci): extend OpenAI live profile setup budget (openclaw#116580)
  fix: prevent configured models from stalling startup (openclaw#116553)
  fix(cli): close MCP listener after one-shot commands
  fix(auto-reply): keep explicit NO_REPLY silent (openclaw#116548)
  test(discord): cover deferred backpressure terminals
  fix(discord): cancel backpressured realtime playback
  test(discord): cover realtime output backpressure
  fix(codex): add remote WebSocket heartbeat and reconnect (openclaw#116135)
  fix(macos): wait for the current reconnect snapshot (openclaw#116550)
  fix(outbound): recognize current-source message-tool sends (openclaw#116560)
  fix(voice-call): type cancelled consult outcomes
  ...

# Conflicts:
#	extensions/google/setup-api.test.ts
#	ui/src/e2e/model-setup.e2e.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary 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]: Configured models can stall gateway cold startup

1 participant