Skip to content

fix(agents): tolerate replaced thinking catalog owners - #127284

Merged
RomneyDa merged 5 commits into
mainfrom
codex/prepared-thinking-reload
Sep 1, 2026
Merged

RomneyDa merged 5 commits into
mainfrom
codex/prepared-thinking-reload

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Aug 21, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Skip a published prepared-model snapshot when its config generation was replaced.
  • Continue through the existing provider-scoped static/live thinking-catalog fallback.
  • Cover a skills hot-reload config mismatch with a focused regression.

Root cause

The turn-path thinking lookup documents a published-owner → scoped-static → scoped-live fallback. Its published-owner loop instead threw PreparedModelCatalogConfigReplacedError on a generation mismatch, aborting agent admission before the scoped fallback. Run 32444623691 reproduced this twice after toggling a workspace skill: agent.wait returned error: prepared model catalog owner config was replaced during the read.

Validation

  • Pre-fix live evidence: plugin-lifecycle-hot-reload, run 32444623691, both agent attempts rejected before provider fetch.
  • Regression: mismatched skill config now reaches the scoped provider catalog.
  • git diff --check
  • Autoreview: clean, 0.99.
  • Focused Vitest is delegated to PR CI because isolated worktrees intentionally have no reconciled dependencies.

LOC

  • Production: +1 / -1
  • Tests: +34 / -5

No Codex runtime/protocol behavior is involved.

@clawsweeper

clawsweeper Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels Aug 21, 2026
@RomneyDa
RomneyDa force-pushed the codex/prepared-thinking-reload branch from a9c669f to 4c34834 Compare August 21, 2026 16:56
@RomneyDa
RomneyDa force-pushed the codex/prepared-thinking-reload branch from 4c34834 to 86d1565 Compare August 21, 2026 17:00
@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. P2 Normal backlog priority with limited blast radius. labels Aug 21, 2026
@clawsweeper

clawsweeper Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 6:42 PM ET / 22:42 UTC.

ClawSweeper review

What this changes

The PR skips a prepared model catalog snapshot whose configuration was replaced, allowing thinking lookup to use provider-scoped discovery and setup finalization to continue without stale catalog-derived hints.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open. Current main still throws on a replaced scoped catalog owner; this PR restores the documented thinking-catalog fallback and makes setup finalization avoid deriving hints from stale facts. No introduced correctness finding was found, but the MEMBER-authored, maintainer-labeled PR needs maintainer acceptance of the setup-flow compatibility tradeoff.

Priority: P2
Reviewed head: d1e6847c32024b2239f6b42eb0dd2c049b363ac3
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-supported repair with targeted regression coverage and one explicit compatibility decision remaining.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored PR is exempt from the external-contributor proof gate; its supplied hot-reload and beta observations remain supporting review evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored PR is exempt from the external-contributor proof gate; its supplied hot-reload and beta observations remain supporting review evidence.
Evidence reviewed 7 items Current-main failure path: Current main still throws the replaced-config error when a scoped read-only candidate does not match the prepared owner, so the PR's central behavior is not already implemented.
Introduced thinking recovery: The introduced hunk changes only the mismatch decision from throwing to continuing, which reaches the existing provider-scoped static/live fallback immediately below it.
Turn-path caller: Embedded attempts invoke provider-scoped thinking lookup only when the route still needs capability hydration, making the scoped fallback the correct owner boundary for this part of the repair.
Findings None None.
Security None None.

How this fits together

Agent turns consult a prepared model catalog for thinking capability, while setup finalization uses it for bootstrap and authentication guidance. A Gateway configuration reload can replace that catalog generation, so callers must not consume its old facts.

flowchart LR
  A[Agent turn or setup finalization] --> B[Prepared model catalog]
  B --> C{Owner config matches?}
  C -->|yes| D[Use catalog facts]
  C -->|no| E[Scoped discovery or no derived hints]
  D --> F[Thinking selection or TUI]
  E --> F
Loading

Decision needed

Question Recommendation
Should setup finalization continue into the TUI without catalog-derived bootstrap or missing-auth messaging when the active catalog owner still represents the configuration before the deferred Gateway restart? Accept bounded recovery: Allow setup to complete without stale model hints until the deferred restart publishes the new owner.

Why: The code correctly avoids mixing generations, but whether this temporary operator-facing degradation is preferable to failing finalization is a maintainer compatibility choice.

Before merge

  • Resolve merge risk (P1) - Setup finalization now proceeds without a model-specific hatch or missing-auth note during a catalog-generation replacement; maintainers should explicitly accept that temporary compatibility behavior.
  • Resolve merge risk (P1) - This bug fix adds 12 net production lines; the typed recovery and absent-fact guards are focused, but the scope should remain limited to these two callers.
Agent review details

Security

None.

PR surface

Source +12, Tests +79. Total +91 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 24 12 +12
Tests 2 85 6 +79
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 109 18 +91

Review metrics

Metric Value Why it matters
Production versus test LOC production +24/-12 (net +12); tests +85/-6 (net +79) The production growth implements two narrow catalog-generation recovery paths; most of the change is focused regression coverage.

Merge-risk options

Maintainer options:

  1. Accept the setup recovery (recommended)
    Merge the typed recovery after confirming that continuing without stale bootstrap guidance is the intended upgrade behavior.
  2. Split the setup change
    Keep the scoped thinking fallback but defer the wizard behavior until maintainers choose its operator-facing fallback contract.

Technical review

Best possible solution:

Keep the scoped thinking fallback and typed setup recovery, with no stale catalog facts reused; merge after maintainer acceptance of the temporary no-hint setup behavior and exact-head checks.

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

Yes—source establishes a focused reproduction: present a published owner with a different config to a provider-scoped thinking read; current main throws before the documented scoped fallback. The PR body also records the corresponding hot-reload failure.

Is this the best way to solve the issue?

Unclear overall: the thinking change is the best fit for its existing fallback chain, while the wizard's no-hint recovery is a maintainership choice rather than a purely mechanical repair.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded agent configuration-reload defect with limited blast radius.
  • merge-risk: 🚨 compatibility: The wizard changes a replaced-owner race from a visible error to a completed setup flow without model-derived messaging.
  • 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: This MEMBER-authored PR is exempt from the external-contributor proof gate; its supplied hot-reload and beta observations remain supporting review evidence.

Evidence

What I checked:

  • Current-main failure path: Current main still throws the replaced-config error when a scoped read-only candidate does not match the prepared owner, so the PR's central behavior is not already implemented. (src/agents/prepared-model-catalog.ts:327, d225e672bd21)
  • Introduced thinking recovery: The introduced hunk changes only the mismatch decision from throwing to continuing, which reaches the existing provider-scoped static/live fallback immediately below it. (src/agents/prepared-model-catalog.ts:327, d1e6847c3202)
  • Turn-path caller: Embedded attempts invoke provider-scoped thinking lookup only when the route still needs capability hydration, making the scoped fallback the correct owner boundary for this part of the repair. (src/agents/command/run-embedded-attempt.ts:433, d1e6847c3202)
  • Wizard exact-read contract: An existing catalog test proves that an ordinary read-only catalog request without provider-scoped discovery rejects a full generation replaced by another config; the introduced wizard handler catches only that typed error and does not reuse its facts. (src/agents/prepared-model-catalog.test.ts:345, d1e6847c3202)
  • Focused regression coverage: The new thinking test supplies a mismatched published owner and verifies provider-scoped static discovery resolves the replacement model; the wizard test verifies only the typed replacement error suppresses derived TUI messaging, while unrelated errors propagate. (src/agents/prepared-model-catalog.scoped-thinking.test.ts:178, d1e6847c3202)
  • Introduced-hunk provenance: The wizard behavior was introduced by the current head commit, whose recorded parent is the prior reviewed head; the raw-parent diff contains the typed catch and guarded hint derivation. (src/wizard/setup.finalize.ts:763, d1e6847c3202)

Likely related people:

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

Rank-up moves

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

  • Record maintainer acceptance of the setup-flow no-hint behavior, then let exact-head checks complete 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.

History

Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-21T17:36:19.593Z sha 86d1565 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-23T00:03:52.153Z sha 86d1565 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-23T00:46:42.881Z sha 86d1565 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-23T02:00:54.460Z sha 86d1565 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-24T18:39:56.899Z sha 86d1565 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-24T22:57:39.639Z sha 598bc33 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-29T03:31:15.535Z sha 598bc33 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-01T22:12:32.901Z sha 55600f8 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. clawsweeper-recovery-stuck rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. clawsweeper-recovery-stuck labels Aug 23, 2026
@RomneyDa

Copy link
Copy Markdown
Member Author

Applied the latest Rank-up move by merging current into head and rerunning the exact focused catalog regression: 5/5 passed in 13.44s. The current-head test proves a mismatched prepared owner is rejected and the requested replacement model is resolved from provider-scoped static discovery. A full workspace-skill QA rerun is not available locally because this host has no isolated Docker/Testbox lane; no test-only seam was added. Deslop found no issues; autoreview is clean (0.98).

@RomneyDa

Copy link
Copy Markdown
Member Author

Correction to the preceding shell-mangled note: Applied the latest Rank-up move by merging current main and rerunning the exact focused catalog regression: 5/5 passed in 13.44s. The current-head test proves a mismatched prepared owner is rejected and the requested replacement model is resolved from provider-scoped static discovery. A full workspace-skill QA rerun is unavailable locally because this host has no isolated Docker/Testbox lane; no test-only seam was added. Deslop found no issues; autoreview is clean (0.98).

@AndrewEAUS

Copy link
Copy Markdown

Live beta validation from a mixed-provider deployment supports this change.

On 2026.9.1-beta.1 / 1d96e5aee2d, the existing throw guard still produced prepared model catalog owner config was replaced during the read when provider-scoped thinking/catalog work raced an owner replacement. Applying this PR's continue-to-fallback behavior as one component of a source-built package removed that admission failure. Focused catalog/selector tests and the full build passed; post-install Grok and explicit OpenAI/Codex canaries completed without fallback.

Two adjacent defects were also required for the complete user-visible repair and are now split into separate PRs:

Those are independent of this PR; I am noting them because all three failures surfaced together in Model Setup and mixed-provider selection, while this PR remains the correct narrow fix for the replaced-owner catalog fallback.

@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@RomneyDa RomneyDa self-assigned this Sep 1, 2026
@RomneyDa

RomneyDa commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

CI failure is unrelated

@RomneyDa
RomneyDa merged commit bf599a7 into main Sep 1, 2026
485 of 489 checks passed
@RomneyDa
RomneyDa deleted the codex/prepared-thinking-reload branch September 1, 2026 22:47
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 2, 2026
* fix(agents): tolerate replaced thinking catalog owners

* fix(wizard): tolerate replaced catalog during finalize

Co-authored-by: Copilot App <[email protected]>

---------

Co-authored-by: Karen Lai <[email protected]>
Co-authored-by: Copilot App <[email protected]>
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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. 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.

3 participants