Skip to content

improve(plugins): speed up repeated model catalog lookups - #139681

Merged
steipete merged 1 commit into
mainfrom
codex/perf12-plugin-suppression
Sep 6, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/perf12-plugin-suppression

Conversation

@steipete

@steipete steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Catalog filtering and direct model lookup repeatedly scanned every planned suppression rule and rebuilt normalized API and host sets for conditional matches.

Why This Change Was Made

Prepare ordered per-model buckets and immutable condition sets once in the existing snapshot/config-owned resolver. Current config and selected endpoints remain live inputs, preserving same-model precedence, unconditional lookups, and endpoint-scoped retirement behavior.

User Impact

Repeated model catalog lookups do less work. The resolver retains additional prepared metadata in exchange for reduced scanning and allocation during lookups; no retained-heap reduction is claimed.

Evidence

  • All 56 suppression and manifest-planner tests pass, including a new ordering and route fixture verified against both the original and updated resolver.
  • Production and plugin-test typechecks and targeted lint pass. Independent review and isolated autoreview found no actionable issues.
  • A synthetic 130-rule probe reduced median misses from 516 to 142 ns/call and conditional hits from 692 to 443 ns/call. These are owner-level timings, not a Gateway heap or RSS measurement.

Full changed checks passed after incorporating the existing main branch shard rebalance. The rebased patch is byte-identical to the reviewed change.

@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Sep 6, 2026
@steipete
steipete marked this pull request as ready for review September 6, 2026 03:30
@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 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 11:36 PM ET / September 6, 2026, 03:36 UTC.

ClawSweeper review

What this changes

The PR indexes plugin rules that hide unavailable models and prepares their matching conditions once, reducing repeated lookup work while preserving rule order.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused optimization: current main still scans all suppression rules. No actionable correctness defect was found, and the maintainer-authored PR is protected from automatic closure.

Priority: P2
Reviewed head: 0bd7dafd8c169189a88612dd78f46380110403ec

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization with behavior-oriented coverage, explicit memory tradeoffs, and no actionable defect found.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied MEMBER association exempts this internal optimization from the external-contributor proof gate; no material authority change triggers an exception. Reported resolver timings and behavioral tests support the scoped claim without establishing Gateway-wide performance.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied MEMBER association exempts this internal optimization from the external-contributor proof gate; no material authority change triggers an exception. Reported resolver timings and behavioral tests support the scoped claim without establishing Gateway-wide performance.
Evidence reviewed 8 items Verified introduced change: The local merge-base-to-head diff matches the supplied complete introduction patch. Only suppression preparation and lookup, plus behavioral coverage, are introduced; unrelated endpoint drift is excluded.
Optimization remains absent from current main: Fetched main retains the full-array find and constructs normalized API and host sets during condition matching. Its existing resolver cache does not already provide the proposed per-model index.
Existing lifecycle contract: Documentation defines immutable startup metadata with restart or owner-controlled reload for manifest changes. The patch retains the existing snapshot/config-owned resolver lifetime and continues reading current provider configuration during matching.
Findings None None.
Security None None.

How this fits together

Plugin manifests describe which models should be hidden or rejected. The suppression resolver combines those rules with the selected endpoint and current provider configuration for catalog filtering and direct model lookup.

flowchart TD
  A[Plugin manifest snapshot] --> B[Ordered suppression planner]
  B --> C[Prepared per-model rule index]
  D[Model lookup request] --> C
  C --> E[Match current API and endpoint]
  F[Provider configuration] --> E
  E --> G[Suppression result or no match]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +22, Tests +74. Total +96 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 37 15 +22
Tests 1 74 0 +74
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 111 15 +96

Review metrics

None.

Technical review

Best possible solution:

Keep prepared rule indexes within the existing resolver lifetime while evaluating mutable route inputs at lookup time.

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

Not applicable to a functional bug: this optimizes existing behavior. Source confirms repeated scanning and set construction on main; reported timing improvements were not rerun in this read-only review.

Is this the best way to solve the issue?

Yes. Preparing invariant metadata inside the existing cache owner removes repeated work without creating a parallel public API or freezing current route configuration.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a bounded performance improvement to repeated model catalog lookups with no demonstrated urgent user-facing failure.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied MEMBER association exempts this internal optimization from the external-contributor proof gate; no material authority change triggers an exception. Reported resolver timings and behavioral tests support the scoped claim without establishing Gateway-wide performance.

Label justifications:

  • P2: This is a bounded performance improvement to repeated model catalog lookups with no demonstrated urgent user-facing failure.
  • 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 MEMBER association exempts this internal optimization from the external-contributor proof gate; no material authority change triggers an exception. Reported resolver timings and behavioral tests support the scoped claim without establishing Gateway-wide performance.

Evidence

What I checked:

  • Verified introduced change: The local merge-base-to-head diff matches the supplied complete introduction patch. Only suppression preparation and lookup, plus behavioral coverage, are introduced; unrelated endpoint drift is excluded. (src/plugins/manifest-model-suppression.ts:147, 0bd7dafd8c16)
  • Optimization remains absent from current main: Fetched main retains the full-array find and constructs normalized API and host sets during condition matching. Its existing resolver cache does not already provide the proposed per-model index. (src/plugins/manifest-model-suppression.ts:154, 4ff90358328d)
  • Existing lifecycle contract: Documentation defines immutable startup metadata with restart or owner-controlled reload for manifest changes. The patch retains the existing snapshot/config-owned resolver lifetime and continues reading current provider configuration during matching. Public docs: docs/plugins/architecture.md. (docs/plugins/architecture.md:139, 0bd7dafd8c16)
  • Ordering and route compatibility: The planner limits rules to owned providers or aliases and sorts their precedence. The new test exercises competing same-model rules, normalized hosts/API values, unconditional lookup, invalid endpoints, endpoint-scoped retirement, and configuration mutation without asserting the index implementation. (src/plugins/manifest-model-suppression.test.ts:143, 0bd7dafd8c16)
  • Public suppression contract remains intact: Manifest documentation requires concrete selected endpoints for route-scoped retirement and leaves persistent repair to doctor. The patch preserves these decisions and introduces no plugin API, configuration, storage, or authority change. This generic manifest implementation does not depend on the Codex harness contract. Public docs: docs/plugins/manifest.md. (docs/plugins/manifest.md:1236, 0bd7dafd8c16)
  • Supplied validation and benchmark scope: The captured PR body reports 56 passing suppression/planner tests, typechecks, lint, and a synthetic 130-rule probe: median misses 516 to 142 ns/call and conditional hits 692 to 443 ns/call. These are contributor-reported owner-level timings, not independently reproduced Gateway or heap measurements. The body explicitly acknowledges additional retained metadata. (0bd7dafd8c16)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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.

@steipete
steipete merged commit efddd75 into main Sep 6, 2026
246 checks passed
@steipete
steipete deleted the codex/perf12-plugin-suppression branch September 6, 2026 04:03
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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