Skip to content

Add provider storage usage and cleanup guidance#829

Merged
steipete merged 4 commits intosteipete:mainfrom
fatiheminoge:codex/provider-storage-cleanup-guidance
May 5, 2026
Merged

Add provider storage usage and cleanup guidance#829
steipete merged 4 commits intosteipete:mainfrom
fatiheminoge:codex/provider-storage-cleanup-guidance

Conversation

@fatiheminoge
Copy link
Copy Markdown
Contributor

@fatiheminoge fatiheminoge commented May 2, 2026

Summary

  • Add provider storage footprints for Overview and provider detail tabs.
  • Show compact Storage: <size> rows in Overview while keeping detailed storage breakdowns in provider tabs only.
  • Add exact-path storage breakdowns, copyable paths, and recommendation-only cleanup guidance for known provider-owned data.
  • Refresh storage scans when the user refreshes usage so deleted local data is reflected.

Safety

  • Cleanup guidance is recommendation-only; no files are deleted by CodexBar.
  • Recommendations are limited to known provider-owned paths and exclude auth, credentials, settings, app bundles, browser profiles, package-manager folders, and shared global caches.
  • Unknown providers keep storage totals and exact path breakdowns without cleanup recommendations.

Verification

  • swift test --filter ProviderStorageFootprintTests
  • swift test --filter UsageFormatterTests
  • swift test --filter HistoricalUsagePaceBackfillAuthorityTests
  • corepack pnpm check
  • ./Scripts/compile_and_run.sh
image

@fatiheminoge fatiheminoge marked this pull request as ready for review May 2, 2026 21:32
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 517b81fe76

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +76 to +77
await Task.detached(priority: .utility) {
let scanner = ProviderStorageScanner()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Propagate cancellation into storage scan task

scheduleStorageFootprintRefresh cancels storageRefreshTask on every new refresh request, but scanStorageFootprints immediately starts a second Task.detached that is not a child of the cancelled task. In practice, rapid menu rebuilds can leave many full filesystem scans running in the background even after cancellation, which can cause avoidable disk churn and responsiveness issues on large provider directories.

Useful? React with 👍 / 👎.

Comment on lines +508 to +509
if self.addStorageMenuCardSection(to: menu, provider: context.currentProvider, width: context.menuWidth) {
menu.addItem(.separator())
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add storage card for expanded token-account view

The storage section is only appended in the single-card path, so when tokenAccountDisplay.showAll is enabled the early branch returns without ever adding storage details. Users with multiple token accounts therefore lose the new storage row/breakdown entirely in provider detail menus under that setting, which makes the feature appear broken for that configuration.

Useful? React with 👍 / 👎.

@steipete steipete merged commit 5252068 into steipete:main May 5, 2026
1 check passed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fd6fb37078

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

menuWidth: menuWidth,
tokenAccountDisplay: tokenAccountDisplay,
openAIContext: openAIContext)
self.store.refreshStorageFootprintsForOverview()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Skip storage refresh calls when feature is disabled

Calling refreshStorageFootprintsForOverview() during every menu population creates a self-refresh loop when providerStorageFootprintsEnabled is off (the default): the call path hits clearStorageFootprints(), which mutates the observed providerStorageFootprints dictionary via removeAll(), triggering observeStoreChanges and invalidateMenus(refreshOpenMenus: true), which repopulates the open menu and repeats. This can keep the menu continuously rebuilding and burn CPU while the menu is open even though the feature is disabled.

Useful? React with 👍 / 👎.

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.

2 participants