Skip to content

fix: QuickEntry agent outside-click + quarantine CLI full-suite cascade#2291

Merged
gsxdsm merged 1 commit into
mainfrom
fix/main-tests-v9
Jul 18, 2026
Merged

fix: QuickEntry agent outside-click + quarantine CLI full-suite cascade#2291
gsxdsm merged 1 commit into
mainfrom
fix/main-tests-v9

Conversation

@gsxdsm

@gsxdsm gsxdsm commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Latest Full Suite after #2290 was green on shards 1–2 and nearly green on 3–4:

  • Shard 3: QuickEntry agent picker outside click left the portal open (product) — capture-phase mousedown + open-token so late fetchAgents cannot re-open a dismissed picker
  • Shard 4: @runfusion/fusion package-lane cascade (87 failures from extension-dist-barrel hookTimeout + lock-retry timeouts under load) — quarantine the 14 observed files on sight (ledger + vitest exclude), no timeout appeasement

Also hardens the agent-picker outside-click test.

Test plan

  • Local agent picker portal tests green
  • PR gate
  • Post-merge Full Suite green

Summary by CodeRabbit

  • Bug Fixes

    • Fixed the Quick Add agent picker so it reliably closes when clicking outside.
    • Prevented delayed agent-loading results from reopening the picker after it has been dismissed.
    • Improved the picker’s loading behavior by displaying it immediately while agents are being retrieved.
  • Tests

    • Added coverage for dismissing the agent picker with an outside click.

Capture-phase outside mousedown and an open-token stop the agent portal from
staying open or reopening after dismiss. Quarantine the full-suite shard-4 CLI
package-lane cascade (extension-dist-barrel hookTimeout + lock-retry timeouts)
on sight per the deletion ratchet.
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR fixes Quick Add agent-picker dismissal by using capture-phase outside-click handling and tokens that reject stale agent-loading results. It also adds a changeset and expands CLI test quarantine records and exclusions for shard-4 failures.

Changes

Quick Entry agent-picker dismissal

Layer / File(s) Summary
Agent-picker async guard and validation
packages/dashboard/app/components/QuickEntryBox.tsx, packages/dashboard/app/components/__tests__/QuickEntryBox.test.tsx, .changeset/quickentry-agent-outside-click.md
The picker opens while agents load, invalidates stale requests on capture-phase outside clicks, and tests dismissal with a native mousedown event and asynchronous disappearance assertion. A patch changeset documents the fix.

CLI test quarantine

Layer / File(s) Summary
CLI quarantine ledger and exclusions
scripts/lib/test-quarantine.json, packages/cli/vitest.config.ts
Adds shard-cascade quarantine records dated 2026-07-18, updates policy punctuation, documents the shard-4 failure cascade, and excludes additional CLI integration tests.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant QuickEntryBox
  participant Document
  participant fetchAgents
  User->>QuickEntryBox: Open agent picker
  QuickEntryBox->>fetchAgents: Fetch agents
  QuickEntryBox->>Document: Register capture-phase mousedown listener
  User->>Document: Click outside picker
  Document->>QuickEntryBox: Close picker and invalidate token
  fetchAgents-->>QuickEntryBox: Return agents
  QuickEntryBox->>QuickEntryBox: Ignore stale result
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures both the QuickEntry outside-click fix and the CLI full-suite quarantine work.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/main-tests-v9

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@greptile-apps

greptile-apps Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR updates QuickEntry picker dismissal and quarantines unstable CLI suites. The main changes are:

  • Capture-phase outside-click handling for the agent picker.
  • Request-token handling for late agent responses.
  • Stronger portal dismissal test timing.
  • Fourteen CLI test exclusions with matching quarantine records.

Confidence Score: 4/5

Pending agent requests can reopen dismissed UI and cross a project transition with stale data.

  • Outside-click dismissal invalidates its pending request correctly.
  • Escape, trigger-toggle, and reset paths leave the same request valid.
  • Project changes can accept and cache the previous project's response.
  • The CLI quarantine paths and ledger entries are synchronized.

packages/dashboard/app/components/QuickEntryBox.tsx and its agent-picker tests

Security Review

A request started before a project switch can populate and display agents from the previous project in the new project context.

Important Files Changed

Filename Overview
packages/dashboard/app/components/QuickEntryBox.tsx Adds capture-phase dismissal and request tokens, but several close and project-transition paths do not invalidate pending requests.
packages/dashboard/app/components/tests/QuickEntryBox.test.tsx Improves outside-click timing but does not cover a response arriving after dismissal.
packages/cli/vitest.config.ts Adds fourteen CLI test exclusions mirrored by the quarantine ledger.
scripts/lib/test-quarantine.json Records the fourteen CLI quarantines with matching paths, reasons, and dates.
.changeset/quickentry-agent-outside-click.md Adds a labeled patch changeset for the picker fix.

Reviews (1): Last reviewed commit: "fix: close QuickEntry agent picker outsi..." | Re-trigger Greptile

updateAgentPickerPosition();
try {
const result = await fetchAgents(undefined, projectId);
if (openToken !== agentPickerOpenTokenRef.current) return;

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.

P1 Other Dismissals Keep Request Valid

When a fetch is pending, Escape, a second trigger click, or form reset closes the picker without changing agentPickerOpenTokenRef. The response therefore passes this check and reopens a picker the operator already dismissed.

Context Used: AGENTS.md (source)

Comment on lines 1669 to 1671
setAgents(result);
setAgentsProjectId(projectId);
setShowAgentPicker(true);

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.

P1 security Project Switch Accepts Stale Agents

If projectId changes while this request is pending, the project-change effect closes and clears the picker but does not invalidate the token. The old response can then populate agents under the new project ID and reopen the picker with data from the previous project.

Context Used: AGENTS.md (source)

Comment on lines +4964 to +4967
outsideElement.dispatchEvent(new MouseEvent("mousedown", { bubbles: true, cancelable: true }));
await waitFor(() => {
expect(screen.queryByText("Select agent")).toBeNull();
});

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 Late Fetch Race Remains Untested

This test dismisses the picker only after the mocked agent request has resolved, so removing the new token guard would not make it fail. Use a deferred request, dismiss the loading picker, then resolve the request and verify that the portal stays closed.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/dashboard/app/components/QuickEntryBox.tsx (1)

559-577: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Standardize capture-phase outside-click listeners across all pickers.

Using the capture phase (true) successfully prevents nested stopPropagation calls from hiding outside clicks for the Agent picker. Consider standardizing this approach for the other pickers in this file (Node, Priority, Workflow, Models, Deps) to prevent similar dismissal bugs if their internal contents ever stop event propagation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/dashboard/app/components/QuickEntryBox.tsx` around lines 559 - 577,
Update the outside-click listeners for the Node, Priority, Workflow, Models, and
Deps pickers to use capture-phase registration and matching cleanup, consistent
with handleClickOutside for the Agent picker. Preserve each picker’s existing
containment checks and dismissal behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/dashboard/app/components/QuickEntryBox.tsx`:
- Around line 194-195: Ensure every Agent picker dismissal invalidates pending
fetches, not only outside-click handling. Update the QuickEntryBox dismissal
flows—including Escape, the Agent toggle, and opening other pickers—to use a
shared closeAgentPicker helper or equivalent effect that increments
agentPickerOpenTokenRef alongside setShowAgentPicker(false), while preserving
the existing token guard.

---

Nitpick comments:
In `@packages/dashboard/app/components/QuickEntryBox.tsx`:
- Around line 559-577: Update the outside-click listeners for the Node,
Priority, Workflow, Models, and Deps pickers to use capture-phase registration
and matching cleanup, consistent with handleClickOutside for the Agent picker.
Preserve each picker’s existing containment checks and dismissal behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3d2b51cc-533c-4a26-afb7-42b82b544f93

📥 Commits

Reviewing files that changed from the base of the PR and between 2bd25b0 and 0ddbe35.

📒 Files selected for processing (5)
  • .changeset/quickentry-agent-outside-click.md
  • packages/cli/vitest.config.ts
  • packages/dashboard/app/components/QuickEntryBox.tsx
  • packages/dashboard/app/components/__tests__/QuickEntryBox.test.tsx
  • scripts/lib/test-quarantine.json

Comment on lines +194 to +195
/** Bumps on open/close so a late fetchAgents resolution cannot re-open a dismissed picker. */
const agentPickerOpenTokenRef = useRef(0);

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.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Invalidate the token on all dismissal paths.

The token is successfully incremented on outside clicks, but other dismissal vectors (such as pressing the Escape key, clicking the Agent toggle button to close, or opening other pickers) call setShowAgentPicker(false) without bumping the token. If an agent fetch is in flight when the user closes the picker via these actions, the late resolution will still bypass the token guard and erroneously re-open the picker.

Consider adding a useEffect that bumps the token when the picker closes, or extract a closeAgentPicker helper that groups the state update and token increment, and use it across all dismissal paths.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/dashboard/app/components/QuickEntryBox.tsx` around lines 194 - 195,
Ensure every Agent picker dismissal invalidates pending fetches, not only
outside-click handling. Update the QuickEntryBox dismissal flows—including
Escape, the Agent toggle, and opening other pickers—to use a shared
closeAgentPicker helper or equivalent effect that increments
agentPickerOpenTokenRef alongside setShowAgentPicker(false), while preserving
the existing token guard.

@gsxdsm
gsxdsm merged commit c0cce18 into main Jul 18, 2026
7 checks passed
@gsxdsm
gsxdsm deleted the fix/main-tests-v9 branch July 18, 2026 08:54
gsxdsm added a commit that referenced this pull request Jul 18, 2026
## Summary
Full Suite after #2291: shards 1–3 green; shard 4 failed CLI suites
with:

`Failed to resolve entry for package
"@fusion-plugin-examples/claude-runtime"`

from `dashboard/src/runtime-provider-probes.ts` under the CLI vitest
package lane.

- Add `plugins/fusion-plugin-claude-runtime/src/probes-entry.ts` (probe
+ model discovery only)
- Alias `@fusion-plugin-examples/claude-runtime` to that entry in CLI
vitest config (same class as Cursor/Grok/OMP source aliases, but avoids
ACP index load)

## Test plan
- [x] Local: vitest-workspace-resolution, task-steer,
extension-task-tools
- [ ] PR gate
- [ ] Post-merge Full Suite green

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved CLI resolution for Claude runtime diagnostics and provider
model discovery.
* Prevented unnecessary runtime dependencies from affecting CLI test
execution.
* **Refactor**
* Added a lightweight entry point for accessing Claude binary checks and
provider model discovery.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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