Skip to content

fix(models): release superseded catalogs after config reload - #158986

Merged
vincentkoc merged 6 commits into
openclaw:mainfrom
ceckert:codex/fix-catalog-generation-retention
Oct 15, 2026
Merged

vincentkoc merged 6 commits into
openclaw:mainfrom
ceckert:codex/fix-catalog-generation-retention

Conversation

@ceckert

@ceckert ceckert commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: repeated prepared-model catalog refreshes retain superseded catalog inventories after their generations should be collectible.

User Impact

Old inventories can be released while the current model catalog remains usable. Provider identity, credential, native-account and eligibility filtering are unchanged. No configuration or stored-data migration is required.

Why This Change Was Made

Retained catalog callbacks must not close over the predecessor inventory or the refresh's inventory map. The repair separates seed selection from the retained callbacks and binds the existing generation-retirement callback directly.

The October 14 candidate 82a08ac0f7a37c8d918034b6c428c7b02b503413 integrates exact upstream 44898a369528, preserving the published branch's history. The introduced repair is still four files, +98/-10 against that captured main; no collection budget, assertion or timeout was relaxed.

Evidence

  • Fresh RED control: the unchanged retention regression on exact unpatched 44898a369528 collects none of the five superseded inventories and fails its expected [0, 1, 2, 3, 4] assertion. Restoring this fix makes the same test pass.
  • GREEN: all 56 cases across catalog retention, catalog ownership, catalog publication and configured-catalog suites pass through the native test wrapper. Wrapper wall time: 79.12 seconds.
  • Core production types and the owning agents-other test type graph pass. Focused typed lint and formatting pass.
  • Scoped assertion-safety, SQLite worker/dialect, timeout-race and mock-factory ratchets pass without changing their baselines.
  • Fresh isolated local Codex review completed with no actionable P0-P2 findings in the supplied scope. No live Gateway, paid provider or memory/RSS threshold claim is made.

The previous red run 38154192862 failed five test-type jobs on inherited Solid custom-element and Activity/Usage fixture errors. Their upstream repairs, b5a9b9b41c34 and ab6c07f595e9, are included in this captured base. This is source repair and local proof, not a rerun or a claim that the new PR head's CI has passed.

Local ratchet limitation: the combined max-lines/environment gate reports 455 OPENCLAW_* names against the upstream budget of 454. Exact captured main and this candidate have identical sets of 455 names, with no added or removed names; the budget remains unchanged. The per-file line-cap portion passes. Hosted final-head checks and maintainer review remain required.

@clawsweeper

clawsweeper Bot commented Sep 26, 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 labels Sep 26, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR separates predecessor-inventory selection from retained callbacks so superseded model catalogs can be collected after configuration rebuilds.

Example: Six catalog generations are published while logging alternates between info and debug.

  • Before: All five superseded inventories remain retained.
  • After: Inventories 0 through 4 become collectible while the current catalog remains usable.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused owner-level repair with relevant shipped-entry-point collection proof, reported base/head regression results, preserved selection contracts, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The preserved author report exercises the shipped Gateway through authenticated config.patch and models.list with real synthetic catalog workers, observes eleven superseded inventories collected and the current inventory surviving, and rereads unchanged rows after GC; source comparison supports reuse for the unchanged retention repair.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Repeated catalog rebuilds keep obsolete inventories alive and increase retained Gateway memory.
Reason: The change repairs an independently reported resource-lifetime defect with no new option, public API, default, or persistence contract.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it repairs a still-present catalog-retention defect, preserves existing selection behavior, and has relevant shipped-Gateway proof; no actionable introduced defect was found.

Priority: P2
Reviewed head: 82a08ac0f7a37c8d918034b6c428c7b02b503413

Before merge

None.

Findings

None.

Agent review details

How this fits together

The prepared-model runtime rebuilds catalog generations from configuration, provider facts, and prior inventories, then publishes model rows and lifecycle-bound readers to Gateway consumers.

flowchart TD
Config[Configuration publication] --> Refresh[Prepared runtime refresh]
Refresh --> Seed[Predecessor inventory selection]
Seed --> Access[Catalog access callbacks]
Worker[Provider catalog worker] --> Access
Access --> Published[Published model catalog]
Published --> Readers[Gateway model readers]
Refresh --> Retirement[Generation retirement]
Loading

Technical review

Best possible solution:

Land the focused retention repair after the normal current-head gates complete.

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

Current-main source retains the implicated closure scopes, and the author supplies pinned-base failure, candidate collection results, and a shipped-Gateway run; this read-only review executed no target code.

Is this the best way to solve the issue?

The repair addresses retaining references at their existing owners while preserving account filtering, discovery reuse, publication, and retirement behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 936bcad990d7.

Provenance checked

  • Retained catalog seed selection keeps the original intent (ec7c8bb: Inventory selection moved into the existing catalog-source owner during admitted-generation retention work; this establishes the relocation, not the earliest origin of the mechanism.)
  • Discovery-only provider reacquisition keeps the original intent (a14a5d1: Providers whose discovery-only account identity cannot be retained must be reacquired after configuration rebuilds.)
  • Plugin-generation retirement callback keeps the original intent (6c9809a: Configured runtimes recover when their admitting Gateway's borrowed plugin generation retires.)
  • Database-worker test routing keeps the original intent (3d3bc8a: Real model preparation tests follow their database-worker project and existing prerequisites.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit ec7c8bb adds src/agents/prepared-model-runtime.catalog-source.ts:145 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ec7c8bb9454b; files: src/agents/prepared-model-runtime.catalog-source.ts)
  • Ayaan Zaidi: Raw commit a14a5d1 adds src/agents/prepared-model-runtime.catalog-source.ts:149 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a14a5d1908eb; files: src/agents/prepared-model-runtime.catalog-source.ts)

PR surface

Source +21, Tests +67. Total +88 across 4 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 2 31 10 +21
Tests 2 67 0 +67
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 98 10 +88

Review metrics

Metric Value Why it matters
Production versus test growth Production +31/-10; regression test +66/-0; test routing +1/-0 Production growth isolates temporary predecessor references from retained callbacks; the regression checks actual collection rather than helper structure.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #158981
Summary: This PR implements the canonical predecessor-inventory retention repair; neighboring memory fixes address different retaining edges.

Members:

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

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This fixes accumulating obsolete catalog inventories during repeated rebuilds without establishing an immediate outage or a measured whole-Gateway memory-growth rate.
  • 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.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 2026-10-11T16:20:15.347Z sha b8396ba :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-11T22:17:30.833Z sha b8396ba :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-11T22:26:51.041Z sha b8396ba :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T00:02:39.605Z sha b8396ba :: needs maintainer review before merge. :: none

Reviewed October 14, 2026, 10:00 AM ET / 14:00 UTC (Revision 5).

@ceckert

ceckert commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

Added the requested real-setup proof to the PR body, including the complete disposable probe so it can be reproduced on both revisions.

The production plugin loader, SQLite auth store, runtime publication, provider catalog hook, and native worker are all exercised without mocking discovery. Six logging-only reloads produce:

                                base b458b9f1   PR db83fac9
superseded inventories collected []              [0,1,2,3,4]
current generation still owned   true            true
current catalog model rows       2               2
catalog changed across reloads   no              no
pending discovery / worker tasks 0 / 0           0 / 0
result                          FAIL            PASS

Actual provider invocation and worker-thread markers confirm discovery ran on every reload. The current catalog is read again after GC. This is real source-runtime proof, not a full Gateway deployment or an RSS/OOM benchmark; the precise boundary and commands are in the body. The small permanent regression remains unchanged, so this adds evidence without adding another maintained test.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 26, 2026
@ceckert
ceckert force-pushed the codex/fix-catalog-generation-retention branch from db83fac to deca218 Compare October 1, 2026 18:04
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Oct 1, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 Oct 1, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Oct 1, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 2, 2026
@ceckert

ceckert commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Refreshed this PR to the current catalog-source owner at 1a867b79604fdb849c2db05bb98cd0ef2624932a, preserving both original commits and leaving the final tested/reviewed tree byte-identical. It is mergeable against the observed current main; no unrelated main-only refresh was made.

The body now includes the freshly executed October 11 real-worker paired proof and complete disposable probe: clean 38f4562 retains all five predecessors; the final repair releases all five while rereading the same six current model rows after GC. Targeted 31-test checks and owning types passed; broader inherited UI diagnostics and the isolated review's P0 scope are stated explicitly.

@clawsweeper re-review

Maintainers: please review the refreshed exact head for merge after the normal current-head CI/security/review gates complete. The older October 2 review is not being reused as current approval.

@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S and removed size: XL labels Oct 11, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 Oct 11, 2026
@ceckert

ceckert commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

The requested actual shipped-Gateway catalog-rebuild/collection evidence is now recorded in the PR body at unchanged exact head b8396bafc94b32df4f2533e5664b5dbf394d0a2f.

One supported local pnpm openclaw gateway run process handled five normal token-authenticated model-credential config.patch applications and six models.list refresh reads. Real synthetic catalog workers ran on threads [10,12]. Read-only Inspector instrumentation at the exact unmodified shipped publication owner observed twelve inventory identities: all eleven superseded identities [0..10] collected within the existing twenty GC/event-loop turns; identity 11 remained alive, and a fresh post-GC models.list returned the same configured/discovered rows and hash. No prepared-runtime helper was invoked to force the Gateway rebuild. Normal SIGTERM shutdown completed cleanly. Product source and built chunk bytes remained unchanged.

Exact-head full pnpm build also passed. Its report-only UI size advisories, one locally passing owner type graph, the earlier paired clean-base/direct-helper proof and the unresolved five hosted core-test-type failures are kept separate and explicit. Harness setup failures were corrected only in disposable tooling and are not represented as runtime passes. This is synthetic local Gateway/config/catalog proof, not deployed/paid-provider acceptance or a CI waiver. No external CI dispatch/rerun or source push was used for this evidence update.

Please review this author update and pursue normal maintainer landing once the outstanding current-head CI failures have been causally attributed/resolved and the remaining repository gates pass. No admin, security or inherited-failure bypass is requested.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 12, 2026
Integrate exact 44898a3 containing the upstream Solid tag and Activity fixture repairs. Keep the four-file inventory retention repair unchanged.
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 14, 2026
@vincentkoc vincentkoc self-assigned this Oct 15, 2026
@vincentkoc
vincentkoc merged commit c8260d9 into openclaw:main Oct 15, 2026
146 of 147 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
…w#158986)

* fix(models): release superseded catalog generations after reload

* fix(models): release inventories held by native retirement callbacks

* fix(models): release retained catalog closure inventories
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. 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.

3 participants