Skip to content

Port upstream 0.65.0: GitKraken 429 Retry-After (stacked on #619) - #727

Draft
Finesssee wants to merge 1 commit into
codex/port-0.65-provider-packfrom
port/micro-0.65.0-gitkraken-retry-after
Draft

Finesssee wants to merge 1 commit into
codex/port-0.65-provider-packfrom
port/micro-0.65.0-gitkraken-retry-after

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #619 (base codex/port-0.65-provider-pack). GitKraken usage requests now honor Retry-After on HTTP 429, matching upstream gitkraken.ts at v0.70.0 (Number(headers["retry-after"] ?? 1), capped at 10 s, non-finite or negative values fall back to 1 s). Closes audit GAP-31.

The message follows the existing Replicate precedent: GitKraken rate limited usage requests; retry after 7.000s. Details: a missing header or an unparseable value gives 1 s, an empty value gives 0 s (as Number("") does upstream), values above 10 s are capped at 10 s. Other statuses are unchanged.

Tests

  • Unit test for every header shape (valid, fractional, over cap, negative, text, inf, empty, missing).
  • HTTP-level mockito test drives fetch_from against a 429 with Retry-After: 7.
  • cargo +1.98.0 fmt --all --check, cargo +1.98.0 clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings: clean.
  • cargo test -p codexbar: 2257 passed. Shell crate untouched.

UI proof

Backend-only error text; no UI change.

Small change written directly by the codex-2 lane coordinator (Claude).

@coderabbitai

coderabbitai Bot commented Oct 1, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Finesssee

Copy link
Copy Markdown
Collaborator Author

Adversarial validation (Claude Opus 5.5) passed at 7c8aff3

Scope: GAP-31, GitKraken AI 429 Retry-After.

  • The diff against codex/port-0.65-provider-pack (669910b, also the merge base) touches only rust/src/providers/gitkraken/mod.rs, which is 679 lines.
  • GitKraken exists only in this stack, so the base is correct.

Compared with upstream gitkraken.ts, which is identical at v0.65.0 and v0.70.0:

  • Upstream computes Number(headers["retry-after"] ?? 1), keeps the value only if it is finite and >= 0, caps it with min(delay, 10), and otherwise uses 1.

  • retry_after_seconds matches this:

    Retry-After value Result
    missing 1 s
    empty 0 s
    negative, non-numeric, inf, NaN 1 s
    above 10 capped at 10 s
  • The core has no typed retry-after, so the bounded value goes into the message. This follows the existing Replicate "retry after {:.3}s" convention.

  • The 401, 403, 5xx and other status mappings are unchanged.

  • The unit test covers the bounds. The mockito test sends a real Retry-After: 7 through fetch_from and asserts the exact message.

Checks run at this SHA (toolchain 1.98.0, isolated target dir):

  • cargo +1.98.0 fmt --all --check: clean.
  • cargo +1.98.0 clippy --workspace --all-targets -- -D warnings: clean.
  • cargo +1.98.0 test -p codexbar: 2257 passed, 0 failed, 1 ignored. All 11 gitkraken tests pass.
  • cargo +1.98.0 test -p codexbar-desktop-tauri: 489 passed, 0 failed.

@Finesssee

Copy link
Copy Markdown
Collaborator Author

Adversarial validation passed at 54f6f55

Scope: GitKraken 429 Retry-After (#727, upstream 0.65.0, stacked on #619), validated as merged into release/v0.70.0 (merge 54f6f55 = merge of 7c8aff3 into 417e4fe).

Attacks (highest-risk semantics, from the merged tree):

  • Retry-After parsing is bounded and non-negative: retry_after_seconds parses the header as f64, filters non-finite/negative, caps at 10 s, defaults to 1.0 s when the header is absent and 0.0 when it is empty — the audit's bounded contract; the cap prevents a hostile Retry-After: 999999 from stalling the fetch.
  • The 429 path surfaces the parsed value: status_error formats "GitKraken rate limited usage requests; retry after {s:.3}s." for 429 only; 401/403/5xx keep their distinct messages, so a rate-limit response cannot be confused with an auth failure.
  • Header read before the bounded body read: the merged code reads RETRY_AFTER before read_bounded_response, so a 429 with no body still reports its retry hint (a body-first ordering would lose it).
  • Test honesty: http_429_honors_the_retry_after_header drives the real request path with mockito (status 429 + Retry-After: 7) and asserts the surfaced error contains the parsed value — not a unit test of the parser alone.

No defects found. READY for the un-draft rule.

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