Skip to content

fix(chat): avoid false daily usage limit message on 429#2953

Merged
louis030195 merged 2 commits intoscreenpipe:mainfrom
Flamki:codex/fix-pi-false-daily-limit
Apr 15, 2026
Merged

fix(chat): avoid false daily usage limit message on 429#2953
louis030195 merged 2 commits intoscreenpipe:mainfrom
Flamki:codex/fix-pi-false-daily-limit

Conversation

@Flamki
Copy link
Copy Markdown
Contributor

@Flamki Flamki commented Apr 13, 2026

Summary

Fixes a false-positive daily limit wall in Pi chat error handling.

Root Cause

Two error paths in standalone-chat.tsx (message_start/message_end and agent_end) treated generic HTTP 429 as a daily-limit condition. This mislabeled transient or model rate-limit responses as "daily usage limit reached" for paid-model users.

Changes

  • Added classifyQuotaError(errorStr) helper to separate:
    • daily: credits_exhausted, daily_limit_exceeded, daily_cost_limit_exceeded
    • rate: generic 429 and rate-limit markers
  • Added buildRateLimitMessage(errorStr) helper to keep rate-limit messaging consistent.
  • Updated message_start/message_end and agent_end error branches to use the classifier.

Impact

  • Generic 429 now shows a rate-limit message instead of the daily-limit wall.
  • True daily-limit signals still show the daily-limit message and analytics event.
  • Scope is UI error classification only (no network or request-path changes).

Validation

  • PASS: bunx tsc --noEmit --pretty false (in apps/screenpipe-app-tauri)
  • NOTE: bun run test still has existing baseline failures unrelated to this patch (multiple bun:test import-resolution suites and pre-existing assertion failures in text-overlay and use-frame-ocr-data).

Closes #2941

@louis030195
Copy link
Copy Markdown
Collaborator

Good approach with classifyQuotaError(), but it's only used in 2 of 6 places that do this check. These lines still have the old inline pattern:

  • L1940 (auto_retry_end)
  • L1985 (another error path)
  • L2177 (yet another path)

They still do errorStr.includes("429") lumped in the outer condition. They happen to work by accident because of the inner isDailyLimit check, but credits_exhausted is also missing from those paths.

Can you update all 6 occurrences to use classifyQuotaError() + buildRateLimitMessage() for consistency? Otherwise we'll hit the same bug again if someone edits one of the unfixed paths.

@louis030195 louis030195 added bug Something isn't working medium priority labels Apr 13, 2026
@louis030195
Copy link
Copy Markdown
Collaborator

Triage Update

Status: In Progress - Needs Additional Work

Context: This PR addresses issue #2941 (false daily usage limit message).

Review Feedback Summary

Based on @louis030195's comment, the helper is only used in 2 of 6 places that do quota checks. The remaining locations with inline patterns are:

  • L1940 (auto_retry_end)
  • L1985 (another error path)
  • L2177 (yet another path)

These still have the old errorStr.includes("429") pattern and are missing the credits_exhausted check.

Action Required

@Flamki - Please update all 6 occurrences to use classifyQuotaError() + buildRateLimitMessage() for consistency. This prevents future bugs if someone edits one of the unfixed paths.

Recommendation

  • Once the remaining occurrences are updated, this PR is ready for merge
  • Good approach with the helper functions - centralizing error classification is the right pattern

Triaged by pipe-github-issue-triage

@Flamki
Copy link
Copy Markdown
Contributor Author

Flamki commented Apr 14, 2026

Addressed this review item in commit d4bbc3e.

What changed:

  • Switched the remaining inline quota checks to classifyQuotaError() + buildRateLimitMessage() in:
    • auto_retry_end
    • message_update assistant error path
    • response error path
  • Updated chat_response_error category mapping to also use classifyQuotaError() so credits_exhausted is categorized as daily-limit consistently.

So all quota-check branches now use the shared helpers (no remaining inline ...includes(429) daily/rate split logic).

Validation:

  • PASS: bunx tsc --noEmit --pretty false in apps/screenpipe-app-tauri
  • E2E failures remain the same cross-platform app-bootstrap baseline (home-page / nav-settings not found), unrelated to this chat error-classification change.

@louis030195 louis030195 merged commit 0051346 into screenpipe:main Apr 15, 2026
1 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working medium priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: False 'daily usage limit reached' for Pi agent using paid models (Sonnet)

2 participants