Repository navigation
refactor: speed up cold Google policy checks - #140922
Conversation
Share the existing Gemini classifiers through a lightweight AI entry so policy checks avoid streaming imports. Preserve historical SDK names and thinking/replay behavior; retain the existing policy cases with an import-boundary regression guard.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 3:21 AM ET / 07:21 UTC. ClawSweeper reviewWhat this changesShares lightweight Gemini model classifiers so Google policy checks avoid loading streaming machinery, while preserving existing exports and supporting source-only loading. Merge readiness✅ Ready for maintainer review The optimization remains useful: fetched main and the latest release still take the broad streaming import path. The source-loader repair addresses the reported follow-up failure, and no actionable patch defect remains. Likely related people: steipete, supported by prior provider-helper and loader work. Priority: P2 Review scores
Verification
How this fits togetherGoogle provider policy turns model identifiers and configuration into normalized settings and thinking options. The same model classifiers also guide outgoing thinking payloads and replay formatting. flowchart TD
A[Model identifiers and configuration] --> B[Google policy entry]
B --> C[Lightweight model classifiers]
C --> D[Normalized settings and thinking options]
E[Thinking payload preparation] --> C
F[Conversation replay formatting] --> C
G[Source loader or packaged entry] --> C
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +3, Tests +14, Docs 0, Config +8, Other +1. Total +26 across 15 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one lightweight classifier implementation with consistent source and packaged resolution, preserving existing policy, replay, and export behavior. Do we have a high-confidence way to reproduce the issue? Not applicable as a functional bug reproduction: this is a performance refactor, with the broad import chain confirmed in source and matched timing observations supplied in the body. Is this the best way to solve the issue? Yes. Consolidating equivalent classifiers behind an existing narrow helper removes unnecessary loading without changing model policy or adding configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2d58961f33fd. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Register the new AI internal entry in the native source alias table. Extend the existing host-parent resolution boundary test and verify PDF and provider context behavior without generated root or AI build outputs.
|
@clawsweeper re-review Added the missing native source-loader alias after CI exposed it. With generated root and AI outputs absent, all 24 PDF/context/native-resolver cases pass; removing the alias reproduces the missing module and incorrect context fallback. The full rebuild, focused typecheck/lint, and final independent review pass. Existing UI transition assertions remain unchanged; waiting for the new head's CI. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* refactor: speed up cold Google policy checks Share the existing Gemini classifiers through a lightweight AI entry so policy checks avoid streaming imports. Preserve historical SDK names and thinking/replay behavior; retain the existing policy cases with an import-boundary regression guard. * fix: resolve Google classifiers in source-only plugin loads Register the new AI internal entry in the native source alias table. Extend the existing host-parent resolution boundary test and verify PDF and provider context behavior without generated root or AI build outputs.
What Problem This Solves
Resolves a problem where cold Google model-policy checks load unrelated streaming machinery. In a matched source-layout PDF run, the policy lookup alone took 12.65 seconds.
Why This Change Was Made
Move the existing boundary-aware Gemini 3 classifiers into one lightweight AI internal entry shared by policy, thinking-payload normalization, and OpenAI-compatible replay. Delete the equivalent transport helper definitions. Google policy uses the existing narrow thinking SDK entry; historical streaming-SDK exports retain their names and behavior.
The package export, TypeScript path, dedicated AI build entry, and native source-loader alias are wired together. The native alias retains the existing host-parent boundary. No dependency, configuration option, model-policy change, or public SDK subpath is added. Runtime TypeScript grows by three lines; package/build wiring adds nine. The native Google adapter's separate unanchored predicates retain their semantics.
User Impact
Cold policy checks avoid unnecessary streaming imports. Provider selection, thinking mappings, replay signatures, and PDF runtime-generation ownership remain unchanged. Source development and packaged runtimes both resolve the classifier entry. Shard configuration and existing test coverage are preserved.
Evidence
pnpm buildpassed after the source-alias repair, including declarations, SDK exports, and native built control-plane checks. Cold built-policy import passed in 22ms, loading ten files with no streaming/transport/host regions. Built historical SDK exports and isolated Google entrypoint loading also passed.The first CI head exposed the omitted native source alias, which a local full build had hidden by supplying the compiled file. The source-only controls above specifically reproduce and repair that gap. That run also reported one invalid UI transition frame; the UI assertion is preserved and its cause remains unproven. Exact-head CI must pass before landing. Temporary timing instrumentation is not included. No authenticated provider API call was used as proof; no provider API behavior changed.