← Back to Pull requests

fix(meetings,agent): abort ModelPort signal on summary deadline and test probe audit (#2907) #5398

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 29, 2026 04:53 UTC
Author

Refs #2907 (follow-up from #2899).

Status of #2907 items on origin/dev

1. (d) Abort signal (implemented): withDeadline in apps/kernel/src/member-vy-ports.ts now creates an AbortController, threads its AbortSignal through summarizeMeeting, enhanceNotes, runFeature, BoundPorts.generate, and ModelPort.generate (packages/agent/src/member-vy/{ports,run-feature,meeting-summary}.ts), and aborts it at the deadline. summaryModelPort and generateMeetingSummaryText (packages/agent/src/summary-model.ts) also accept and link the caller AbortSignal. Added unit and DB tests covering custom ModelPort abort behavior, fast completion without abort, BoundPorts forwarding, and generateMeetingSummaryText prompt abort.
2. (g) Status probe audit (already resolved in #2899, regression-tested here): meetings.summary.status (modules/meetings/src/summary-run.ts) is a non-sensitive query returning { enabled, reason }, and runRecorderVy maps reason directly to FORBIDDEN / SUMMARY_OFF without executing meetings.summary.start. Added unit and DB tests confirming repeated probes and refusals never invoke meetings.summary.start and write zero audit_event rows.
3. MEMBER_VY_SINKS (verified, no change): meetings.summary.copy_result is already registered in MEMBER_VY_SINKS (packages/kernel/src/member-vy-sinks.ts). meetings.result.publish (modules/meetings/src/results.ts) does not read private member-Vy rows (member_vy_result / member_vy_memory) and only publishes already-reviewed (tainted = false) drafts with no source_ref / source_run_id; registering it in MEMBER_VY_SINKS would conflict with apps/kernel/test/invariant/member-vy-sinks.test.ts (sinkProblems()).

Protected paths and shared-core check

  • node tools/ci/protected-paths.mjs origin/dev HEAD: No protected paths changed.

  • Shared-core files (docs/product-owner-config.md#shared-core-review): none changed.
  • Local static checks (#5020)

    Per #5020, no local tsc, typecheck, vitest, knip, Postgres, or Playwright runs were executed on JOY's Mac; full typecheck and test execution rely on GitHub Actions CI. Local instant static checks on 862652e1fed7e7d841c013a38a61e5b48da675da:

  • node tools/ci/pii-scan.mjs <9 touched files>: pii-scan: 9 path(s), 0 skipped, no personal data found

  • pnpm exec oxlint --deny-warnings <9 touched files>: Found 0 warnings and 0 errors.

  • node tools/ci/protected-paths.mjs origin/dev HEAD: No protected paths changed.

  • node tools/ci/spdx-header.mjs origin/dev: spdx header OK: 1 new source file(s) checked

  • git diff --check origin/dev...HEAD: passed (exit 0)
  • Acceptance

  • What changes for a user: Hanging custom ModelPort summary/notes-enhance calls are now aborted via AbortSignal at the request deadline instead of continuing in the background; SUMMARY_TIMEOUT behavior and status-probe refusal behavior remain unchanged.

  • Correctness: Verified by unit and DB tests (packages/agent/test/meeting-summary.test.ts, packages/agent/test/summary-model.test.ts, apps/kernel/test/meetings-summary-ports.test.ts, apps/kernel/test/meetings-summary-run.db.test.ts), pending GitHub Actions CI execution.

  • Security and authorization: meetings.summary.status and runRecorderVy still check ROLES, openMeeting, and recorder_user_id before any run or model call; AbortSignal cancellation fails closed as SUMMARY_TIMEOUT.

  • Tenancy: No tenancy boundary, RLS policy, or query scope changed (org_id scoping preserved).

  • Money: Not applicable (no monetary calculation or ledger change; existing ai_meter admission/recording and DraftBudget remain intact).

  • Performance: Deadlined model calls now abort promptly via AbortSignal rather than continuing until provider timeout, and repeated status probes write zero audit rows.

  • Accessibility: Not applicable (backend kernel and agent changes only; no UI changes).
  • ---

    <!-- dos-pr-summary -->

    📌 TL;DR


    This PR implements cooperative cancellation for meeting summary and notes enhancement workflows by propagating AbortSignal through the ModelPort interface and runFeature pipeline. It ensures that when a deadline is exceeded, the underlying AI provider request is actively aborted rather than just racing against a timeout, preventing resource leaks and allowing for cleaner error handling.

    🎯 Type of Change


  • 🚀 New feature

  • 🐛 Bugfix

  • 🧹 Refactor

  • ⚡ Performance

  • 📚 Documentation

  • ⚙️ CI / Configuration
  • 🔍 Changes Walkthrough


    | File | Summary of Changes |
    | :--- | :--- |
    | apps/kernel/src/member-vy-ports.ts | Updated withDeadline to accept a factory function that receives an AbortSignal. Modified summaryModelPort and runRecorderVy to pass this signal down to generateMeetingSummaryText and enhanceNotes. |
    | apps/kernel/test/meetings-summary-ports.test.ts | New file. Added unit tests verifying that AbortSignal is passed to ModelPort.generate and that the signal is aborted when the deadline is hit. Also tests that refused status checks do not trigger summary start events. |
    | apps/kernel/test/meetings-summary-run.db.test.ts | Updated integration tests to verify signal propagation and abort behavior in the database-backed runtime. Added a test ensuring no audit rows are written for refused status probes. |
    | packages/agent/src/member-vy/meeting-summary.ts | Added optional options parameter (containing signal) to summarizeMeeting and enhanceNotes, forwarding it to runFeature. |
    | packages/agent/src/member-vy/ports.ts | Extended ModelPort.generate and BoundPorts.generate interfaces to accept an optional options object containing an AbortSignal. Updated bindPorts to forward these options. |
    | packages/agent/src/member-vy/run-feature.ts | Updated runFeature to accept and forward the AbortSignal to the ports.generate call. |
    | packages/agent/src/summary-model.ts | Modified generateMeetingSummaryText to accept an external AbortSignal. It now creates an internal AbortController that listens to the external signal and the timeout, ensuring the provider request is aborted if either condition is met. Improved error detection for timeouts. |
    | packages/agent/test/meeting-summary.test.ts | Added tests to verify that AbortSignal is correctly forwarded from summarizeMeeting/enhanceNotes through BoundPorts to ModelPort.generate. |
    | packages/agent/test/summary-model.test.ts | Added a test using a local HTTP server to verify that generateMeetingSummaryText aborts the HTTP request promptly when the caller's signal is aborted, resulting in a SummaryModelError with kind timeout. |

    📊 Architectural Flow


    sequenceDiagram
        participant Kernel as Kernel (runRecorderVy)
        participant Deadline as withDeadline
        participant Scope as withAiScope
        participant Feature as runFeature
        participant Port as ModelPort.generate
        participant Provider as AI Provider
    
        Kernel->>Deadline: Call withDeadline(factory, timeoutMs)
        Deadline->>Deadline: Create AbortController
        Deadline->>Scope: Invoke factory(signal)
        Scope->>Feature: Call summarizeMeeting/enhanceNotes with signal
        Feature->>Port: Call generate(prompt, { signal })
        Port->>Provider: Start HTTP Request (with abortSignal)
        
        alt Timeout Reached
            Deadline->>Deadline: Abort Controller
            Deadline--xProvider: Abort Signal Propagates
            Provider--xPort: AbortError/TimeoutError
            Port--xFeature: Error
            Feature--xScope: Error
            Scope--xKernel: SummaryModelError('timeout')
        else Completion
            Provider-->>Port: Response
            Port-->>Feature: ModelAnswer
            Feature-->>Scope: Result
            Scope-->>Kernel: Success
        end
    

    <!-- /dos-pr-summary -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: claude[bot] Review duration: 7m
    All Vouch review confidence checks passed
    Residual risk 0.39 = Change Risk (0.52) × (1 − Review Confidence (0.24)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 43% · Reviewer familiarity: 35%
    24%
    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.388
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #5398"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 24.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: 52% (MEDIUM) · Higher = larger blast radius
    52%
    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: 24.2% · Lower = rushed or shallow review
    24.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: 39.4% · Moderate risk
    39.4%
    Repository