Skip to content

Planka importer treats ordinary rate limits over five minutes as exhausted quotas #2253

Open

Description

@fernandezbaptiste

Hullo folks,

I’m doing some research for Tessl Code Review and ran it against your repo. It flagged a potential issue, and I figured it made sense to share it with you:

An ordinary API-key rate limit can abort a Planka import with the wrong diagnosis. This surfaced while reviewing merged PR #1944, and I reproduced it against current main at df0a5b0e.

In KaneoClient.request, any Retry-After above 300 seconds is treated as an exhausted usage quota. But a normal rate_limited response can have a longer window, and the server's apiKeyDenialHeaders identifies that case with the X-RateLimit-* headers.

Reproduction

I used that actual server helper to build a 429 response with status: 'rate_limited', limit: 10 and a reset time 301 seconds ahead. I then called the actual KaneoClient.listWorkspaces(), with fetch returning that response first and an empty successful result on the next request.

Retry-After Result
300 seconds Calls onRateLimit(300000), retries and succeeds
301 seconds One request, no wait callback, throws the API-key usage-limit error
600 seconds Same early abort and usage-limit diagnosis

The harness replaced the sleep with a zero-delay timer while recording the requested wait. It used no live API key and did not run a full migration.

This is a remaining edge case after the fix for #1925, rather than the original unhandled-401 case. A deliberate maximum wait seems reasonable, but it should not turn a normal rate limit into an exhausted-quota error. Could the importer use the response's rate-limit headers to distinguish those cases and report a wait-limit refusal separately?

Full transparency: I work at Tessl, and we've spotted that using Tessl Code Review - using repository-level context and specific review lenses that improve over time through feedback. That’s how this finding surfaced.

We’re just getting started and want to offer the tool free to open-source projects. If this is useful, happy to give you access.

Bap

Activity

  1. added
    priority:medium
    on Nov 21, 2026
  2. Hugo510 commented on Nov 23, 2026

    @Hugo510

    AI-assisted investigation and text, posted by OpenAI Codex with @Hugo510's authorization. No independent human review of this text is claimed.

    Confirmed on main at e46680d2 using the actual KaneoClient and apiKeyDenialHeaders. For an ordinary rate_limited response, 300 seconds triggers the wait callback and a successful retry. At 301 and 600 seconds, the client makes one request and reports an exhausted usage quota. Fetch was stubbed and waits were recorded with zero-delay timers.

    Would you prefer keeping the five-minute cap with an accurate maximum-wait refusal message, or allowing longer waits when the response identifies an ordinary rate limit? @Hugo510 is interested in contributing once the scope is agreed and the issue is marked ready-for-contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:mediumready-for-contribution

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions