← Back to Pull requests

fix(inkless:storage): count retried GCS error responses #789

Closed
unknown closed this pull request without merging on Sep 09, 2026 10:57 UTC
View on GitHub
unknown unknown commented on Sep 08, 2026 09:11 UTC
Author

Background

PR #783 added GCS error counters through an HttpResponseInterceptor. The Google HTTP client invokes that interceptor only after HttpRequest.execute() finishes its internal retry loop. When GCS returns 401, HttpCredentialsAdapter can refresh the token and retry the same request before the interceptor runs, so a successful refresh hides the failed response and repeated authorization failures are undercounted.

The credentials handler also reinstalls itself after a refresh. Wrapping it without restoring the metrics wrapper would therefore count only the first 401 from a request.

Batch requests add a second distinction. The outer POST bypasses the request initializer, but each failed multipart sub-response invokes the unsuccessful-response handler. A 404 delete means the object is already absent, and StorageBatch treats that outcome as a confirmed idempotent delete, so counting it as a provider error creates noise during cleaner retries. GCS still bills and rate-limits every submitted delete sub-request, including refused requests, so the operation counter must include all of them.

Changes

  • Record error statuses through an HttpUnsuccessfulResponseHandler, which runs before the client decides whether to retry each response.

  • Delegate to the existing credentials handler and restore the metrics wrapper after it refreshes a token.

  • Keep the response interceptor for operation counters, which should run once after the internal retry loop.

  • Exclude an already-absent batch delete from other-errors, while continuing to count refused and throttled sub-requests.

  • Count every returned batch delete sub-request as an object-delete operation; confirmed deletions remain available through cleaner metrics.

  • Describe other-errors as non-429 4xx responses, excluding absent batch deletes. Protocol responses such as 308 Resume Incomplete also remain excluded.
  • Testing

  • ./gradlew :storage:inkless:test --tests io.aiven.inkless.storage_backend.gcs.MetricCollectorTest --tests io.aiven.inkless.storage_backend.gcs.integration.GcsErrorHandlingTest --tests io.aiven.inkless.storage_backend.gcs.integration.GcsStorageMetricsTest

  • ./gradlew :storage:inkless:genInklessMetricsDoc
  • Diff: 285 lines (+213 / -72) across 3 files Reviewer: giuseppelillo Review duration: 1545m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 285 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.338
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #789"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.8% (MEDIUM) · Higher = larger blast radius
    39.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.7% · Safe to merge
    15.7%
    Repository