Skip to content

fix: /models stops working after an unrelated config edit and never recovers - #128608

Merged
obviyus merged 4 commits into
openclaw:mainfrom
Marvinthebored:fix/prepared-model-config-stamp-128515
Aug 25, 2026
Merged

obviyus merged 4 commits into
openclaw:mainfrom
Marvinthebored:fix/prepared-model-config-stamp-128515

Conversation

@Marvinthebored

@Marvinthebored Marvinthebored commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Related: #128515

AI-assisted: implemented by a Codex-based agent, reviewed and validated by Claude (Opus 5).

What Problem This Solves

Fixes an issue where operators who edit a config key that needs no reload work would find /models
permanently broken on every chat surface until they restart the gateway.

openclaw config set <key> prints "No gateway restart needed.", the config publishes, agent
turns keep working, and /ready keeps returning 200 — but the model picker never appears again.
Re-running the command produces the same failure for the life of the process. The trigger key does
not have to be model-related; the reported case was talk.realtime.instructions.

Why This Change Was Made

Prepared model owners are stamped with a hash of the whole config. A config transaction whose
reload plan is empty publishes the new runtime config but never advances that stamp, so a strict
policy read compares the newly published config against the previous stamp and is rejected. Nothing
repairs it before a restart.

This advances the model-neutral config stamp in place for no-op publications rather than rebuilding
the prepared generation — a rebuild is waste when the planner has already determined that nothing
needs doing. Existing leases keep their immutable snapshot, auth stores and materializations are
carried onto the restamped snapshot, pending builds restamp at commit, and read-only owners are left
alone. Deferred startup publication now resolves its config inside the serialized refresh and fences
a superseded plugin generation, so a no-op commit that lands mid-startup cannot publish a stamp that
is already stale.

Boundaries. The advance is gated on isNoopGatewayReloadPlan — no restart, no hot reasons, no
channel, hook, or plugin work. Hot and restart plans rebuild exactly as before. Correctness rests on
the reload rule table in src/gateway/config-reload-plan.ts being the single authority on what is
model-relevant; no second copy of that classification is introduced.

Non-goal. #128515 also reports prepared model runtime plugin generation was superseded from
background lanes. That is a different guard and this change is not claimed to address it.

User Impact

/models and other prepared-catalog consumers keep working after a config edit that reports "No
gateway restart needed." Operators no longer have to restart the gateway to recover the model
picker. No behavior change for hot or restart reloads, and no change to what a prepared generation
contains.

Evidence

Regression tests fail on stock and pass patched. Reverting only the source hunks — the tests left
in place — fails 11 assertions across 4 files:

 × advances without rebuilding or mutating existing readers
 × resolves startup config inside the serialized publication
 × keeps an in-flight auth publication on the advanced stamp
 × uses the current runtime config for deferred model publication
 × passes a current-config supplier after loading the prepared runtime
 × drops a stale plugin generation after loading the prepared runtime
 × skips model publication when the startup plugin generation loses ownership
 × advances prepared model config stamps for a no-op publication
 Test Files  4 failed (4)
      Tests  11 failed | 302 passed (313)

With the source restored, on the current main base:

 Test Files  4 passed (4)
      Tests  313 passed (313)

The no-op test asserts absence as well as presence — ensureOpenClawModelsJson is called exactly
once across the advance, so the prepared generation is demonstrably not rebuilt, and the prior
reader's config is unchanged.

The isNoopGatewayReloadPlan gate is mutation-tested. Removing the gate so every commit advances
the stamp left all 219 tests in server-reload-handlers.test.ts green, so an assertion was added
that a hot plan must not advance the stamp in place. The same mutation now fails:

 × applies a current in-process hot config
 Test Files  1 failed (1)
      Tests  1 failed | 218 passed (219)

node scripts/check-changed.mjs exits 0.

Live failure on a real Gateway (before). The reported host runs a Discord native command
surface. Editing talk.realtime.instructions there — the CLI printing "No gateway restart needed." —
and then invoking /models produced this, twice, with no recovery between attempts (paths redacted):

2026-08-24T11:08:26.914+08:00  discord interaction handler failed: PreparedModelCatalogConfigReplacedError:
  prepared model catalog owner config was replaced during the read (/Users/<user>/.openclaw/agents/main/agent)
2026-08-24T11:15:40.184+08:00  discord interaction handler failed: PreparedModelCatalogConfigReplacedError:
  prepared model catalog owner config was replaced during the read (/Users/<user>/.openclaw/agents/main/agent)

Throughout, the Gateway reported healthy, /ready returned 200, and ordinary agent turns worked.

Live reproduction on a real Gateway. Reproduced on a second, independent host running stock
current main
(no part of this branch), with a full ten-provider catalog and a live Discord
channel. Sequence: restart, one ordinary agent turn to publish a prepared owner,
openclaw config set talk.realtime.instructions ... (which prints "No gateway restart needed."),
then /models as a Discord slash command:

2026-08-24T11:55:54.913Z ERROR [discord/monitor]
discord interaction handler failed: PreparedModelCatalogConfigReplacedError:
prepared model catalog owner config was replaced during the read
(<statedir>/agents/main/agent)

The command never returns; the user sees a spinner that does not resolve.

The failure is specific to the interaction path. Four other surfaces were tried against the same
stock build and none reproduces it: a minimal Gateway with two providers, the chat.send RPC with
the full catalog, a cold browse cache (restart, then a non-/models turn to publish the owner
before the edit), and an ordinary Discord message reading /models, which answered normally in
2.4 s. Only the native slash command, which enters through the Discord interaction dispatcher,
fails.

Restarting the Gateway is the only recovery, and it is complete. On the originally reporting
host, a restart at 16:01:23 ended both symptoms in the same instant:

symptom before restart after
plugin generation was superseded (background lane, 30 s retry) 1248, 11:19:43 → 16:01:07 0
PreparedModelCatalogConfigReplacedError (/models) 2, 11:08:26 and 11:15:40 0

What this evidence does not establish. The rows above are for the unfixed build. A matching
post-fix capture on the same surface is not included yet. Note also that the 1248-row symptom is a
different guard from the one this PR changes; it is reported in #128515 and is not claimed to be
fixed here.

@Marvinthebored
Marvinthebored requested a review from a team as a code owner August 24, 2026 08:09
@clawsweeper

clawsweeper Bot commented Aug 24, 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 gateway Gateway runtime agents Agent runtime and tooling labels Aug 24, 2026
@clawsweeper clawsweeper Bot added mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. 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 Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 11:02 PM ET / August 25, 2026, 03:02 UTC.

ClawSweeper review

What this changes

The PR keeps prepared model catalogs and reply-dispatch snapshots aligned with a committed no-op Gateway configuration update, rebuilding instead when provider-auth state changes.

Regression provenance

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

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep this PR open for landing: current main still lacks the committed-config restamp path, while the branch has a source-backed fix, focused regressions, and inspected before/after Telegram proof. No blocking patch defect was found; rebase/refresh and exact-head required checks remain the merge gate.

Priority: P1
Reviewed head: 6311e8bb9b3961823f05fda055010ff039b9a758

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong visible behavior proof and focused lifecycle regressions support a mergeable fix, pending the routine exact-head refresh and checks.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Mantis’s real Telegram before/after flow shows the post-edit callback reach the model list; the inspected candidate GIF visibly shows the nine-model picker, unlike the baseline.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Mantis’s real Telegram before/after flow shows the post-edit callback reach the model list; the inspected candidate GIF visibly shows the nine-model picker, unlike the baseline.
Evidence reviewed 6 items Current-main gap: Current main wires the no-op secret commit directly and has no runtime-commit hook or prepared-owner restamp; the PR adds that owner-boundary publication work.
Committed-config owner boundary: The branch records the resolved committed config at the runtime commit edge, advances only no-op/auth-neutral plans, and rebuilds with the committed config when auth must be rewarmed.
Snapshot invariant: Restamping produces a new immutable snapshot, carries its private auth bindings, and leaves existing readers immutable; reply-dispatch projections receive the same committed config.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

pnpm openclaw --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128608-m3N8gw/target$ pnpm openclaw --help
$ node scripts/run-node.mjs --help
pnpm openclaw --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 89.21 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.6s
node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

[tsdown-build] invocation 2/2 finished in 12.9s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 3715ms (slowest: built plugin control-plane loads 2867ms)

OpenClaw 2026.8.1 (6311e8b) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console 
… output truncated …

Assertions:

  • PASS expect_output: Usage:

How this fits together

Gateway configuration transactions publish resolved runtime configuration, while prepared model-runtime owners serve model catalogs to reply and channel-command paths. The PR keeps those prepared owners synchronized with the committed generation without rebuilding artifacts for model-neutral edits.

flowchart LR
  A[Config edit] --> B[Gateway reload planner]
  B --> C{No-op and auth-neutral?}
  C -->|Yes| D[Restamp prepared owners]
  C -->|No| E[Rebuild prepared owners]
  D --> F[Model catalog and reply dispatch]
  E --> F
  F --> G[Channel model picker]
Loading

Before merge

  • Resolve merge risk (P1) - This deliberately relies on the shared reload planner to classify every model- and auth-affecting setting as non-no-op; an incorrect future classification could reuse a prepared generation when rebuilding is required.
  • Resolve merge risk (P1) - The bug fix adds net production code across config commit, prepared-runtime, reply-dispatch, and startup publication boundaries; the focused coverage justifies the footprint, but it raises lifecycle-maintenance cost.
  • Resolve merge risk (P1) - The branch is behind current main and its required checks are queued, so it needs a rebase/merge refresh and green checks on the resulting exact head before landing.
  • Complete next step (P2) - No concrete repair remains; this PR needs the normal refreshed-head CI and maintainer landing path.
Agent review details

Security

None.

PR surface

Source +130, Tests +451. Total +581 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 8 187 57 +130
Tests 4 455 4 +451
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 642 61 +581

Review metrics

Metric Value Why it matters
Production versus test delta production net +130; tests net +451 The positive production footprint spans four lifecycle boundaries and is accompanied by focused regression coverage for config, auth, startup, and publication races.

Merge-risk options

Maintainer options:

  1. Land after exact-head refresh (recommended)
    Rebase or refresh the clean three-way merge and land only after required checks pass on the exact resulting head.
  2. Pause if reload classification is disputed
    Pause this PR if maintainers do not accept the existing reload planner as the authority for model- and auth-neutral classification.

Technical review

Best possible solution:

Keep the reload planner as the sole classification authority, restamp only the resolved committed config for auth-neutral no-op publications, and land the refreshed exact head once required checks are green.

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

Yes—source establishes the stale whole-config identity path, and the supplied real Telegram baseline reproduces the resulting silent callback failure; this review did not rerun it locally.

Is this the best way to solve the issue?

Yes—the fix acts at the Gateway publication owner, preserves existing immutable readers, and uses the established reload-plan classification rather than adding a parallel model-config policy.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: A no-restart configuration edit can leave the user-visible model picker unavailable until Gateway restart.
  • merge-risk: 🚨 compatibility: The PR changes live configuration publication and the conditions under which existing prepared runtime state is reused.
  • merge-risk: 🚨 auth-provider: Provider-secret changes deliberately take the rebuild path and now depend on using the resolved committed config identity.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Mantis’s real Telegram before/after flow shows the post-edit callback reach the model list; the inspected candidate GIF visibly shows the nine-model picker, unlike the baseline.
  • proof: sufficient: Contributor real behavior proof is sufficient. Mantis’s real Telegram before/after flow shows the post-edit callback reach the model list; the inspected candidate GIF visibly shows the nine-model picker, unlike the baseline.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Mantis’s real Telegram before/after flow shows the post-edit callback reach the model list; the inspected candidate GIF visibly shows the nine-model picker, unlike the baseline.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The repaired model-picker callback is visible Telegram chat behavior and the supplied Mantis evidence directly demonstrates it.

Evidence

What I checked:

  • Current-main gap: Current main wires the no-op secret commit directly and has no runtime-commit hook or prepared-owner restamp; the PR adds that owner-boundary publication work. (src/gateway/server-reload-managed.ts:473, fd6576afcf82)
  • Committed-config owner boundary: The branch records the resolved committed config at the runtime commit edge, advances only no-op/auth-neutral plans, and rebuilds with the committed config when auth must be rewarmed. (src/gateway/server-reload-managed.ts:363, 6311e8bb9b39)
  • Snapshot invariant: Restamping produces a new immutable snapshot, carries its private auth bindings, and leaves existing readers immutable; reply-dispatch projections receive the same committed config. (src/agents/prepared-model-runtime.owner.ts:216, 6311e8bb9b39)
  • Regression coverage: Focused tests cover no rebuild for an auth-neutral update, immutable prior readers, carried auth materialization, in-flight auth publication, resolved-config auth rewarm, and plugin-generation claim loss. (src/agents/prepared-model-runtime-config-stamp.test.ts:30, 6311e8bb9b39)
  • Real behavior proof: Inspected Mantis GIFs show the baseline repeatedly stopping at the provider picker after the edit, while the candidate reaches the nine-model list after the same Telegram callback flow. (6311e8bb9b39)
  • History and ownership: The current publication changes blame to the current-head repair; longer file history is dominated by Peter Steinberger’s prepared-runtime work, with Ayaan Zaidi authoring the final publication-options repair. (src/gateway/server-reload-managed.ts:504, 6311e8bb9b39)

Likely related people:

  • steipete: History for the prepared-runtime owner, Gateway reload manager, and startup publication paths is predominantly attributable to Peter Steinberger. (role: long-running prepared-runtime contributor; confidence: high; commits: f68f68bc43, 732f00f110, 1b2920a520; files: src/agents/prepared-model-runtime.owner.ts, src/gateway/server-reload-managed.ts, src/gateway/server-startup-post-attach.ts)
  • obviyus: Authored the current-head repair that preserves prepared runtime options during the auth-rewarm path. (role: recent area contributor; confidence: high; commits: 6311e8bb9b39; files: src/gateway/server-reload-managed.ts, src/gateway/server-reload-handlers.test.ts)

Rank-up moves

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

  • Rebase or refresh the merge result and let required checks complete on the exact head.

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-24T08:50:26.038Z sha a5fd35f33d820097ef017a976984b30471802d66 :: needs real behavior proof before merge. :: [P1] Do not treat all no-op config changes as model-neutral
  • reviewed 2026-08-24T12:20:16.377Z sha a5fd35f33d820097ef017a976984b30471802d66 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-24T16:47:30.923Z sha a517f2f73de56107a9d5e05f4aa78238089f8f02 :: needs changes before merge. :: [P1] Revalidate the plugin claim after config resolution
  • reviewed 2026-08-24T17:21:27.444Z sha 76dabde9790c089b4ea069a2bc7f32520ab00ffd :: needs changes before merge. :: [P1] Preserve the prepared GitHub publication capability
  • reviewed 2026-08-24T17:47:53.009Z sha 76dabde9790c089b4ea069a2bc7f32520ab00ffd :: needs changes before merge. :: [P1] Use the committed runtime config for auth rewarm | [P1] Preserve the prepared GitHub publication capability
  • reviewed 2026-08-24T23:22:22.329Z sha b0de521 :: needs changes before merge. :: [P1] Cover the resolved runtime-config rewarm
  • reviewed 2026-08-24T23:48:25.486Z sha 5763b4b :: needs maintainer review before merge. :: none
  • reviewed 2026-08-25T00:55:42.195Z sha 5763b4b :: needs maintainer review before merge. :: none

@Marvinthebored
Marvinthebored force-pushed the fix/prepared-model-config-stamp-128515 branch from e62f2b0 to a5fd35f Compare August 24, 2026 08:42
@Marvinthebored

Copy link
Copy Markdown
Contributor Author

Updated the PR description; two notes on the review.

The two P1 Telegram findings are a stale-base artifact. This branch touches no Telegram files. It was based on 1f3c8b4f, and fix(telegram): accept threadName for topic actions (#99505) landed on main afterwards, so a diff against newer main reads the absence of that commit as a revert. Rebased onto current main and force-pushed — head is now a5fd35f33d, and git diff main...HEAD --name-only returns only the 10 gateway/agents files. Focused tests re-run green on the new base.

On real behavior proof. Agreed, and the description now carries the live before capture: two PreparedModelCatalogConfigReplacedError failures from the reporting host's Discord command surface after the no-op edit, with no recovery between them. What is still missing is the matching after capture, and I would rather say so than pad the section. My isolated Gateway did not reproduce the failure on stock, so it was useless as a control — it has neither the Discord native command surface nor the plugin set of the reporting host, and the text /models path resolves the catalog differently from the native interaction that failed.

If there is a reproduction that does not require a configured Discord application, point me at it and I will run it against this branch and post the capture.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed mantis: telegram-visible-proof Mantis should capture Telegram visible proof. labels Aug 24, 2026
@openclaw-mantis

openclaw-mantis Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Mantis Telegram proof — PASS

Summary: On current main, an unrelated no-op config publication left the Telegram /models provider callback permanently silent while the Gateway remained ready. At the pull request revision, the same callback continued to edit the Telegram message into the nine-model OpenAI catalog after the same config publication, and a subsequent Telegram turn also completed through the mock provider.

  • Scenario: Started each exact revision with agents.defaults.modelPolicy.allow set to ["openai/*"] so /models used the full prepared catalog owner. Through a real Telegram conversation, requested /models, atomically added talk.realtime.instructions to the live OpenClaw config without restarting, requested /models again, and pressed the openai (1) callback. The normal config CLI could not rewrite the harness-mounted config because fchmod returned EPERM, so the same JSON edit was applied by atomic file replacement inside each SUT; the live watcher observed and published it. On the candidate, also verified the picker before the edit and sent a normal post-edit Telegram turn backed by the deterministic mock provider.
  • Trigger: workflow_dispatch
  • Run: https://github.com/openclaw/openclaw/actions/runs/32720554772
  • Artifact: https://github.com/openclaw/openclaw/actions/runs/32720554772/artifacts/9518914558
  • Baseline: pass at 8fe2c1b83ca2a30d62892d3bf188588190155fd0 — After the edit, /models produced message 50517 with Select a provider: and an openai (1) button. Pressing it produced no Telegram edit during the observation window. The Gateway remained ready with HTTP 200, while its log recorded six callback retries failing with prepared model catalog owner was not published for the requested config.
  • Candidate (PR merged onto main): pass at f5cf1b91da2e07dbda9395725bfd3313fa9410b6 — Before the edit, the provider callback edited message 50519 into Models (openai ...) — 9 available. After the same live edit, pressing openai (1) edited message 50521 into the same nine-model catalog. No prepared-owner callback failures were recorded, /ready remained HTTP 200, and a subsequent Telegram message received MOCK-TURN-OK with one provider request recorded.
  • Differential (trusted facts): The same real Telegram /models callback and no-restart config-publication boundary fails silently on baseline but produces the expected nine-model edit on the candidate. The candidate additionally proves the post-edit Gateway can still execute and deliver a normal provider-backed Telegram turn. This directly demonstrates that the pull request fixes the reproduced user-visible failure.
  • Overall: pass
Before — current main After — this PR
baseline previewGifCropped candidate previewGifCropped

Motion-trimmed clips:

Raw QA files: https://artifacts.openclaw.ai/mantis/telegram-visible/pr-128608/run-32720554772-1/index.json

@Marvinthebored

Copy link
Copy Markdown
Contributor Author

Real behavior proof added to the description — this is the evidence the review asked for.

Reproduced on a second, independent host running stock current main (nothing from this branch), full ten-provider catalog, live Discord channel. Restart, one ordinary turn to publish a prepared owner, config set talk.realtime.instructions printing "No gateway restart needed.", then /models as a slash command:

2026-08-24T11:55:54.913Z ERROR [discord/monitor]
discord interaction handler failed: PreparedModelCatalogConfigReplacedError:
prepared model catalog owner config was replaced during the read

Two findings that took most of the effort and are worth recording:

The failure is specific to the interaction path. Four other surfaces against the same stock build do not reproduce it — a minimal two-provider Gateway, the chat.send RPC, a cold browse cache, and an ordinary Discord message reading /models (which answered in 2.4 s). My earlier note that an isolated Gateway failed to reproduce is now explained rather than merely reported.

Restart is the only recovery and it is total. On the originally reporting host a restart at 16:01:23 ended both symptoms at once: the background-lane retry logged 1248 occurrences from 11:19:43 to 16:01:07 and zero afterwards; /models had failed at 11:08:26 and 11:15:40 and has not failed since.

Still outstanding: a matching post-fix capture on the same surface. The branch is built and deployed on that host now; I will post it. Also restating, because the 1248-row symptom is easy to misread as in scope — that is a different guard and is not claimed fixed here.

@clawsweeper clawsweeper Bot added mantis: telegram-visible-proof Mantis should capture Telegram visible proof. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. 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. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 24, 2026
@obviyus
obviyus force-pushed the fix/prepared-model-config-stamp-128515 branch 2 times, most recently from 1da29d9 to dd8661c Compare August 24, 2026 16:25
@clawsweeper clawsweeper Bot added proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Aug 24, 2026
Peetiegonzalez and others added 2 commits August 25, 2026 06:34
…ecovers

A config transaction whose reload plan is empty publishes the new runtime
config but never advances the prepared model owner's config stamp. Owners
are stamped with a hash of the whole config, so a key with no bearing on
models leaves every strict-policy catalog read rejected for the life of the
gateway process.

Advance the model-neutral config stamp in place on no-op publications
instead of rebuilding the prepared generation, which the planner has
already determined is unnecessary. Existing leases keep their immutable
snapshot, auth bindings carry onto the restamped snapshot, pending builds
restamp at commit, and read-only owners are untouched. Deferred startup
publication now resolves its config inside the serialized refresh so a
no-op commit landing mid-startup cannot publish an already-stale stamp.

Related: openclaw#128515

Co-Authored-By: Claude Opus 5 <[email protected]>
The no-op commit path resolves secrets and commits prepared.config, but the
rebuild that follows used the source-derived candidate. Where resolution
returns a different object -- secrets.providers.* edits, which are exactly
the changes that must rebuild rather than restamp -- the rebuilt owner
carries an identity no reader supplies, so every strict catalog read rejects
it and the failure this change removes reappears on its own fallback path.

Reuse the config the runtime-commit hook already receives, cleared per
transaction so a rebuild cannot inherit one committed by an earlier one.

Co-Authored-By: Claude Opus 5 <[email protected]>
@Marvinthebored
Marvinthebored force-pushed the fix/prepared-model-config-stamp-128515 branch from 76dabde to b0de521 Compare August 24, 2026 23:15
@Marvinthebored

Copy link
Copy Markdown
Contributor Author

Both findings addressed. Head is now b0de5217a8.

[P1] Preserve the prepared GitHub publication capability — this one is a stale-base artifact, not a real regression. This branch does not touch extensions/codex/src/app-server/dynamic-tool-build.ts at any point. fix(codex): preserve GitHub tool capability (#128807) landed on main after the reviewed base d2d58a58c6, so diffing the branch against newer main reads the absence of #128807 as this branch removing the passthrough. Rebased onto current main; git diff main...HEAD --name-only returns 12 files and that file is not among them. (Second time this has happened here — the earlier Telegram threadName findings were the same shape.)

[P1] Use the committed runtime config for auth rewarm — real, and fixed. onNoopConfigCommit resolves secrets and commits prepared.config, but the rebuild that followed used the source-derived nextConfig. Where resolution returns a different object — secrets.providers.* edits, which are precisely the changes routed to rebuild rather than restamp — the rebuilt owner carries an identity no reader supplies, so strict catalog reads reject it and the failure reappears on the very fallback meant to be safe. It now reuses the config the existing runtime-commit hook already receives, cleared per transaction so a rebuild cannot inherit one committed by an earlier transaction.

On the requested resolved-secret regression — I could not write an honest one, and I would rather say so than ship a green test. I wrote one, it passed, and it also passed against the unfixed source, so it proved nothing and I deleted it. The reason is the one the review already identified: the harness's secrets preparation returns the input config unchanged, and both prepareRuntimeCandidate and tryPrepareRuntimeSecrets are constructed inside server-reload-managed.ts and passed into the secrets module, so a test cannot make resolution diverge without introducing a new injectable seam. I did not want to add test-only API surface to a security-adjacent path unilaterally. If you would like that seam, say so and I will add it with the regression; the alternative is that this fix rides on the code path above rather than on a test.

node scripts/check-changed.mjs exits 0 on the new head, and 220 tests in server-reload-handlers.test.ts pass.

@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. labels Aug 24, 2026
The ownership scenario returned the config secrets activation received, so a
rebuild against the source candidate looked correct. Let activation resolve
to a distinct object and assert by identity which config the rebuild used --
deep equality matches either object and proves nothing.

Fails without the committed-config selection, passes with it.

Co-Authored-By: Claude Opus 5 <[email protected]>
@Marvinthebored

Copy link
Copy Markdown
Contributor Author

The resolved-config regression now exists. Head 5763b4bedc.

You were right that a narrow mechanical regression was reachable, and right about where: the ownership scenario returned the config secrets activation received. tryPrepareRuntimeSecrets builds its snapshot from the injected activateRuntimeSecrets, so the harness can resolve to a distinct object without touching production code. I had wrongly concluded this needed a new injectable seam — it did not, and I withdraw that.

The test lets activation resolve to a distinct object and asserts by identity which config the rebuild used. That detail matters: my first attempt used toHaveBeenCalledWith, which compares by deep equality, and the resolved config is a clone of the source candidate — so it matched either object and passed against the unfixed source. It proved nothing and I deleted it rather than post it. The current assertion reads the call argument and uses toBe.

Verified both directions on this head:

with the committed-config selection:     221 passed
with it reverted to nextConfig:          × rebuilds a no-op secret-provider publication from the resolved committed config
                                         AssertionError: expected { …(4) } to be { …(4) } // Object.is equality
                                         1 failed | 220 passed

The failure message is the point — deeply equal, different identity, which is exactly the mismatch that reaches strict catalog reads and revives the rejection.

node scripts/check-changed.mjs exits 0.

That should close the last actionable finding; the two merge-risk items were both conditioned on this regression existing.

@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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 24, 2026
@Marvinthebored

Copy link
Copy Markdown
Contributor Author

Thanks for 6311e8bb9b — that is a real gap and a good catch.

The no-op rebuild was passing only gatewayLifecycle, while every other publication path passes catalogMode: "static", allowGatewaySubagentBinding: true and the plugin metadata snapshot, so a rebuilt owner could differ from what readers expect. It predates this branch — the original line had the same omission and my change only swapped the config argument — but I was editing that exact call while reasoning about its correctness, and had already read the startup call site with the full option set. I looked straight at it and missed it.

Verified your head independently rather than assuming: getPluginMetadataSnapshot is declared in server-reload-contracts.ts:151 and wired from server-core-runtime.ts:678, and server-reload-handlers.test.ts + prepared-model-runtime-config-stamp.test.ts are 231/231 green at 6311e8bb9b, with the resolved-config identity regression still passing.

Happy for you to keep pushing directly to the branch. If you would rather I take anything from here, say the word.

@obviyus

obviyus commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Exact-head landing evidence for 6311e8bb9b3961823f05fda055010ff039b9a758:

  • Root cause: accepted model-neutral config commits advanced runtime config identity while prepared model and reply-dispatch owners retained the prior stamp, so strict /models callback reads rejected an otherwise valid generation.
  • Canonical fix: restamp immutable prepared projections for safe no-op plans; auth-relevant no-op plans rebuild from the committed resolved config while preserving Gateway catalogMode: "static", allowGatewaySubagentBinding: true, and the current plugin metadata snapshot.
  • Removed regression: auth rewarm no longer falls back to generic live/unbound publication defaults.
  • Production delta added by the final review fix: src/gateway/server-reload-managed.ts +4/-0; focused tests +18/-2.

Exact repaired-head proof:

  • node scripts/run-vitest.mjs src/gateway/server-reload-handlers.test.ts src/agents/prepared-model-runtime-config-stamp.test.ts → 226 passed.
  • node scripts/check-changed.mjs -- src/gateway/server-reload-managed.ts src/gateway/server-reload-handlers.test.ts → passed.
  • Local exact-head ClawSweeper (gpt-5.6-terra, high): patch correct, 0 findings, security cleared, no maintainer decision, 0 Rank-up moves.
  • Real Telegram userbot differential remains valid: current-main baseline accepted the provider callback but left the picker unchanged after an unrelated no-restart edit; the candidate opened the model list and completed the callback with the Gateway healthy.
  • Review threads: 0 unresolved.

Hosted exact-head CI is running and remains the final merge gate. Current main independently trips check-temp-path-guardrails.ts in src/gateway/server-maintenance.ts; this PR does not touch that file, and it has been recorded separately rather than folded into this repair.

@obviyus
obviyus merged commit 70e6aa1 into openclaw:main Aug 25, 2026
250 checks passed
@obviyus

obviyus commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 25, 2026
…ecovers (openclaw#128608)

* fix: /models stops working after an unrelated config edit and never recovers

A config transaction whose reload plan is empty publishes the new runtime
config but never advances the prepared model owner's config stamp. Owners
are stamped with a hash of the whole config, so a key with no bearing on
models leaves every strict-policy catalog read rejected for the life of the
gateway process.

Advance the model-neutral config stamp in place on no-op publications
instead of rebuilding the prepared generation, which the planner has
already determined is unnecessary. Existing leases keep their immutable
snapshot, auth bindings carry onto the restamped snapshot, pending builds
restamp at commit, and read-only owners are untouched. Deferred startup
publication now resolves its config inside the serialized refresh so a
no-op commit landing mid-startup cannot publish an already-stale stamp.

Related: openclaw#128515

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(gateway): rebuild prepared owners from the committed runtime config

The no-op commit path resolves secrets and commits prepared.config, but the
rebuild that follows used the source-derived candidate. Where resolution
returns a different object -- secrets.providers.* edits, which are exactly
the changes that must rebuild rather than restamp -- the rebuilt owner
carries an identity no reader supplies, so every strict catalog read rejects
it and the failure this change removes reappears on its own fallback path.

Reuse the config the runtime-commit hook already receives, cleared per
transaction so a rebuild cannot inherit one committed by an earlier one.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(gateway): cover the resolved-config auth rewarm

The ownership scenario returned the config secrets activation received, so a
rebuild against the source candidate looked correct. Let activation resolve
to a distinct object and assert by identity which config the rebuild used --
deep equality matches either object and proves nothing.

Fails without the committed-config selection, passes with it.

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(gateway): preserve prepared runtime options on auth rewarm

---------

Co-authored-by: Marvinthebored <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: Ayaan Zaidi <[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 gateway Gateway runtime mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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