← Back to Pull requests

fix(agent-tasks): #4212's deferred P3s: App-match launchAfterTeamResume, filter once, harden and extend the #4202 pins (#4315) #4350

Open
unknown opened this pull request with 332 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 17, 2026 15:00 UTC
Author

Closes #4315 (its in-scope items 3, 6, 7 and 8; items 1, 2 and 5 were already fixed on main and item 4 is split out to #4344). Follow-up to #4202 / #4212.

What and why


#4212 made every event-by-task read in the wake, stall and matcher paths match the event's App to the task's App, because agent_team_events.task_id has no foreign key and a legacy or hand-made row can name a task of another App (no write path makes one). This PR is the four items the gate cleared (T1, plus a narrow §10 on item 3).

| Item | Change |
|---|---|
| 3. hostOperations/launch.ts, launchAfterTeamResume | the latest-assignment subquery gains e.app_id = t.app_id. A foreign assignment.matched row naming a hand-assigned task is no longer "the latest assignment", so the lift no longer takes its family. |
| 6. agentTasks/stall.ts, loadStallInputs | the finish-by alarm history is App-filtered once per pass (ownFinishByAlarms), not again for every task with a finish-by time. No behavior change. |
| 7. eventTaskAppMatch4202.test.ts, the external-id feed helper | it reports whether its xmin visibility condition was reached and throws a descriptive error when it was not, inside the tests' own 30 s timeout (it used to wait 200 x 50 ms, longer than the 5 s default, then continue silently). A pin covers the miss with an injected never-true condition. |
| 8. same file | four pins: a foreign and a same-App assignment.queued (the queue timestamp and the unassignable episode start), a foreign and a same-App finish-by alarm in the history (the finish-by episode start). |

Pins and mutants


  • Item 3 is red at 3577d96dc on main (launchAfterResumeEventApp4315.test.ts: expected the start as codex, got none); the same-App control is green by design.

  • Item 8, each foreign case fails when its read's App match is removed: dropping own(...) on queued fails the foreign assignment.queued pin; dropping it on the finish-by history fails the foreign finish-by pin. Same-App controls stay green.

  • Item 6: the agentTasks, hostOperations, stopSignals and tickers suites (80 files, 1,518 tests) pass unchanged.
  • Existing tests changed


    None. eventTaskAppMatch4202.test.ts gains tests and a hardened helper; no assertion removed.

    Out of scope


    Items 1, 2, 5 are fixed on main; item 4 is #4344 (a schema change that needs a ruling first). No migration, SDL or MCP change.

    Checks run locally


    tsc --noEmit, check-loc-scope, check-urn-rename-aliased. Hosted CI runs the full suite.

    Specs


    cor:agt:050:01, :11, :21 (App-matched reads): compliance, no law change.

    🤖 Generated with Claude Code

    Diff: 332 lines (+249 / -83) across 4 files Reviewer: claude[bot] Review duration: 6m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.42) × (1 − Review Confidence (0.42)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 332 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 79% · Reviewer familiarity: 35%
    41%
    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.347
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #4350"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 41.6% 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: 42.1% (MEDIUM) · Higher = larger blast radius
    42.1%
    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: 41.6% · Lower = rushed or shallow review
    41.6%
    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: 24.6% · Safe to merge
    24.6%