Repository navigation
fix: stop catalog renewal from stalling agent runs - #157459
Conversation
Keep observation passive, batch provider discovery, and acquire selected native models independently. Reuse worker registrations while preserving request-local auth and exact publication ownership. Remove duplicate worker execution, auth preparation, lookup, and draft publication paths. Retain exact native observations and scoped credential provenance across renewals; release superseded generations and join shared worker recovery. No configuration, dependency, or database migration changes. Refs #157107. Thanks @mmartoccia for the report and production trace.
|
🦞👀 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: blocked before merge. Reviewed September 24, 2026, 4:24 PM ET / 20:24 UTC (Revision 4). ClawSweeper reviewWhat this changesThe branch makes model-catalog observations passive, renews provider inventory through a shared worker, and lets selected native models load while provider renewal is busy. Regression provenancePossible regression — suspected (failure trace). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 4 items remain Keep this PR open. Current main still couples catalog renewal to reads and native selection, while the branch has credible real-worker evidence for the repair. The final revision still lacks the installed-upgrade check needed for the reported v2026.9.6 fleet failure. Priority: P0 Review scores
Verification
How this fits togetherThe prepared model catalog turns plugin discovery and each agent’s configuration and credentials into published model and authentication facts. Agent runs, Gateway model listings, and chat metadata consume those facts. flowchart LR
A[Agent config and credentials] --> B[Catalog owner]
B --> C{Inventory request or observation}
C -->|Renew| D[Shared provider worker]
C -->|Read| F[Published catalog]
B --> E[Selected native loader]
D --> F
E --> F
F --> G[Agent runs and model views]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -9, Tests +1003, Docs +13, Other +2. Total +1009 across 62 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one catalog publication owner, retain request-local credentials and passive observations, and land after a published-version upgrade shows prompt run admission and correct renewal on existing multi-agent state. Do we have a high-confidence way to reproduce the issue? Yes, for the controlled failure path: current-main source couples expiry renewal and native selection, and the PR reports negative controls against a real-worker fleet fixture. The reporter’s exact installation was not rerun. Is this the best way to solve the issue? Yes in direction: the existing catalog owner handles renewal and publication while selected native loading proceeds independently. Published-version upgrade safety remains to be shown. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3fadd8c3f74f. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
|
Adding independent validation of the final PR head Isolated CI run passed on Ubuntu 24.04 / Node 26.7.0, with empty home/state directories and no user/provider credentials:
The test-only overlay and runner are in the diagnostic commit; the run's This supports capture/registration reuse for unchanged synthetic plugin inputs across these agent/expiry cycles. It is not a long-duration retained-heap measurement of the external Codex plugin, nor a macOS physical-footprint comparison. The running 2026.9.6 Gateway was not modified. The whole-file allocation burst and ineffective managed-service worker limits remain separate issues (#155728 and #157575). |
Related: #157107
What Problem This Solves
Fixes agent runs stalling behind catalog renewal when ordinary chat, status, or session reads repeatedly restart discovery on fleet Gateways.
User Impact
Selected native models can acquire metadata while provider discovery is busy. Ordinary observations stay passive; model-inventory requests can renew expired rows in the background. Healthy providers publish updates even if another provider or native catalog hook fails. Saved rows remain available with a refresh warning, and unresolved SecretRefs still fail closed. A scoped refresh also preserves other providers' freshly refreshed credentials.
No new settings, dependencies, or database migration are required. The shipped SDK getter retains background-renewal behavior. Database downgrade/pre-migration backups remain outside this repair, and the reporter's exact installation has not been reproduced directly.
Why This Change Was Made
The catalog owner batches provider renewal and publishes provider/native results independently. Workers share registrations for matching configuration, environment, metadata, and loader workspace while keeping credentials request-local. Per-task workspace reconstruction, the separate in-process worker execution path, duplicate auth preparation/coalescing, parallel draft/rollback state, and duplicate catalog getters are removed. Exact native observations are retained separately from API donor metadata; expired generations release their retained references.
Production changes are 1,261 additions / 1,270 deletions, net −9 lines (plus two lines declaring the test build prerequisite). Thanks @mmartoccia for the report and production trace.
Evidence
[email protected]also passed thelegacy-operator-statescenario: two existing agents, saved operator state and actual agent turns against a synthetic HTTP provider before/after upgrade. ClawRouter loopback E2E passed all three tests, and exact-head CI passed on2f2d7aa81289ae954f6ff1c270114bae0ad36c82.An already-running explicit full acquisition remains coalesced through native settlement. Expiry is demand-renewal metadata, not a strict maximum-age guarantee; selected-native acquisition uses its independent owner and does not suppress provider renewal.
Final-revision CI follow-through
The clean Node 24.19 fixture first reproduced a worker SDK load failure with no root build artifacts: its runtime-build prerequisite was missing from the test plan. Declaring that prerequisite makes the same clean environment pass all three cycles: eight HTTP requests, three registrations, eight completed tasks and zero failures. Test body 1.47s; cold runtime build 49.2s; build plus test wrapper 74.0s. Clean before/after run. Its verified source tree (
8252309b2a0d017d4f4ef110d6d86b18708137e8) is the committed tree in9a5a5bd2a5d5baec878b0add239df4c6ea1c3176. The test now runs in the runtime-artifact CI lane.The auth helper composes in-memory profile snapshots; it changes no persistent writer, schema, version, or migration contract. The final installed-upgrade gate is now satisfied. CI also caught and corrected a test-file size violation, an HTTP fixture type annotation, lint issues, and an obsolete assertion that withheld provider publication until native completion.
Installed upgrade on the final source tree
Blacksmith Testbox run, lease
tbx_01m3afxysfgxq14pje7svd6k3x:[email protected] OPENCLAW_UPGRADE_SURVIVOR_SCENARIOS=legacy-operator-state pnpm test:docker:published-upgrade-survivorpassed. The source/tree was verified before execution; the full package build and tarball validation passed (1,263s), followed by the installed-state scenario (349s). Command exit 0; total command time 29m53s. The one-shot lease is verified completed; its Actions run may show cancelled during successful lease cleanup.Commit
2f2d7aa81289ae954f6ff1c270114bae0ad36c82only refreshes CI after the unrelated main wrapper inventory fix5b210a8eea75; its source tree is identical to tested commit9a5a5bd2a5d5baec878b0add239df4c6ea1c3176. This evidence exercises an installed upgrade with existing multi-agent state. It does not reproduce the reporter's exact installation or change database downgrade/backup policy.Final validation and review disposition
Changed checks and ClawRouter E2E completed on the same verified source tree: all changed checks passed, cold runtime build passed (22m53s), and all three ClawRouter cases passed (39.44s test runner; cold build plus test wrapper 24m22s). After those completed, the subsequent standard upgrade rebuild was intentionally stopped because the separate preserved-state installed upgrade above had already passed; no result is claimed for that redundant scenario.
ClawSweeper revision 4 has no code or security findings. Its requested final installed upgrade and rank-up move are now covered above. The auth snapshot helper does not change persisted data, and the published upgrade supplies the requested compatibility evidence. No code changed after the independently reviewed and tested tree; the last commit only refreshed the CI merge context. The reporter's database downgrade/backup concern remains a separate follow-up in #157107.