Skip to content

fix(plugins): harden sidebar plugin loading and API checks#1977

Merged
bajrangCoder merged 1 commit intoAcode-Foundation:mainfrom
bajrangCoder:fix/sidebar-plugin-explore-error
Mar 24, 2026
Merged

fix(plugins): harden sidebar plugin loading and API checks#1977
bajrangCoder merged 1 commit intoAcode-Foundation:mainfrom
bajrangCoder:fix/sidebar-plugin-explore-error

Conversation

@bajrangCoder
Copy link
Copy Markdown
Member

No description provided.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 24, 2026

Greptile Summary

This PR hardens the sidebar plugin loading logic in src/sidebarApps/extensions/index.js by fixing two silent bugs and adding defensive error handling throughout.

Key changes:

  • Bug fix — missing await on helpers.checkAPIStatus() in both searchPlugin and loadExplore: without await, the returned Promise object was always truthy, so if (!status) never fired and the API error UI was never shown to the user. Adding await makes the check work as intended.
  • Hardened listInstalledPlugins: each plugin is now processed inside its own try/catch; unreadable plugin.json files log a warning and return null (filtered out at the end) instead of crashing the entire listing. Icon URI resolution is also independently guarded so a single broken icon does not abort the whole plugin entry.
  • Improved error visibility in loadExplore with an added console.error on failure.

Confidence Score: 5/5

  • Safe to merge — all changes are targeted bug fixes and defensive hardening with no new logic paths.
  • The two await additions fix a clear, demonstrable bug (Promise is always truthy → API check was silently skipped). The listInstalledPlugins refactor is a strict improvement that converts a crash-on-any-error path into a warn-and-skip path. There is one minor follow-up (the outer lsDir call is still unguarded), but it is pre-existing and does not affect correctness of the new code.
  • No files require special attention.

Important Files Changed

Filename Overview
src/sidebarApps/extensions/index.js Fixes two silent bugs where missing await on helpers.checkAPIStatus() made the Promise truthy and bypassed the API error UI; hardens listInstalledPlugins with per-plugin try/catch and null-filter; adds a console.error for explore load failures. One non-critical follow-up: the outer lsDir() call is still unguarded.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[searchPlugin / loadExplore triggered] --> B{await checkAPIStatus}
    B -- false --> C[Show api_error UI and return]
    B -- true --> D[Fetch plugins from API]
    D --> E[Call listInstalledPlugins]
    E --> F[await lsDir — unguarded]
    F --> G{For each item}
    G --> H{Read plugin.json}
    H -- error --> I[warn + return null]
    H -- ok --> J{plugin.icon exists?}
    J -- no --> K[Set installed=true, return plugin]
    J -- yes --> L{toInternalUri}
    L -- error --> M[warn, keep original icon path]
    L -- ok --> N[Set resolved icon]
    M --> K
    N --> K
    G --> G
    E --> O[filter out nulls]
    O --> P[Render plugin list items]
Loading

Reviews (1): Last reviewed commit: "fix(plugins): harden sidebar plugin load..." | Re-trigger Greptile

Comment thread src/sidebarApps/extensions/index.js
@bajrangCoder bajrangCoder merged commit d2efece into Acode-Foundation:main Mar 24, 2026
5 checks passed
@bajrangCoder bajrangCoder deleted the fix/sidebar-plugin-explore-error branch March 24, 2026 13:59
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