Repository navigation
[backport cloud/1.55] fix(agent): resolve the agent gate off /features - #19176
Conversation
|
Important Review skippedIgnore keyword(s) in the title. ⛔ Ignored keywords (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: Comfy-Org/ComfyUI_frontend/.coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
🌾 Fallow: ❌ FailedFallow audits the diff for duplication, complexity and dead code. It gates on new findings only, so when the audit completes, a red is something this PR introduced or moved — never inherited backlog. A red can also mean the audit itself did not finish; the details below say which happened. Fallow reports a failing verdict, but this renderer found no findings it Reproduce locally# the base the gate compared against
npx fallow audit --root . --quiet --format json \
--changed-since a1300e95f8922aea5e93e9ecf0a9d0603d06eaa4
Full docs: ADR-DEVEX-LINT-0015 🎭 Playwright: ✅ 2123 passed, 0 failed · 1 flaky📊 Browser Reports
🎨 Storybook: ✅ Built — View Storybook📦 Bundle Size
⚡ Performance
🔬 E2E Coverage
🧩 Custom Nodes Ecosystem Matrix: ✅ PassedExecutes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight
On a pin-bump PR, a red gate means the ecosystem moved — not that your diff broke something. That is what the bump PR is for. Outside a pin bump or a cold rebuild of the unpinned tail, a red means the diff. Note the corpus size and the executed count are different numbers, and the verdict is against the executed count: roughly 3,100 of ~5,100 packs ship no extension-shaped JS and are skipped. Reproduce locally# build one shard's fixture, then run it
python3 scripts/registry-census/build_matrix.py --shard 1/4
MATRIX_RENDERER=vue MATRIX_VUE=1 \
npx vitest run --config vitest.matrix.config.mts
Full docs: scripts/registry-census/README.md |
This comment has been minimized.
This comment has been minimized.
…og-js flag path (#19074) *PR Created by the Glary-Bot Agent* --- Fixes the root cause behind [PM-1707](https://linear.app/comfyorg/issue/PM-1707/test-agentcomfyorg-shows-the-agent-on-my-phone-but-not-on-desktop-in) / [PM-1706](https://linear.app/comfyorg/issue/PM-1706/fix-agent-does-not-appear-on-desktop-browsers-for-a-user-while-it) — an allowlisted user saw the agent on one browser but not another. Supersedes #18842, which only characterized the old behaviour. `agent-in-app-experience` was already published on `/features` (it's in `FrontendFlags` in the cloud repo, evaluated server-side per authenticated user) and the app already fetched that payload into `window.__CONFIG__` at bootstrap. The agent gate ignored it and re-asked PostHog over a second, independently-failing client path — the only flag in the codebase still doing so. Billing was migrated to this rail in Because posthog-js keys flags by its own `distinct_id` and caches them per-origin in `localStorage` while sharing identity cross-subdomain via cookie, two browsers on the same account could disagree. That's the divergence users saw. `agent-in-app-experience` is now a `ServerFeatureFlag` resolved through `useFeatureFlags` off `remoteConfig`, via a new `resolveWhitelistFlag()`: - `false` off the Cloud build, and `false` before the first authenticated answer (the anonymous bootstrap payload cannot answer a per-user allowlist) - after an authenticated answer, a *failed* refresh falls back to that answer, held **in memory for the session only** — never storage. A persisted grant is precisely what made two browsers disagree. - revocation propagates on the next successful poll; 401/403 and sign-out clear it `setupFlagGate` loses the dynamic imports, the `onFeatureFlags` subscription and the delivery plumbing, becoming two reactive watches. Deleted: `postHogFlagSource.ts`, `useAgentFeatureGate.ts` (dead code — nothing but its own test imported it, and it lacked the `errorsLoading` guard, so the two copies behaved differently), and their tests. `posthog-js` stays — telemetry still uses it. This removes only the flag path. Every guard is mutation-tested; each of these turns the suite red: | Mutation | | |---|---| | anonymous-window guard removed (fail-open before auth) | caught | | `isCloud` guard removed | caught | | fail-open before the first authenticated answer | caught | | grant fallback removed (a blip unmounts the panel) | caught | | grant survives sign-out / 401 | caught | | grant never recorded on a successful load | caught | | **grant persisted via `useStorage`** — the PM-1707 shape, under either the flag key *or* a renamed key | caught | | gate `enabled` unwired from the flag | caught | | gate settles on the anonymous config | caught | | signed-out settle fallback removed | caught | `pnpm typecheck`, `lint`, `knip`, `format:check` clean; 12,129 unit tests pass. The one broad-run failure (`agentSubgraphDefinitions`) reproduces identically on `main`. Two bugs were caught during review and fixed here rather than shipped: a transient `/features` failure would have unmounted the panel mid-session for a granted user (`DockedAgentPanel` is `v-if`, so composer draft and in-flight turn UI are destroyed), and the E2E fixtures were still feeding the flag through the deleted posthog channel, which would have regressed the whole agent E2E suite to a dead panel. - **E2E fixtures changed.** All three now put the key at the top level of the `/features` body. Specs can't be executed in my sandbox; the static chain is verified end to end (`cloudBootMocks` serves that body to both fetches, and `WorkspaceAuthGate` throws unless state is `authenticated`, so any spec that renders has reached the state the resolver needs). **One CI run of `--project=cloud` on a single agent spec would settle it conclusively.** - **Retired telemetry slug.** `agent_flag_gate_load_failure` no longer exists — the guarded dynamic import it reported on is gone. Any monitor keyed on it will go silently to zero. - **New Datadog facet.** The flag is added to `startFeatureFlagTelemetry`. It's the first dashed `ServerFeatureFlag`, and the sanitiser rewrites dashes — the RUM facet is `agent_in_app_experience`, not the hyphenated name. - **Deliberately dropped:** an in-session re-offer retry that existed only because `posthog.onFeatureFlags` re-delivered unchanged values. The real retry triggers (`offerHeld && screenIsClear`, identity change) are unaffected and still covered. - **Known residue:** the grant-retention window is unbounded, so a sustained `/features` outage leaves a revoked user with an inert panel until reload. Low impact — the backend enforces the flag independently at four choke points, so every call 404s regardless. --------- Co-authored-by: Glary-Bot <glary-bot@users.noreply.github.com>
58b7400 to
619238f
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## cloud/1.55 #19176 +/- ##
=============================================
Coverage ? 80.58%
=============================================
Files ? 2197
Lines ? 117463
Branches ? 35662
=============================================
Hits ? 94654
Misses ? 22463
Partials ? 346
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Backport of #19074 to
cloud/1.55.\n\nManual fallback after the automatic backport run remained queued; conflicts were resolved by carrying the reviewed agent-panel test and removing the superseded dependency-failure test alongside the production implementation.