← Back to Pull requests

perf(uploads): reuse confirmed attachment imports #947

Open
unknown opened this pull request with 190 lines diff across 2 files
View on GitHub
unknown unknown commented on Oct 22, 2026 03:31 UTC
Author

Summary

  • Keep host-private confirmed upload receipts for the exact acquired container. Reconcile the whole manifest, but download and import only attachment IDs whose paths are not already confirmed.

  • Serialize sibling imports with a process-shared lock. Persist invalidation before Docker mutation and confirmation only after success, so interrupted or uncertain imports retry the complete manifest even on a later turn without new uploads. Missing receipts and replacement containers also restore conservatively.

  • Write tar archives incrementally to a temporary file, keeping only the current attachment body in memory. Preserve existing root ownership, read-only modes, path validation, size limits, and placement outside the repository.
  • Validation

  • TMPDIR=/var/tmp/freeinference-tests-918 PYTEST_WORKERS=2 make check: 11,366 passed, 6 skipped; format, lint and types passed.

  • Focused attachment, runner-settings, source-prefetch and size-ratchet suite: 133 passed.

  • Regression: adding one file to 199 confirmed files fetches one body; same-path replacement fetches one body; interrupted import, container replacement, sibling overwrite, and missing receipt recover correctly.

  • A lazy 60 MiB archive stays below 8 MiB peak traced allocations in the archive-writer test. Individual missing attachments still use the existing JSON/base64 API.
  • Integration note

    PR #944 changes the adjacent supervisor entry in the size-ratchet file. When combining them, retain supervisor=5619 and runner=5029.

    Fixes #918

    Diff: 190 lines (+142 / -48) across 2 files Reviewer: copilot-pull-request-reviewer[bot] Review duration: 0m
    All Vouch review confidence checks passed
    Residual risk 0.32 = Change Risk (0.36) × (1 − Review Confidence (0.11)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 190 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 8% · Reviewer familiarity: 35%
    11%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.314
    Real PR Conversation Timeline
    1 comments
    "Review active on #947"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 11.2% 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: 35.9% (MEDIUM) · Higher = larger blast radius
    35.9%
    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: 11.2% · Lower = rushed or shallow review
    11.2%
    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: 31.9% · Safe to merge
    31.9%