← Back to Pull requests

Brief UX and MCP progress notifications #7

Closed
unknown closed this pull request without merging on Nov 22, 2026 19:23 UTC
View on GitHub
unknown unknown commented on Nov 22, 2026 19:21 UTC
Author

Generating a brief takes 10–30 s. This PR makes that wait visible, and makes every failure clear and recoverable.

MCP


  • Progress notifications over SSE. These go only to clients that send _meta.progressToken on brief_for_job or brief_from_job_post and accept text/event-stream.

  • - There's one notification per real phase (looking up the role, fetching the page, writing the brief), plus a heartbeat every 5 s with elapsed time, then the JSON-RPC response.
    - Every other request is unchanged JSON.
    - Requests the protocol gates would reject (bad Host, bad version, oversized body) keep their normal HTTP status.
    - Not every client sends a progress token; the README says so.

    Web


  • While writing: an elapsed timer, a 75 s client timeout with a clear message, and a guard so a double click sends one request.

  • Error codes: routes return a code with every error, and the page reacts to it:

  • - Link can't be fetched: the field clears, switches to "Paste the full job description here", and gets focus.
    - Rate limited: the message links to the ready-made briefs.
    - Brief already being written by another request: picked up automatically.
  • Security fix: /api/brief checked the rate limit before validating input, so junk requests used up a real caller's allowance. It now validates first, with a regression test. Both brief routes also refuse oversized bodies before reading them.

  • Honest budget message: when the daily budget can't be checked, the message now says so (budget_unavailable) instead of claiming it's used up.
  • Verification


  • 228 tests pass (6 new). They cover progress eligibility, stream ordering, strictly increasing progress, the final response's id, validation order, body caps, and error codes.

  • Against a local production build with a deliberately invalid model key (so no spend):

  • - the SSE stream returns text/event-stream with the phase notifications and the response
    - a call without a token stays JSON
    - in a browser: the paste fallback clears, switches and focuses the field; a double-click sends 1 request; the job page shows progress and the budget message
  • Not deployed.
  • 🤖 Generated with Claude Code

    Diff: 279 lines (+209 / -70) across 3 files Reviewer: cursor[bot] Review duration: 1m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.40) × (1 − Review Confidence (0.31)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 279 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 18% · Reviewer familiarity: 35%
    31%
    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.337
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #7"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 31.3% 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: 39.6% (MEDIUM) · Higher = larger blast radius
    39.6%
    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: 31.3% · Lower = rushed or shallow review
    31.3%
    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: 27.2% · Safe to merge
    27.2%