← Back to Pull requests

scheduler: fix Kubernetes diagnostics and submission context #1669

Closed
unknown closed this pull request without merging on Nov 03, 2026 11:02 UTC
View on GitHub
unknown unknown commented on Nov 03, 2026 09:41 UTC
Author

Follow-up to #1666, covering the staging failure and the remaining review notes.

Staging detected BackoffLimitExceeded for kbuild-gcc-14-powerpc and uploaded diagnostics, but the API rejected data.error_code="k8s_job_failed" with HTTP 400, leaving the node running. Use the existing Infrastructure code and retain the specific k8s_* outcome in the error message and diagnostic artifacts. Monitor tests now validate outgoing data against the real KbuildData schema.

Also address the remaining review concerns:

  • Fetch raw Kubernetes log responses and decode UTF-8 with replacement, preserving line breaks instead of uploading a Python bytes representation. Close and release responses on success or read failure. Tests use raw byte responses and cover malformed UTF-8 and previous-container logs.

  • Give the monitor's HTTP diagnostic storage client a short retry budget: a five-second connect timeout and a 30-second read timeout, at most two attempts, and a two-second retry delay. Failed uploads leave the node running for retry on the next poll. Normal artifact uploads retain their existing policy. Keep the fatal ten-minute watchdog for the monitor as a recovery backstop for calls that remain stuck despite network timeouts. Socket timeouts are not a strict total-duration deadline; the watchdog remains the final safeguard. Non-HTTP storage continues to use its existing backend.

  • Serialize Kubernetes submission and immediate context capture across all Kubernetes runtimes, protecting both mutable runtime context and shared client configuration. Waiting submitters refresh their watchdog heartbeat. Concurrency tests cover shared and distinct runtime objects, and tests verify lock release on submission failure and that other runtimes bypass the lock.
  • Replace the existing worker test's parenthesized multi-context with with ExitStack to satisfy the configured Ruff Python 3.7 target, and document the resulting behavior.

    Validation: 76 scheduler/monitor tests and two concurrency subtests pass. Upload tests cover transient timeouts, connection errors, HTTP 5xx retries, HTTP 4xx rejection, file cleanup/reopening, and recovery on a later poll after either diagnostic upload exhausts its retries. Watchdog tests verify that a permanently stalled monitor still terminates the process. The CI hook's Ruff 0.11.5 lint and formatting checks pass across all 38 Python files; git diff --check passes. These are local checks; staging deployment is separate.

    Diff: 310 lines (+232 / -78) across 3 files Reviewer: bhcopeland Review duration: 80m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.63) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.63 · 310 lines diff across 3 files
    0.63
    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.343
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.063
    Real PR Conversation Timeline
    1 comments
    "Review active on #1669"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    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: 63.4% (MEDIUM) · Higher = larger blast radius
    63.4%
    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: 25.1% · Safe to merge
    25.1%