Skip to content

test(agent): pin the consent hold's reason precedence, and mark the one arrange production cannot produce - #18977

Merged
DrJKL merged 3 commits into
fix/agent-consent-defer-first-run-screenfrom
gc-33/agentpanel-test-arrange-audit
Sep 28, 2026
Merged

DrJKL merged 3 commits into
fix/agent-consent-defer-first-run-screenfrom
gc-33/agentpanel-test-arrange-audit

Conversation

@christian-byrne

@christian-byrne christian-byrne commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Audits every agentPanel.test.ts arrangement that directly writes gettingStartedVisible, firstRunHoldsScreen, or activeTour, after two regressions hid behind impossible test state. Adds one reachable reason-precedence regression. Test-only; no production change.

Changes

  • Classified 24 arrangements against production writers and orderings: 23 reachable; one impossible arrangement removed after review.
  • Pins first_run_screen over dialog_open when both hold the automatic consent offer. Reversing screenHolder() precedence makes this test fail with dialog_open; restored production code passes.
  • Keeps no test for the impossible mid-offer first-run transition. showFirstRunScreen runs before startupDecided, and every automatic offer waits for that decision, so the first-run hold cannot rise while an offer is in flight.
Audited arrangement inventory and counting rule

Count one row per setup or transition sequence that directly writes one or more audited refs; a row may write multiple refs. Dialog-only rows are included where they compose with an audited ref or establish a comparison reason.

  1. beforeEach idle baseline - reachable
  2. Getting Started screen up - reachable
  3. coachmark tour active - reachable
  4. screen and tour active - reachable
  5. desktop sign-in dialog open - reachable
  6. screen closes - reachable
  7. screen closes into first-run tour - reachable
  8. holding tour ends - reachable
  9. startup decision remains pending after tour ends - reachable
  10. tour ends while an offer remains in flight - reachable
  11. tour starts while an offer is in flight - reachable
  12. tour ends while consent cannot be read - reachable
  13. first-run reason deduplication - reachable
  14. tour reason deduplication - reachable
  15. dialog reason deduplication - reachable
  16. undecided-boot reason deduplication - reachable
  17. in-flight tour plus workspace switch - reachable
  18. second workspace repeats a tour reason - reachable
  19. held offer emits no reason after consent resolves - reachable
  20. tour ends while Getting Started remains up - reachable
  21. tour ends while a dialog remains open - reachable
  22. dialog opens while an offer is in flight - reachable
  23. first-run hold rises while an offer is in flight - impossible; removed
  24. manual consent dialog per identity scope - reachable

Verification

  • pnpm test:unit src/extensions/core/agentPanel.test.ts --testTimeout=30000 - 74 passed.
  • Precedence mutation screenBusyReason() ?? (firstRunHoldsScreen ? 'first_run_screen' : null) - focused regression fails with received reason dialog_open.
  • ESLint, oxfmt, and git diff --check pass for the changed file.
  • CI was green on the rebased parent; fresh CI is running for the review repair.

Dependency

Stacked on #18966 because firstRunHoldsScreen is introduced there. Required order remains #18966 -> #18977 -> #18989 -> #18975 -> #18978 -> #18992.

…ne arrange production cannot produce

An audit of every arrange in `agentPanel.test.ts` that writes
`gettingStartedVisible`, `firstRunHoldsScreen` or `activeTour` directly, after
two defects in a row hid behind a test that arranged state no production
ordering reaches.

One arrange is unreachable: `withholds a card whose Getting Started screen took
over while the offer was in flight`. `gettingStartedVisible` is set true only by
`showFirstRunScreen`, which runs once per page load from `handleStartupOutcome`
and always before it sets `startupDecided`; `tourHandoffs` only rises from a
template click on the rendered screen. Every automatic offer waits on
`whenStartupDecided()`, so the first-run hold can only fall while an offer is in
flight, never rise. The test stays — it is the only cover on `canShow` reading
`screenHolder()` rather than `screenBusyReason()` — renamed so it no longer
claims an ordering production produces, with the invariant it leans on written
down next to it.

One real gap: nothing pinned which reason wins when the first run and another
surface hold together. Swapping the precedence in `screenHolder` left all 70
tests green. The screen is built for a dialog over it (`FocusScope` traps focus
only while `!dialogOpen`), and the reported reason decides whose
`agent_consent_not_offered` denominator the user lands in, so it is behaviour:
first run wins while it holds the screen. Red on the swap, green restored.

No production change.
@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: Comfy-Org/ComfyUI_frontend/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: 86386a66-d07d-4a90-8115-0bf35410b2d6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 09/28/2026, 08:36:35 AM UTC

Links

🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measure

Executes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight ecosystem-matrix shard checks are a harness self-test; the pack verdict is matrix-verdict.

This candidate changes nothing the matrix measures, so every expensive stage was 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

🌾 Fallow: ✅ Passed

Fallow 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.

No new findings in the changed files.

Reproduce locally
# the base the gate compared against
npx fallow audit --root . --quiet --format json \
  --changed-since 0389dae130926fb313f04090d24402e693fcf7ed

Full docs: ADR-DEVEX-LINT-0015

📦 Bundle Size

⏳ Size data collection in progress…

@github-actions github-actions Bot added the risk:high PR risk grade (advisory shadow check; grader-owned) label Sep 26, 2026
@codecov

codecov Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@                             Coverage Diff                              @@
##           fix/agent-consent-defer-first-run-screen   #18977      +/-   ##
============================================================================
- Coverage                                     85.05%   85.02%   -0.04%     
============================================================================
  Files                                          2316     2317       +1     
  Lines                                        133714   133744      +30     
  Branches                                      34247    34266      +19     
============================================================================
- Hits                                         113731   113710      -21     
- Misses                                        19665    19716      +51     
  Partials                                        318      318              
Flag Coverage Δ
unit 81.39% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@christian-byrne

Copy link
Copy Markdown
Contributor Author

What this PR needs before it lands: a rebase, no content change

Verified as part of reconciling the four open PRs on this file (order and evidence:
#18966#issuecomment-5845318276). This branch is correctly stacked on 0e72565c8b, and the repo is
squash-merge only with delete_branch_on_merge — so once #18966 lands this is retargeted to main with a
stale merge-base and needs a rebase onto main. Nothing else.

Suggested position: second, after #18966. It is test-only, so zero production risk, and it puts the
reason-precedence pin and the renamed unreachable-arrange guard into the file before the two PRs that add
to it. The 2↔3 swap is free — #18975-then-#18977 was also verified clean, 72 green either way.

Two results from this file's audit that were re-checked in the full composition with #18975 and #18976,
because that is the tree that becomes main and none of the four PRs shows it:

  • canShow's heldAtMount = screenHolder() → screenBusyReason() still fails exactly one test,
    withholds a card the first run comes to own mid-offer — so the sole-cover claim survives fix(agent): keep a held consent offer when the retry cannot be made #18975's
    release-watcher rewrite.
  • the precedence swap still fails exactly one test, reports the first-run screen over a dialog sitting on top of it — the pin added here.

Also confirmed: §8.1's call on #18976 was the load-bearing one. Left to the rebase, the natural resolution
(rename the ref) puts that unreachable arrange back with the suite fully green — 73 passed. It has been
fixed on #18976's branch instead (12f63a8edc).

@christian-byrne

Copy link
Copy Markdown
Contributor Author

Heads-up for whoever merges this: #18989 is stacked on this branch and slots in right after it in the published order (#18966 → #18977 → #18989 → #18975 → #18976).

It is test-only and touches this same file. It pins the trap the comment at agentPanel.ts:210-216 names, which gc-33's probe M4 found this suite detects but cannot report: make release disagree with hold about what "the screen" is and the worker OOMs after 44.7 s with 4 of 71 tests reported, instead of going red. With #18989 the same mutation gives 6 failed | 68 passed in 15.3 s — including this file's existing expect(consentStore.load).toHaveBeenCalledTimes(2), which was already the right assertion and simply never got to run.

Composition probed rather than assumed: merged with #18975 → clean, 75 passed; merged with #18976 → clean auto-merge with 2 failures that are identical without #18989 (the known consent_read_outcome residual on reports the first-run screen over a dialog sitting on top of it).

@christian-byrne

Copy link
Copy Markdown
Contributor Author

Order refreshed — your position is unchanged, but the set grew from five PRs to eleven.

Follow-up to my note above (#18977#issuecomment-5845323428) and the #18989 extension
(#18977#issuecomment-5845508717). Both said "second of four/five"; both are still correct as far as they go,
and neither says that six more open PRs interact with this stack.

Current order: #18966 → #18977 → #18989 → #18975 → #18978 → #18992 → #18976 → #18973 → #18986 → #18985 → #18991.

Nothing moves for this PR: still second, still test-only, still needs only a rebase onto main once #18966
lands. What is new for whoever merges it:

Full evidence, the per-file interaction matrix, and a measured silent-resolution hazard on
TelemetryRegistry.test.ts: #18966#issuecomment-5846101342

@DrJKL DrJKL added agent Comfy Agent product, integration, tests or product documentation agent-onboarding Agent consent, first-use tour or onboarding gates agent-test-only Agent tests, fixtures and test support only; no production changes agent-test-unit Touches Agent-related unit/component tests or their support agent-ui Agent panel, composer, transcript or other user-interface components labels Sep 27, 2026
@DrJKL
DrJKL self-requested a review September 28, 2026 00:53

@DrJKL DrJKL left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: one material test-design issue remains; the new precedence regression itself is sound.

I found three inline issues and one documentation issue without a line anchor. There are no P0 or P1 blockers.

Finding without an anchorable line
  • P3, PR description: The stated audit of 24 arrangements, classified as 23 reachable and one unreachable, has no inventory or counting rule. I could not reconstruct that population from the file because table rows, helpers, tests that arrange several refs, and later state transitions make "arrange" ambiguous. Please list the 24 test names or table rows and their classifications so reviewers can reproduce the audit.
Checked and cleared
  • The new precedence test is behavioral and production-reachable. Reversing screenHolder() precedence made only that test fail with dialog_open instead of first_run_screen.
  • The statement that a future rebase should need no content change appeared in a later issue comment rather than this PR's description or diff, so I did not treat it as a finding on the reviewed patch. The current stack dependency on #18966 is accurate.
Coverage

Standard-depth review ran the correctness, maintainability, idiomaticity, tests, and documentation lanes. The review covered behavior and blast radius, regression history, TypeScript discipline, test design and mocks, comment quality, and technical prose.

pnpm test:unit src/extensions/core/agentPanel.test.ts passed all 71 tests. ESLint and oxfmt passed for the changed file. Fallow analyzed the changed file and reported no new finding.

Focused and full-file mutations confirmed both claimed falsifiers. The precedence swap failed only the new test. Replacing the in-flight canShow read with screenBusyReason() failed the retained impossible-ordering test.

Comment thread src/extensions/core/agentPanel.test.ts Outdated
})

it('withholds a card whose Getting Started screen took over while the offer was in flight, then re-offers', async () => {
// Kept deliberately as a guard rather than as an expectation: no production

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Please remove this test and its new explanation. The comment correctly establishes that production cannot make the first-run hold rise after an automatic offer starts, but the test then manufactures exactly that transition through the mocked first-run entry. It only pins canShow to the current helper choice, and it cannot notice a future real trigger because that production path is mocked out. Our testing guidance says to exclude combinations production cannot produce. If a second trigger is added later, that change should add a reachable regression test through the real transition.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 2361f7a: removed the impossible-ordering test and its explanation. The reachable reason-precedence regression remains.

Comment thread src/extensions/core/agentPanel.test.ts Outdated
Comment on lines +691 to +697
// The two overlap in production: `GettingStartedScreen.vue` traps focus
// only while `!dialogOpen`, drops `aria-modal` when one is up and skips
// taking focus on mount for the same reason, so the screen is built for a
// dialog over it - and the automatic offer can run in exactly that state.
// Which reason is reported decides whose denominator this user lands in,
// so the precedence is behaviour and not an implementation detail: the
// first run wins for as long as it holds the screen.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Nit: Please remove this comment. The test name, screenShown() plus openDialog() arrangement, and literal expected reason already state the precedence contract. The focus-trap, aria-modal, and mount-focus details are owned and tested by GettingStartedScreen; this test cannot detect drift in those copied claims, so the prose creates a second source to maintain.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 2361f7a: removed the copied focus and accessibility commentary. The arrangement and literal expected reason now state the contract.

Comment thread src/extensions/core/agentPanel.test.ts Outdated
// `showFirstRunScreen`, which runs once per page load from
// `handleStartupOutcome` (GraphCanvas's `onMounted`) and always *before* that
// function sets `startupDecided`; `tourHandoffs` only rises from a template
// click on the rendered screen. Every automatic offer waits on

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: This is not click-only. GettingStartedCard.vue routes click, Enter, and Space through the same selection path to dismissIntoFirstRunTour(). Please use input-neutral wording such as "selecting a template on the rendered screen."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed by removing the impossible-ordering test and its commentary in 2361f7a, so the inaccurate click-only wording is gone.

@DrJKL

DrJKL commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Merged base 0389dae130926fb313f04090d24402e693fcf7ed into this branch. The conflict in agentPanel.test.ts was resolved by preserving this PR’s new precedence test and renamed guard while adapting both to the base’s reactive agentFlagEnabled / nextTick feature-flag setup. pnpm test:unit src/extensions/core/agentPanel.test.ts passes all 75 tests; ESLint and oxfmt also pass for the file.

@github-actions github-actions Bot added risk:medium PR risk grade (advisory shadow check; grader-owned) and removed risk:high PR risk grade (advisory shadow check; grader-owned) labels Sep 28, 2026
@christian-byrne

Copy link
Copy Markdown
Contributor Author

Review repair is pushed at 2361f7a and re-review is requested from @DrJKL.

  • Removed the impossible mid-offer first-run arrangement (the material P2).
  • Removed the duplicated precedence-test commentary.
  • Replaced the PR description with the counting rule and all 24 audited arrangement rows; row 23 is explicitly marked impossible and removed.
  • Reproduced the remaining contract: agentPanel.test.ts passes 74/74 with a 30s timeout; swapping reason precedence makes the focused test fail with dialog_open instead of first_run_screen; ESLint, oxfmt, and diff-check pass.

Dependency order is unchanged: #18966 -> #18977 -> #18989 -> #18975 -> #18978 -> #18992.

@DrJKL DrJKL left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: ready to approve; all prior findings are fixed at 2361f7a.

Prior finding dispositions:

  • P2 fixed: The production-impossible mid-offer first-run test and its explanation were removed.
  • The copied focus, aria-modal, and mount-focus commentary is gone, fixing the first P3.
  • Removing the unreachable test commentary also fixed the P3 click-only wording.
  • The body-only P3 is fixed by the PR description's counting rule and complete 24-row inventory.

I found no new issues in the repair commit. pnpm test:unit src/extensions/core/agentPanel.test.ts --testTimeout=30000 passed all 74 tests. ESLint, oxfmt, and git diff --check also passed for the current diff.

@DrJKL
DrJKL merged commit f852ee5 into fix/agent-consent-defer-first-run-screen Sep 28, 2026
86 checks passed
@DrJKL
DrJKL deleted the gc-33/agentpanel-test-arrange-audit branch September 28, 2026 16:29
DrJKL pushed a commit that referenced this pull request Sep 28, 2026
…ling the vitest worker (#18989)

## Problem

The release watcher must agree with `screenHolder()` about whether the
consent offer is held. If release instead ignores the first-run holder,
the offer is released and re-held in a microtask loop; without a bound,
Vitest loses the worker rather than reporting an assertion.

## Change

- Wrap the mocked `whenStartupDecided` startup probe in a `vi.fn` with a
20-call circuit breaker. The mock owns and automatically resets its call
history.
- Use that bounded startup probe to let the existing exact
`consentStore.load` assertion report a release/hold disagreement across
the first-run screen, tours, their composition, and the sign-in dialog.
- Keep the source comment scoped to those holder cases. Production code
is unchanged.

## Verification

At `be2570918f`, stacked on #18977 `2361f7ad65`:

- `pnpm test:unit src/extensions/core/agentPanel.test.ts
--testTimeout=30000` — 74/74 passed.
- Mutating `screenIsClear` from `screenHolder() === null` to
`screenBusyReason() === null`, then running the same command, produces
an ordinary red result: 4 failed / 70 passed; the first failure reports
21 consent loads instead of 1. The mutation was reverted and the passing
command rerun.
- The current effective diff against #18977 changes only
`src/extensions/core/agentPanel.test.ts`; production code is
byte-identical to the base.

Full command/result note:
#18989 (comment)

## Merge order

This remains stacked directly after #18977. The updated #18977 head was
merged into this branch before verification; do not merge this PR before
#18977.

---------

Co-authored-by: Amp <amp@ampcode.com>
christian-byrne added a commit that referenced this pull request Sep 28, 2026
…ne arrange production cannot produce (#18977)

## Summary

Audits every `agentPanel.test.ts` arrangement that directly writes
`gettingStartedVisible`, `firstRunHoldsScreen`, or `activeTour`, after
two regressions hid behind impossible test state. Adds one reachable
reason-precedence regression. Test-only; no production change.

## Changes

- Classified 24 arrangements against production writers and orderings:
23 reachable; one impossible arrangement removed after review.
- Pins `first_run_screen` over `dialog_open` when both hold the
automatic consent offer. Reversing `screenHolder()` precedence makes
this test fail with `dialog_open`; restored production code passes.
- Keeps no test for the impossible mid-offer first-run transition.
`showFirstRunScreen` runs before `startupDecided`, and every automatic
offer waits for that decision, so the first-run hold cannot rise while
an offer is in flight.

<details>
<summary>Audited arrangement inventory and counting rule</summary>

Count one row per setup or transition sequence that directly writes one
or more audited refs; a row may write multiple refs. Dialog-only rows
are included where they compose with an audited ref or establish a
comparison reason.

1. beforeEach idle baseline - reachable
2. Getting Started screen up - reachable
3. coachmark tour active - reachable
4. screen and tour active - reachable
5. desktop sign-in dialog open - reachable
6. screen closes - reachable
7. screen closes into first-run tour - reachable
8. holding tour ends - reachable
9. startup decision remains pending after tour ends - reachable
10. tour ends while an offer remains in flight - reachable
11. tour starts while an offer is in flight - reachable
12. tour ends while consent cannot be read - reachable
13. first-run reason deduplication - reachable
14. tour reason deduplication - reachable
15. dialog reason deduplication - reachable
16. undecided-boot reason deduplication - reachable
17. in-flight tour plus workspace switch - reachable
18. second workspace repeats a tour reason - reachable
19. held offer emits no reason after consent resolves - reachable
20. tour ends while Getting Started remains up - reachable
21. tour ends while a dialog remains open - reachable
22. dialog opens while an offer is in flight - reachable
23. first-run hold rises while an offer is in flight - impossible;
removed
24. manual consent dialog per identity scope - reachable

</details>

## Verification

- `pnpm test:unit src/extensions/core/agentPanel.test.ts
--testTimeout=30000` - 74 passed.
- Precedence mutation `screenBusyReason() ?? (firstRunHoldsScreen ?
'first_run_screen' : null)` - focused regression fails with received
reason `dialog_open`.
- ESLint, oxfmt, and `git diff --check` pass for the changed file.
- CI was green on the rebased parent; fresh CI is running for the review
repair.

## Dependency

Stacked on #18966 because `firstRunHoldsScreen` is introduced there.
Required order remains #18966 -> #18977 -> #18989 -> #18975 -> #18978 ->
#18992.

---------

Co-authored-by: Amp <amp@ampcode.com>
christian-byrne added a commit that referenced this pull request Sep 28, 2026
…ling the vitest worker (#18989)

## Problem

The release watcher must agree with `screenHolder()` about whether the
consent offer is held. If release instead ignores the first-run holder,
the offer is released and re-held in a microtask loop; without a bound,
Vitest loses the worker rather than reporting an assertion.

## Change

- Wrap the mocked `whenStartupDecided` startup probe in a `vi.fn` with a
20-call circuit breaker. The mock owns and automatically resets its call
history.
- Use that bounded startup probe to let the existing exact
`consentStore.load` assertion report a release/hold disagreement across
the first-run screen, tours, their composition, and the sign-in dialog.
- Keep the source comment scoped to those holder cases. Production code
is unchanged.

## Verification

At `be2570918f`, stacked on #18977 `2361f7ad65`:

- `pnpm test:unit src/extensions/core/agentPanel.test.ts
--testTimeout=30000` — 74/74 passed.
- Mutating `screenIsClear` from `screenHolder() === null` to
`screenBusyReason() === null`, then running the same command, produces
an ordinary red result: 4 failed / 70 passed; the first failure reports
21 consent loads instead of 1. The mutation was reverted and the passing
command rerun.
- The current effective diff against #18977 changes only
`src/extensions/core/agentPanel.test.ts`; production code is
byte-identical to the base.

Full command/result note:
#18989 (comment)

## Merge order

This remains stacked directly after #18977. The updated #18977 head was
merged into this branch before verification; do not merge this PR before
#18977.

---------

Co-authored-by: Amp <amp@ampcode.com>
christian-byrne added a commit to christian-byrne/ComfyUI_frontend that referenced this pull request Sep 29, 2026
… of dropping it (Comfy-Org#18966)

## Summary

Defers the automatic Agent consent offer while Getting Started owns the
screen, then re-offers it in the same session after that ownership ends.
The template path keeps first-run ownership across the dismissal-to-tour
preview gap, so the consent card cannot open underneath the tour.

The first-session entry-button/feature-flag timing question is separate
and is not changed here.

## Changes

- Arms the consent retry for `first_run_screen` instead of dropping that
offer.
- Uses live first-run screen ownership, including pending screen-to-tour
handoffs, when deciding whether consent can be shown.
- Cancels and releases an in-flight handoff when the authenticated
identity changes, preventing the previous account tour or hold from
crossing sessions.
- Removes the obsolete `firstRunTookScreen` latch.
- Keeps failed template loads on Getting Started and removes duplicate
no-tour coverage.

## Review focus

- `dismissIntoFirstRunTour` snapshots the owner, passes an
identity-change cancellation predicate to `beginTour`, and invalidates
pending holds at the auth boundary.
- Per-call symbols keep concurrent handoff ownership distinct, while
`authGeneration` separately invalidates stale continuations across
authenticated-session changes.
- Bare dismissal releases consent; template selection retains ownership
until the tour has either started, declined, or failed.

## Verification

At current head `e93ee8410e`, rebased directly on `main` at `4ff3690047`
(eleven-file base-to-head diff):

- `pnpm test:unit src/extensions/core/agentPanel.test.ts
src/renderer/extensions/firstRunTour/gettingStarted/GettingStartedScreen.test.ts
src/renderer/extensions/firstRunTour/gettingStarted/firstRunEntry.test.ts
src/renderer/extensions/firstRunTour/tour/useFirstRunTourController.test.ts
--testTimeout=30000` — 4 files, 226 tests passed.
- `bash scripts/test-browser-offline.sh --project=cloud
browser_tests/tests/agent/agentConsent.spec.ts -g 'defers the offer
until Getting Started releases the screen' --workers=1 --repeat-each=5`
— 5/5 passed in 43.2 seconds from a freshly restarted cloud-distribution
Vite process; the scenario-only 90-second budget covers both application
boots.
- ESLint, Oxlint, oxfmt, `git diff --check`, pre-push Knip, and
changed-line Fallow passed. Fallow excluded 17 inherited dependency
findings and reported two inherited styling advisories.

The branch retains the test-only changes from Comfy-Org#18977 and Comfy-Org#18989. Those
PRs were merged into this PR's branch (their GitHub base was
`fix/agent-consent-defer-first-run-screen`), not into `main`; dropping
them during reconciliation would lose their approved coverage. The
rebase preserves the eleven-file product/browser patch while removing
the stale `main` ancestry.

---------

Co-authored-by: Amp <amp@ampcode.com>
christian-byrne added a commit that referenced this pull request Sep 29, 2026
… of dropping it (#18966)

Defers the automatic Agent consent offer while Getting Started owns the
screen, then re-offers it in the same session after that ownership ends.
The template path keeps first-run ownership across the dismissal-to-tour
preview gap, so the consent card cannot open underneath the tour.

The first-session entry-button/feature-flag timing question is separate
and is not changed here.

- Arms the consent retry for `first_run_screen` instead of dropping that
offer.
- Uses live first-run screen ownership, including pending screen-to-tour
handoffs, when deciding whether consent can be shown.
- Cancels and releases an in-flight handoff when the authenticated
identity changes, preventing the previous account tour or hold from
crossing sessions.
- Removes the obsolete `firstRunTookScreen` latch.
- Keeps failed template loads on Getting Started and removes duplicate
no-tour coverage.

- `dismissIntoFirstRunTour` snapshots the owner, passes an
identity-change cancellation predicate to `beginTour`, and invalidates
pending holds at the auth boundary.
- Per-call symbols keep concurrent handoff ownership distinct, while
`authGeneration` separately invalidates stale continuations across
authenticated-session changes.
- Bare dismissal releases consent; template selection retains ownership
until the tour has either started, declined, or failed.

At current head `e93ee8410e`, rebased directly on `main` at `4ff3690047`
(eleven-file base-to-head diff):

- `pnpm test:unit src/extensions/core/agentPanel.test.ts
src/renderer/extensions/firstRunTour/gettingStarted/GettingStartedScreen.test.ts
src/renderer/extensions/firstRunTour/gettingStarted/firstRunEntry.test.ts
src/renderer/extensions/firstRunTour/tour/useFirstRunTourController.test.ts
--testTimeout=30000` — 4 files, 226 tests passed.
- `bash scripts/test-browser-offline.sh --project=cloud
browser_tests/tests/agent/agentConsent.spec.ts -g 'defers the offer
until Getting Started releases the screen' --workers=1 --repeat-each=5`
— 5/5 passed in 43.2 seconds from a freshly restarted cloud-distribution
Vite process; the scenario-only 90-second budget covers both application
boots.
- ESLint, Oxlint, oxfmt, `git diff --check`, pre-push Knip, and
changed-line Fallow passed. Fallow excluded 17 inherited dependency
findings and reported two inherited styling advisories.

The branch retains the test-only changes from #18977 and #18989. Those
PRs were merged into this PR's branch (their GitHub base was
`fix/agent-consent-defer-first-run-screen`), not into `main`; dropping
them during reconciliation would lose their approved coverage. The
rebase preserves the eleven-file product/browser patch while removing
the stale `main` ancestry.

---------

Co-authored-by: Amp <amp@ampcode.com>
christian-byrne added a commit that referenced this pull request Sep 29, 2026
… of dropping it (#18966)

Defers the automatic Agent consent offer while Getting Started owns the
screen, then re-offers it in the same session after that ownership ends.
The template path keeps first-run ownership across the dismissal-to-tour
preview gap, so the consent card cannot open underneath the tour.

The first-session entry-button/feature-flag timing question is separate
and is not changed here.

- Arms the consent retry for `first_run_screen` instead of dropping that
offer.
- Uses live first-run screen ownership, including pending screen-to-tour
handoffs, when deciding whether consent can be shown.
- Cancels and releases an in-flight handoff when the authenticated
identity changes, preventing the previous account tour or hold from
crossing sessions.
- Removes the obsolete `firstRunTookScreen` latch.
- Keeps failed template loads on Getting Started and removes duplicate
no-tour coverage.

- `dismissIntoFirstRunTour` snapshots the owner, passes an
identity-change cancellation predicate to `beginTour`, and invalidates
pending holds at the auth boundary.
- Per-call symbols keep concurrent handoff ownership distinct, while
`authGeneration` separately invalidates stale continuations across
authenticated-session changes.
- Bare dismissal releases consent; template selection retains ownership
until the tour has either started, declined, or failed.

At current head `e93ee8410e`, rebased directly on `main` at `4ff3690047`
(eleven-file base-to-head diff):

- `pnpm test:unit src/extensions/core/agentPanel.test.ts
src/renderer/extensions/firstRunTour/gettingStarted/GettingStartedScreen.test.ts
src/renderer/extensions/firstRunTour/gettingStarted/firstRunEntry.test.ts
src/renderer/extensions/firstRunTour/tour/useFirstRunTourController.test.ts
--testTimeout=30000` — 4 files, 226 tests passed.
- `bash scripts/test-browser-offline.sh --project=cloud
browser_tests/tests/agent/agentConsent.spec.ts -g 'defers the offer
until Getting Started releases the screen' --workers=1 --repeat-each=5`
— 5/5 passed in 43.2 seconds from a freshly restarted cloud-distribution
Vite process; the scenario-only 90-second budget covers both application
boots.
- ESLint, Oxlint, oxfmt, `git diff --check`, pre-push Knip, and
changed-line Fallow passed. Fallow excluded 17 inherited dependency
findings and reported two inherited styling advisories.

The branch retains the test-only changes from #18977 and #18989. Those
PRs were merged into this PR's branch (their GitHub base was
`fix/agent-consent-defer-first-run-screen`), not into `main`; dropping
them during reconciliation would lose their approved coverage. The
rebase preserves the eleven-file product/browser patch while removing
the stale `main` ancestry.

---------

Co-authored-by: Amp <amp@ampcode.com>
christian-byrne added a commit that referenced this pull request Sep 29, 2026
… of dropping it (#18966)

Defers the automatic Agent consent offer while Getting Started owns the
screen, then re-offers it in the same session after that ownership ends.
The template path keeps first-run ownership across the dismissal-to-tour
preview gap, so the consent card cannot open underneath the tour.

The first-session entry-button/feature-flag timing question is separate
and is not changed here.

- Arms the consent retry for `first_run_screen` instead of dropping that
offer.
- Uses live first-run screen ownership, including pending screen-to-tour
handoffs, when deciding whether consent can be shown.
- Cancels and releases an in-flight handoff when the authenticated
identity changes, preventing the previous account tour or hold from
crossing sessions.
- Removes the obsolete `firstRunTookScreen` latch.
- Keeps failed template loads on Getting Started and removes duplicate
no-tour coverage.

- `dismissIntoFirstRunTour` snapshots the owner, passes an
identity-change cancellation predicate to `beginTour`, and invalidates
pending holds at the auth boundary.
- Per-call symbols keep concurrent handoff ownership distinct, while
`authGeneration` separately invalidates stale continuations across
authenticated-session changes.
- Bare dismissal releases consent; template selection retains ownership
until the tour has either started, declined, or failed.

At current head `e93ee8410e`, rebased directly on `main` at `4ff3690047`
(eleven-file base-to-head diff):

- `pnpm test:unit src/extensions/core/agentPanel.test.ts
src/renderer/extensions/firstRunTour/gettingStarted/GettingStartedScreen.test.ts
src/renderer/extensions/firstRunTour/gettingStarted/firstRunEntry.test.ts
src/renderer/extensions/firstRunTour/tour/useFirstRunTourController.test.ts
--testTimeout=30000` — 4 files, 226 tests passed.
- `bash scripts/test-browser-offline.sh --project=cloud
browser_tests/tests/agent/agentConsent.spec.ts -g 'defers the offer
until Getting Started releases the screen' --workers=1 --repeat-each=5`
— 5/5 passed in 43.2 seconds from a freshly restarted cloud-distribution
Vite process; the scenario-only 90-second budget covers both application
boots.
- ESLint, Oxlint, oxfmt, `git diff --check`, pre-push Knip, and
changed-line Fallow passed. Fallow excluded 17 inherited dependency
findings and reported two inherited styling advisories.

The branch retains the test-only changes from #18977 and #18989. Those
PRs were merged into this PR's branch (their GitHub base was
`fix/agent-consent-defer-first-run-screen`), not into `main`; dropping
them during reconciliation would lose their approved coverage. The
rebase preserves the eleven-file product/browser patch while removing
the stale `main` ancestry.

---------

Co-authored-by: Amp <amp@ampcode.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Comfy Agent product, integration, tests or product documentation agent-onboarding Agent consent, first-use tour or onboarding gates agent-test-only Agent tests, fixtures and test support only; no production changes agent-test-unit Touches Agent-related unit/component tests or their support agent-ui Agent panel, composer, transcript or other user-interface components risk:medium PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants