Skip to content

fix(cursor): read the grok 4.7 effort flag through the open-sse helper - #18564

Open
HouMinXi wants to merge 2 commits into
cheaper-inference:release/v3.8.53from
HouMinXi:fix/grok47-flag-client-bridge
Open

HouMinXi wants to merge 2 commits into
cheaper-inference:release/v3.8.53from
HouMinXi:fix/grok47-flag-client-bridge

Conversation

@HouMinXi

@HouMinXi HouMinXi commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What breaks

grok47MaxEffort.ts imported the server feature-flag module directly. The chain
that reaches a client component:

src/lib/db/core.ts            (import fs from "fs", better-sqlite3 adapters)
src/lib/db/featureFlags.ts
src/shared/utils/featureFlags.ts
open-sse/utils/cursorAgentProtobuf/grok47MaxEffort.ts
src/lib/providerModels/cursorAutoCatalog.ts
src/lib/providers/mergeProviderModelListing.ts
src/app/(dashboard)/dashboard/providers/[id]/ProviderDetailPageClient.tsx

#17388 added grok47MaxEffort.ts and wired it into cursorAutoCatalog.ts,
which did not import it before. That puts the SQLite adapters and fs into the
browser bundle, and the production build rejects the bundle on node builtins.

The change

grok47MaxEffort.ts now calls isRegisteredFeatureFlagEnabled from
open-sse/utils/registeredFeatureFlag.ts. That helper already exists for this
purpose and is what codebuddy-cn.ts and providerSafety.ts use. It reads the
resolver featureFlags.ts publishes on a process-wide symbol, so it reaches the
same answer without importing from src/.

This removes an open-sse -> src import rather than adding one.

Behaviour

The server answer is unchanged while the resolver is registered, which it is on
every DB-backed path: src/lib/db/core.ts imports featureFlags.ts, and that
module registers the resolver when it loads. instrumentation-node.ts awaits
db/core during boot, so registration happens before any request.

One side effect worth naming: reading the flag no longer forces the database
layer to load. Nothing in the tree relied on that.

With no resolver registered the helper is env-only. This flag defaults to
false, and both call sites (requestedModelParameters.ts,
cursorAutoCatalog.ts) run inside DB-backed request paths, so that branch is
not reachable there today.

Verification

  • client-bundle-no-server-only-10692, the whole-graph guard, is red on the
    parent commit and names the trail above; it passes here.
  • Injection, both directions: restoring the server import turns that guard red
    again and fails both assertions in the new test. Restoring the helper returns
    everything to green.
  • The new test also covers what the graph guard exists for but a single-file
    read cannot see: the helper call left in place while the server import comes
    back alongside it.
  • grok47-flag-client-safe-import, cursor-grok-47-context-17386,
    cursor-grok-effort-aliases, feature-flag-resolver-bridge,
    grok47-max-effort-flag, registered-feature-flag: 17/17.

CI note

Unrelated to this diff, and present on the parent commit: Change Classification fails on free-catalog-evidence: tokenharbor/claude-haiku-5.5,
which makes the downstream unit job skip, and source-scanner-guards reports
two other files. Neither is touched here.

grok47MaxEffort imported the server feature-flag module directly. cursorAutoCatalog
imports it and ProviderDetailPageClient reaches cursorAutoCatalog, so the browser
bundle pulled in the SQLite adapters behind @/lib/db/core and the production build
rejected the bundle on node builtins.

Read the flag through open-sse's isRegisteredFeatureFlagEnabled helper instead. It
reads the same process-wide resolver that featureFlags.ts registers when it loads on
the server, so the answer is unchanged while that resolver is registered, and
open-sse no longer takes an import from src.

A test pins the file to that helper and checks that a resolver registered through the
bridge is the one the helper reads; nothing else in the suite ties those two symbols
together.

Signed-off-by: Minxi Hou <houminxi@gmail.com>
@HouMinXi
HouMinXi force-pushed the fix/grok47-flag-client-bridge branch from e8baba8 to 37c23d5 Compare October 30, 2026 04:47
@HouMinXi HouMinXi changed the title cursor: read the grok 4.7 effort flag through the client-safe bridge fix(cursor): read the grok 4.7 effort flag through the open-sse helper Oct 30, 2026
@HouMinXi

HouMinXi commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

After syncing f75a937, this PR contains only the bridge-to-open-sse regression test and its changelog entry. The production fix is already in release/v3.8.53 through #18625.

The new test checks both sides of the shared symbol lookup. In an isolated mutation check, changing the bridge's symbol prefix made it fail while the existing tests for each side still passed.

The shared Gemini midnight-clock and VS Code catalog-discovery test fixes are tracked separately in #18748. Their targeted cases have passed in its Ready CI run; this does not establish that this PR's full checks are green.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant