Repository navigation
fix(agents): reduce memory used by background model discovery - #167282
Conversation
Keep provider catalog workers within their eligible provider-plugin scope. Native harness model observations remain parent-owned; normal agent and isolated-completion owner selection stay unchanged.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesBackground model discovery loads only eligible provider plugins, avoiding unnecessary native agent execution code while preserving native model choices. Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR remains necessary because current main still contains the catalog-scope defect. The maintainer-authored repair has no actionable findings or additional merge blockers. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherOpenClaw discovers provider models in a background worker and native agent models through a parent-owned catalog. The plugin load planner determines which runtime code each path initializes. flowchart TD
A[Model discovery request] --> B[Plugin load planner]
B --> C{Preparation purpose}
C --> D[Provider catalog worker]
C --> E[Agent or isolated completion]
D --> F[Eligible provider plugins]
E --> G[Selected provider and harness]
H[Parent native catalog owner] --> A
Technical reviewBest possible solution: Keep provider discovery scoped in the existing planner and native model observations in the parent catalog owner. Do we have a high-confidence way to reproduce the issue? Yes, source establishes that declared harness metadata adds execution owners outside the worker's requested provider scope. The extended cases target that mechanism; no failing run was executed during this read-only review. Is this the best way to solve the issue? Yes, removing blanket activation at the load-plan owner repairs the cause without introducing another discovery path, while preserving agent and isolated-completion selection. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7b627f476aef. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -14, Tests +9. Total -5 across 2 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)Reviewed October 9, 2026, 6:31 PM ET / 22:31 UTC (Revision 4). |
…aw#167282) Keep provider catalog workers within their eligible provider-plugin scope. Native harness model observations remain parent-owned; normal agent and isolated-completion owner selection stay unchanged.
Salvage the catalog registration facts and local callback lifetime repairs from bot-owned PR openclaw#158369 onto current main. Omit the native harness catalog fix already landed in openclaw#167282 and the shared inbound repair from openclaw#160658. Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Background provider-model discovery unnecessarily loads native agent-harness execution code into its worker, duplicating runtime graphs and increasing memory use.
User Impact
Less memory during background model discovery, without removing native model choices. No configuration, schema, dependency, or migration changes.
Why This Change Was Made
Keep the catalog worker within its eligible provider-plugin scope. Native harness observations remain with the existing parent owner. Normal agent selection and main’s newer isolated-completion selection are unchanged.
This forward-ports the reviewed release repair, with the condition adapted to preserve main’s additional load purpose.
Evidence
pnpm test src/agents/harness/runtime-plugin.test.ts --maxWorkers=1: 47 passed; 10.11 seconds wall time. CI timing has not yet been observed. No new test cases, timers, or process fixtures were added.Review-ready verification — October 9, 2026
Verified unchanged head
e58f73edcb6cc5fe5513dcf2db4bfab0a112ff67; no additional source changes or rebase were necessary.openclaw/ci-gate.Best-fix verdict: best. Remove catalog-wide harness activation at its load-plan owner; do not add downstream worker filters or duplicate native discovery.
runtime-plugins.tscarries the plan into the loader;prepared-model-catalog.worker.tssupplies eligible provider owners;prepared-model-runtime.catalog-access.tsandharness/model-catalog.tsretain native discovery in the parent. Agent and isolated-completion selection remain canonical. Production delta: −14 LOC; tests: +9 LOC.The acting reviewer also directly checked sibling Codex source:
codex-rs/app-server/src/model_catalog.rs:32–45,codex-rs/app-server/src/request_processors/catalog_processor.rs:178–217,280–330, andcodex-rs/app-server-protocol/src/protocol/v2/model.rs:55–65,178–183(checkoutd25c114d494ddb693290b76bf5e5f64ecbdb38fc). No Codex protocol changes.Remaining proof limitation: the fresh tests exercise real worker/loader and Gateway handler boundaries with synthetic providers; they are not authenticated live-provider proof or exact-head Gateway memory measurements. The earlier release-source memory observations remain explicitly attributed to that source. PR is ready for review, not merged.