Skip to content

Fix hidden providers still loading in agent-usage#25758

Closed
Yukaii wants to merge 3 commits intoraycast:mainfrom
Yukaii:bugfix/agent-usage-amp-not-found
Closed

Fix hidden providers still loading in agent-usage#25758
Yukaii wants to merge 3 commits intoraycast:mainfrom
Yukaii:bugfix/agent-usage-amp-not-found

Conversation

@Yukaii
Copy link
Contributor

@Yukaii Yukaii commented Feb 23, 2026

Description

This fixes agent-usage providers still running in the background even when they are disabled in preferences.

What was broken

  • show* preferences only controlled list visibility.
  • Provider hooks still fetched/spawned in the background.
  • This caused errors for hidden providers (e.g. Amp CLI not installed, Gemini not configured) and could keep the list loading indicator spinning.

What was fixed

  • Wired each provider hook to its corresponding preference flag from agent-usage.tsx:
    • useAmpUsage(showAmp)
    • useCodexUsage(showCodex)
    • useDroidUsage(showDroid)
    • useGeminiUsage(showGemini)
    • useKimiUsage(showKimi)
    • useAntigravityUsage(showAntigravity)
    • useZaiUsage(showZai)
  • Updated provider hooks to accept enabled and short-circuit when disabled:
    • skip initial fetch/spawn
    • make revalidate() a no-op when disabled
    • avoid not_configured errors while disabled
  • Fixed global list loading state to only consider enabled providers.
  • Fixed refresh action to revalidate only enabled providers.
  • Gated Gemini re-auth toast so it only appears when Gemini is enabled.

Screencast

N/A (bugfix only, no UI flow changes beyond loading/error behavior)

Checklist

@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: agent-usage Issues related to the agent-usage extension platform: macOS labels Feb 23, 2026
@raycastbot
Copy link
Collaborator

raycastbot commented Feb 23, 2026

Thank you for your contribution! 🎉

🔔 @natsustan you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

📋 Quick checkout commands
BRANCH="bugfix/agent-usage-amp-not-found"
FORK_URL="https://github.com/Yukaii/raycast-extensions.git"
EXTENSION_NAME="agent-usage"
REPO_NAME="raycast-extensions"

git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run dev

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 10-15 business days.

@Yukaii Yukaii marked this pull request as ready for review February 23, 2026 23:39
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 23, 2026

Greptile Summary

Fixed provider hooks to respect visibility preferences, preventing disabled agents from fetching data, spawning processes, or showing configuration errors. The implementation correctly wires each provider hook to its corresponding preference flag and short-circuits when disabled. Loading state and refresh logic now only consider enabled providers. Gemini re-auth toast is now gated behind the showGemini preference.

Key Changes:

  • All seven provider hooks (useAmpUsage, useCodexUsage, useDroidUsage, useGeminiUsage, useKimiUsage, useAntigravityUsage, useZaiUsage) now accept an enabled parameter
  • Each hook short-circuits initialization, skips fetching, and makes revalidate() a no-op when enabled=false
  • Main component passes preference flags to all hooks and filters loading/refresh logic accordingly
  • Gemini re-auth prompt only appears when Gemini is enabled (lines 287, 306 in agent-usage.tsx)

Issue Found:

  • CHANGELOG uses hardcoded date 2026-02-23 instead of required {PR_MERGE_DATE} placeholder

Confidence Score: 4/5

  • Safe to merge after fixing the CHANGELOG date format
  • The implementation correctly solves the stated problem with consistent patterns across all provider hooks. The only issue is the CHANGELOG date format which must use the placeholder for proper automated release handling.
  • Pay attention to extensions/agent-usage/CHANGELOG.md - must use {PR_MERGE_DATE} placeholder

Important Files Changed

Filename Overview
extensions/agent-usage/CHANGELOG.md Added changelog entry with hardcoded date instead of {PR_MERGE_DATE} placeholder
extensions/agent-usage/src/agent-usage.tsx Updated to pass enabled flags to provider hooks and fixed loading/refresh logic to respect preferences
extensions/agent-usage/src/amp/fetcher.ts Added enabled parameter to skip path detection and execution when disabled
extensions/agent-usage/src/codex/fetcher.ts Added enabled parameter to skip fetch and make revalidate a no-op when disabled
extensions/agent-usage/src/gemini/fetcher.ts Added enabled parameter to skip fetch and make revalidate a no-op when disabled
extensions/agent-usage/src/kimi/fetcher.ts Added enabled parameter to skip token loading and fetch when disabled
extensions/agent-usage/src/droid/fetcher.ts Added enabled parameter to skip token loading and fetch when disabled
extensions/agent-usage/src/antigravity/fetcher.ts Added enabled parameter to skip fetch and make revalidate a no-op when disabled
extensions/agent-usage/src/zai/fetcher.ts Added enabled parameter to skip token loading and fetch when disabled

Last reviewed commit: 860d8e0

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

9 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@@ -1,5 +1,11 @@
# Agent Usage Changelog

## [Bug Fixes] - 2026-02-23
Copy link
Contributor

Choose a reason for hiding this comment

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

Use {PR_MERGE_DATE} placeholder instead of hardcoded date

Suggested change
## [Bug Fixes] - 2026-02-23
## [Bug Fixes] - {PR_MERGE_DATE}

Context Used: Rule from dashboard - What: Changelog entries must use {PR_MERGE_DATE} placeholder in titles, be placed at the top of th... (source)

@natsustan
Copy link
Contributor

Hi @Yukaii, thank you so much for the contribution! I really appreciate you taking the time to fix this issue. 🙏
I happened to be working on a larger update at the same time (#25769), which includes a refactor with shared hook factories and a new Menu Bar command. Since the refactor changed how the hooks are structured, I ended up implementing the enabled gating in a different way that fits the new architecture.

Your approach was solid — sorry for the overlap! Hope to see more contributions from you just like supporting Cluade Code because I cannot Pay to Anthropics 😘.

@Yukaii
Copy link
Contributor Author

Yukaii commented Feb 24, 2026

Awesome, as long as the bug is addressed, I'm happy with that 🤣

@Yukaii Yukaii closed this Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension: agent-usage Issues related to the agent-usage extension extension fix / improvement Label for PRs with extension's fix improvements platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants