Skip to content

fix: reduce repeated model-validation work before chat requests - #148428

Merged
steipete merged 1 commit into
mainfrom
codex/model-suppression-batch
Sep 14, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/model-suppression-batch

Conversation

@steipete

@steipete steipete commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes repeated plugin-policy processing during model validation before chat completion requests.

User Impact

Model checks avoid repeatedly traversing the same plugin configuration. Provider suppression, explicit disables, allowlists, denylists, and configuration changes keep their existing behavior; no operator action is required.

Why This Change Was Made

Each suppression compilation checks all manifest plugins, but previously normalized the entire plugin configuration separately for each plugin. Prepare that configuration once and pass it through the existing eligibility owner, matching the sibling manifest-contract path. The exact-configuration resolver cache and its invalidation semantics remain unchanged.

Evidence

  • Regression proof: the original implementation traversed the eight-plugin fixture eight times while producing correct eligibility results; the change traverses it once. The test also covers cached reuse and a new configuration without changing the old resolver.
  • 104 focused owner and caller tests passed; the final 44-test owner run retained the existing metadata-read guard and passed.
  • Independent P2 review found no actionable issues. The complete changed-source gate passed, including production types, all 18 core test-type graphs, lint, and guards.
  • Matched ABBA operation proof used 64 synthetic bundled plugins and 200 fresh route-projected configurations per cell. Policy traversals fell from 64 to 1; mean main-thread CPU per resolver operation fell from 1.319 ms to 0.089 ms (93.2%), and wall time from 1.337 ms to 0.101 ms. All input/output hashes matched and inputs remained unchanged. This measures suppression compilation, not whole-Gateway latency.
  • The CI prerequisite was repaired in test(ci): deduplicate database worker registry #148425 after fix(ui): restore Custodian wizard session recovery coverage #148444; the refreshed head passed preflight. Its CI run had one plugin-inspection test fail with an invalid-config response. The failure occurs before diagnostics, outside the changed normalization path. An unchanged full-file baseline run with pass-through snapshot capture passed all 32 tests and saw valid config in both inspect calls; the hosted failure remains unexplained. The single rerun passed without a source change, and the exact-head CI run, including the required CI gate, is now green. The original failure and successful 32-case baseline proof are retained; no fix or root cause is claimed for that intermittent result.

@steipete steipete self-assigned this Sep 14, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Sep 14, 2026
@steipete
steipete marked this pull request as ready for review September 14, 2026 17:48
@clawsweeper

clawsweeper Bot commented Sep 14, 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.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Sep 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 4:07 PM ET / 20:07 UTC (Revision 5).

ClawSweeper review

What this changes

The PR prepares plugin policy once while compiling model-suppression rules and extends regression coverage for restrictions and configuration-specific reuse.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a useful, bounded optimization that current main still lacks. The reviewed patch preserves existing policy and cache behavior, and I found no actionable correctness defects.

Priority: P2
Reviewed head: 3794d998d13009ef54e70f275706f9114e5bad6b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization uses an established contract and meaningful regression coverage, with no supported merge-blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies maintainer-authored work, so the external-contributor proof gate does not apply. The body reports after-change suppression-compilation measurements with synthetic plugins and matching outputs; these support the bounded performance claim without proving whole-Gateway latency.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies maintainer-authored work, so the external-contributor proof gate does not apply. The body reports after-change suppression-compilation measurements with synthetic plugins and matching outputs; these support the bounded performance claim without proving whole-Gateway latency.
Evidence reviewed 8 items Verified introduced change: The pinned base-to-head production diff only imports the existing normalizer, prepares policy before iteration, and passes it to the existing eligibility owner.
Existing eligibility contract: The owner already accepts normalized policy from the same configuration. Its fallback performs the identical normalization; its global-disable compatibility handling creates a copy rather than mutating the prepared input. The sibling manifest-contract batch already uses this pattern.
Regression coverage and unchanged cache ownership: The changed test verifies one policy traversal across eight bundled plugins, explicit disablement, allowlists, denylists, cached resolver reuse, and independent behavior for a new configuration. The production resolver still uses the existing snapshot/configuration cache and unchanged route matching. Tests were inspected, not executed during this read-only review.
Findings None None.
Security None None.

How this fits together

OpenClaw checks plugin manifest rules when filtering model catalogs and validating selected models. This change reduces policy preparation work before those rules produce an available model or a suppression error.

flowchart TD
  A[Plugin configuration] --> C[Prepare policy once]
  B[Plugin metadata snapshot] --> D[Check plugin eligibility]
  C --> D
  D --> E[Compile suppression rules]
  F[Selected model and endpoint] --> G[Resolve suppression]
  E --> G
  G --> H[Available model or error]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +3, Tests +34. Total +37 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 0 +3
Tests 1 50 16 +34
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 53 16 +37

Review metrics

Metric Value Why it matters
Reported compilation work 64 policy traversals → 1 The supplied synthetic operation comparison measures the targeted repeated work without claiming an end-to-end chat speedup.

Technical review

Best possible solution:

Reuse the existing prepared-policy contract while retaining the current eligibility owner, resolver lifetime, and endpoint-specific suppression rules.

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

Yes, from source: each eligible plugin check on current main re-normalizes the same plugin configuration during compilation. The changed fixture counts this work; this review did not execute it.

Is this the best way to solve the issue?

Yes. Passing the existing normalized-policy input removes repeated work without adding another cache, policy owner, public API, or migration.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded model-validation performance improvement with unchanged user-facing policy.
  • 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: The supplied repository state identifies maintainer-authored work, so the external-contributor proof gate does not apply. The body reports after-change suppression-compilation measurements with synthetic plugins and matching outputs; these support the bounded performance claim without proving whole-Gateway latency.

Evidence

What I checked:

  • Verified introduced change: The pinned base-to-head production diff only imports the existing normalizer, prepares policy before iteration, and passes it to the existing eligibility owner. (src/plugins/manifest-model-suppression.ts:29, 3794d998d130)
  • Existing eligibility contract: The owner already accepts normalized policy from the same configuration. Its fallback performs the identical normalization; its global-disable compatibility handling creates a copy rather than mutating the prepared input. The sibling manifest-contract batch already uses this pattern. (src/plugins/manifest-contract-eligibility.ts:41, 3794d998d130)
  • Regression coverage and unchanged cache ownership: The changed test verifies one policy traversal across eight bundled plugins, explicit disablement, allowlists, denylists, cached resolver reuse, and independent behavior for a new configuration. The production resolver still uses the existing snapshot/configuration cache and unchanged route matching. Tests were inspected, not executed during this read-only review. (src/plugins/manifest-model-suppression.test.ts:94, 3794d998d130)
  • Current main still needs the optimization: Fetched main still checks every manifest plugin without passing prepared policy. The merged lookup optimization at improve(plugins): speed up repeated model catalog lookups #139681 indexes suppression rules and prepares condition sets; it does not remove this per-plugin normalization. (src/plugins/manifest-model-suppression.ts:30, e0f7f7080858)
  • Latest supplied release comparison: The v2026.9.4 source likewise calls eligibility inside the plugin filter without prepared policy, so this optimization is not already present in the supplied latest release. (src/plugins/manifest-model-suppression.ts:30, 3a9d69db306c)
  • Feature-history routing: Current-main history and GitHub commit metadata connect steipete to the earlier suppression indexing and cache work. The raw recorded parent of the indexing commit was checked, and its parent source lacks the indexed insertion now at review line 169. Broader unrestricted blame encountered an unavailable historical blob; routing does not rely on treating a blame boundary as introduction proof. (src/plugins/manifest-model-suppression.ts:169, efddd75d39ac)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

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 (4 earlier review cycles)
  • reviewed 2026-09-14T18:07:42.085Z sha bc037025bf3bee959b7cb6ff21f8e43b4388fcf3 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-14T18:15:59.194Z sha bc037025bf3bee959b7cb6ff21f8e43b4388fcf3 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-14T19:12:30.080Z sha 3794d99 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-14T19:39:10.304Z sha 3794d99 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/model-suppression-batch branch from bc03702 to 3794d99 Compare September 14, 2026 19:06
@steipete
steipete merged commit 5d461f0 into main Sep 14, 2026
335 of 337 checks passed
@steipete
steipete deleted the codex/model-suppression-batch branch September 14, 2026 20:42
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 14, 2026
* origin/main:
  perf(secrets): keep pure helpers out of file writer imports (#148096)
  perf(models): normalize suppression policy once per compilation (#148428)
  test: route provider integration and wizard recovery tests correctly (#148504)
  test: reuse prepared bundled plugins in startup corpus (#148465)
  fix(agents): attribute tool preparation delays to the correct stages (#148349)
  refactor: remove redundant Parallels source checks (#148394)
  fix(test): avoid timeout failures before descendant readiness (#148410)
  fix: open browser side panel without creating a dashboard (#148471)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR 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.

1 participant