← Back to Pull requests

feat(agent-bus): principal registry and inbox API (#2155 slice 1) #2156

Open
unknown opened this pull request with 268 lines diff across 3 files
View on GitHub
unknown unknown commented on Oct 22, 2026 04:17 UTC
Author

<!-- CURSOR_AGENT_PR_BODY_BEGIN -->

Summary

Implements slice 1 of epic #2155: a dashboard-local principal registry and agent inbox API backed by staff_runs.sqlite3 and staff conversation threads (no parallel message store). Agents register with role, provider, node, and session id; heartbeats renew a lease; typed messages (request, status, handoff, blocked) require a repo plus issue or PR number, carry an idempotency key, and are mirrored onto the work-item thread. Auth reuses coordination.write and the agent-token / fleet-peer bootstrap model; bearer tokens are never logged.

Test plan

  • pytest tests/api/test_agent_bus_slice1.py (handoff AffineDrift#5117, Brick local Cursor register, expired lease 409, DbC 422)
  • Handoff

  • Branch: cursor/agent-inbox-slice1-ccf8

  • Validation: pytest tests/api/test_agent_bus_slice1.py green locally; OpenAPI/types regenerated via scripts/gen-api-client.sh

  • Blockers: none

  • Next step: After merge, slice 2 (RM hook client + session-start / pre-push heartbeat integration)
  • Related: #2155 (epic; not closed by this slice).
    <!-- CURSOR_AGENT_PR_BODY_END -->

    <div><a href="https://cursor.com/agents/bc-6060f597-8e64-5fae-9cf0-54d619e6ccf8?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/background-agent?bcId=bc-6060f597-8e64-5fae-9cf0-54d619e6ccf8&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>

    Diff: 268 lines (+201 / -67) across 3 files Reviewer: chatgpt-codex-connector[bot] Review duration: 6m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.44) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.44 · 268 lines diff across 3 files
    0.44
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 99% · Reviewer familiarity: 35%
    42%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.335
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #2156"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 42.7% 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: 44.4% (MEDIUM) · Higher = larger blast radius
    44.4%
    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: 42.7% · Lower = rushed or shallow review
    42.7%
    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: 25.4% · Safe to merge
    25.4%