← Back to Pull requests

Trim PyMongo 4.18 wheel size for the Agent #25548

Closed
unknown closed this pull request without merging on Oct 07, 2026 21:20 UTC
View on GitHub
unknown unknown commented on Oct 07, 2026 17:27 UTC
Author

What does this PR do?

Reduces the installed size of PyMongo 4.18.2 in the Agent from 3.47 MiB to about 1.9 MiB on linux x86_64, slightly below the 1.77 MiB of PyMongo 4.8.0 plus the new SRV public suffix list. This PR targets #25517.

  • Builds PyMongo from source on the Linux builders. PyPI's manylinux wheels ship _cmessage and _cbson with DWARF debug info (about 0.7 MiB on x86_64 and 1 MiB on aarch64); building with our LDFLAGS=-Wl,--strip-debug removes it. This is how 4.8.0 was already built, since it had no cp313 wheel on PyPI.

  • Removes pymongo/asynchronous/ and gridfs/ from the packaged wheel (about 0.9 MiB on every platform), along with the three lines that import pymongo.asynchronous eagerly. No integration uses AsyncMongoClient or GridFS, and the sync client does not depend on either package.
  • Motivation

    The PyMongo upgrade in #25517 increases the Agent's on-disk size enough to fail the static quality gates. Most of the increase comes from upstream shipping both a sync and an async copy of the client since 4.9, and from unstripped extensions in the PyPI wheels.

    Validated by running the builder's clean_wheel on the 4.18.2 wheel and by exercising the trimmed, stripped install against MongoDB 8.0 on linux/amd64: connect, insert, count, index creation, explain, $currentOp, $indexStats, collStats, and listDatabases, with the C extensions loaded and the mongodb+srv resolver importable. Dependency resolution needs to rerun on this branch to rebuild the wheels and update the lockfiles.

    Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)

  • Add qa/required if this PR needs QA validation, or qa/skip-qa if it does not. Exactly one of the two is required.

  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged
  • Diff: 248 lines (+186 / -62) across 3 files Reviewer: aiuto Review duration: 232m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 248 lines diff across 3 files
    0.39
    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.330
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #25548"
    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: 38.9% (MEDIUM) · Higher = larger blast radius
    38.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: 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.4% · Safe to merge
    15.4%