← Back to Pull requests

refactor(ai): activate the Vercel AI SDK through Orchestrion #11316

Closed
unknown closed this pull request without merging on Nov 24, 2026 13:44 UTC
View on GitHub
unknown unknown commented on Nov 18, 2026 18:57 UTC
Author

What does this PR do?

Migrates the ai integration to Orchestrion setup and removes the module-load hooks. Setup registers subscribers synchronously before plugin activation, once per process, without loading the SDK. The v7 stream observer still attaches through pipeThrough without replacing ctx.result.stream.

Motivation

Revisits #10712 using the current activation and bundler rewrite paths. Published v4–v6 CommonJS and ESM entry points, and v7’s shared ESM entry point, all produce real rewrites. No fallback hook is needed.

Additional Notes

Regression tests use real SDK entry points to verify first-call tracing, subscriber deduplication, model interception, and v7 chunk and completion reporting. Webpack’s existing ESM limitation remains unchanged; the real-SDK webpack smoke test covers v6 CommonJS.

  • PLUGINS=ai npm run test:instrumentations: 23 passed each on Node 22.19.0 and 24.15.0; focused activation, rewriter, and bundler helper specs: 199 passed.

  • PLUGINS=ai npm run test:plugins: 178 passed, 16 pending; PLUGINS=ai npm run test:llmobs:plugins: 298 passed, 56 pending.

  • npm run test:aiguard: 446 passed; npm run test:integration:aiguard: 58 passed.

  • esbuild, webpack, Vite, and Turbopack unit suites: 87 passed. Focused esbuild integration tests: 6 passed across 0.16.12 and 0.28.2, including real v7 streaming. Focused webpack integration tests: 2 passed, plus the v6 CommonJS smoke test.

  • Rewriter target verification, changed-file ESLint, and EditorConfig passed. Full npm run lint reported an OpenFeature fixture outside the test globs.
  • Diff: 200 lines (+150 / -50) across 2 files Reviewer: rochdev Review duration: 8327m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 200 lines diff across 2 files
    0.36
    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.317
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #11316"
    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: 36.2% (MEDIUM) · Higher = larger blast radius
    36.2%
    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: 14.3% · Safe to merge
    14.3%