Skip to content

fix(models): prepare configless catalogs asynchronously - #152142

Merged
steipete merged 2 commits into
mainfrom
codex/models-config-async-cold-20260918
Sep 18, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/models-config-async-cold-20260918

Conversation

@steipete

@steipete steipete commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

When model-catalog preparation is called without explicit config, its planner and writer synchronously load runtime configuration. That can inspect Claw consent provenance on the host thread even though the caller is asynchronous.

User Impact

Moves this incidental config and consent preparation onto the existing asynchronous path while preserving generated catalogs, source secret markers, and Claw tool-policy decisions.

Why This Change Was Made

Both entrypoints now share the captured async config reader. Its internal opt-in result retains runtime config, authored source, and effective environment together before the caller resumes. Later publication, reset, or environment changes cannot mix generations or redirect default directory resolution. Explicit config and the synchronous SDK retain their existing paths; no new cache or database owner is introduced.

Evidence

  • Both original real-SQLite caller cases reproduced two host Claw provenance queries. The repaired cases preserve the complete catalog and consent decision without those queries.
  • 87 tests pass, covering source republication with the same runtime object, reset, secret markers, caller environment/options, default directories, cancellation, and existing Claw consent controls.
  • The unchanged feature retains its production/test typechecks, lint, formatting, guard, build, and compiled proof. The current-main carry passed 66 focused config, consent, and pooled-header lifetime tests, scoped lint/format/line-cap/import-cycle checks, and fresh P0–P2 review.
  • Fresh-process compiled planner and writer outputs match their explicit-config controls with normal discovery and default directory resolution enabled.

The compiled writer retains the same single Claw lifecycle read as its explicit-config control when catalog persistence opens the agent/root database owners. Other catalog and credential SQLite work remains with its existing owners; this does not claim that the entire model flow performs no host SQL. OAuth, secrets activation, updater behavior, and metadata lookup ordering are outside this change.

The first CI run tested a stale merge against 47c4fbcb and failed on three duplicate promisify declarations in shared SQLite tests. This normal main carry includes the canonical repair from #152028 (3fceb860); it preserves the complete feature diff and retired header paths. Successor CI run 35396508084 passed on c734eb623ede2e5f44ca617a2fca1afd941b0380, including the required CI gate (140 successful jobs, 17 skipped).

@clawsweeper

clawsweeper Bot commented Sep 18, 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 agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Sep 18, 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 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 18, 2026, 6:09 PM ET / 22:09 UTC (Revision 4).

ClawSweeper review

What this changes

Model-catalog planning and writing load omitted configuration asynchronously while retaining matching source settings, environment, and caller options.

Merge readiness

✅ Ready for maintainer review

This remains useful: current main still performs synchronous config preparation for these callers. No actionable introduced defect was found, and the prior review has no outstanding findings.

Priority: P2
Reviewed head: c734eb623ede2e5f44ca617a2fca1afd941b0380

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful regression coverage and no supported correctness blocker.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary contributor-proof gate is exempt for this maintainer-authored internal change. The body reports compiled planner/writer comparisons and real-SQLite consent checks; those runs were not independently repeated, and related worker-error screenshots were excluded.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary contributor-proof gate is exempt for this maintainer-authored internal change. The body reports compiled planner/writer comparisons and real-SQLite consent checks; those runs were not independently repeated, and related worker-error screenshots were excluded.
Evidence reviewed 8 items Current main still contains the reported path: At fetched main, resolveModelsConfigInput calls getRuntimeConfig synchronously when configuration is omitted; both catalog entrypoints use that preparation.
Shared async owner and stable inputs: The configless branch copies mutable caller options before awaiting the existing async reader, then uses its captured environment for default directories and discovery. Explicit configuration retains its existing projection path.
Publication capture preserves existing guards: The opt-in capture occurs before returning from the publication owner. Existing selector, generation, preparation, and rollback checks remain in place; snapshots retain resolution facts and legacy directory ownership.
Findings None None.
Security None None.

How this fits together

Model-catalog preparation combines configured providers, discovery results, and authored secret markers. It produces planned catalog contents or updates the agent’s models.json and plugin catalog cache.

flowchart TD
  A[Catalog request] --> B{Explicit config supplied?}
  B -->|Yes| C[Existing config projection]
  B -->|No| D[Async runtime config preparation]
  D --> E[Capture config source and environment]
  C --> F[Shared catalog planner]
  E --> F
  F --> G[Return planned catalogs]
  F --> H[Serialized catalog writes]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +58, Tests +241. Total +299 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 5 153 95 +58
Tests 3 241 0 +241
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 394 95 +299

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +58 net lines; tests +241 net lines Production growth supports coherent capture across asynchronous boundaries, with regression coverage for both catalog entrypoints and publication races.

Technical review

Best possible solution:

Keep configless catalog preparation on the existing async owner while preserving source markers, consent preparation, and established catalog persistence.

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

Yes, from source: a cold catalog call without explicit configuration reaches synchronous loading and snapshot preparation on current main. Runtime reproduction was not executed during this read-only review.

Is this the best way to solve the issue?

Yes. Reusing the existing async loader and capturing its publication before continuation avoids a competing config owner while preserving the established catalog contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8adb6ebf5f63.

Labels

Label justifications:

  • P2: This is a bounded responsiveness fix for cold model-catalog preparation without an established urgent user outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary contributor-proof gate is exempt for this maintainer-authored internal change. The body reports compiled planner/writer comparisons and real-SQLite consent checks; those runs were not independently repeated, and related worker-error screenshots were excluded.

Evidence

What I checked:

  • Current main still contains the reported path: At fetched main, resolveModelsConfigInput calls getRuntimeConfig synchronously when configuration is omitted; both catalog entrypoints use that preparation. (src/agents/models-config.ts:185, 8adb6ebf5f63)
  • Shared async owner and stable inputs: The configless branch copies mutable caller options before awaiting the existing async reader, then uses its captured environment for default directories and discovery. Explicit configuration retains its existing projection path. (src/agents/models-config.ts:203, c734eb623ede)
  • Publication capture preserves existing guards: The opt-in capture occurs before returning from the publication owner. Existing selector, generation, preparation, and rollback checks remain in place; snapshots retain resolution facts and legacy directory ownership. (src/config/runtime-snapshot.ts:616, c734eb623ede)
  • Focused regression coverage: Both real-SQLite entrypoint cases check catalog contents, published Claw consent, and absence of host claw_installs queries. Additional cases cover source republication, selector changes before publication, default directories, caller options, and queued replacement. Tests were inspected, not executed in this read-only review. (src/config/io.runtime-models.test.ts:68, c734eb623ede)
  • Existing persistence and authority contract: Documentation distinguishes generated inventory from request credentials and requires source-authoritative secret markers. The patch preserves the existing planner and persistence owners without changing schemas, configuration defaults, plugin APIs, or tool grants. Public docs: docs/concepts/models.md. (docs/concepts/models.md:451, c734eb623ede)
  • Discussion, proof, and related work: The captured PR body reports compiled fresh-process planner/writer comparisons against explicit-config controls and passing focused validation. It explicitly excludes unrelated catalog SQL and OAuth changes. The merged fix: preserve model failure causes and worker fallback runtime #152028 supplies the shared test repair, not this fix; its downloaded screenshots show worker-error messages and were not counted as catalog proof. (c734eb623ede)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-18T20:28:04.225Z sha 9b4a7b0 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-18T20:53:33.140Z sha 9b4a7b0 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-18T21:30:09.426Z sha c734eb6 :: needs maintainer review before merge. :: none

@steipete
steipete marked this pull request as ready for review September 18, 2026 20:48
@steipete
steipete merged commit aa6d12c into main Sep 18, 2026
219 checks passed
@steipete
steipete deleted the codex/models-config-async-cold-20260918 branch September 18, 2026 23:02
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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