← Back to Pull requests

Don't wait on a cancelled call before running the new version #45

Closed
unknown closed this pull request without merging on Nov 11, 2026 01:01 UTC
View on GitHub
unknown unknown commented on Nov 10, 2026 10:10 UTC
Author

Since #40, kanzo mcp runs the updated program only once every request has its answer. It counted requests on the way in and answers on the way out (src/stdio.rs). But rmcp sends no answer to a request the agent cancelled ("dropping response for cancelled request"). So after one cancelled call the count never got back to zero, and the first message after the next update waited forever. From then on, nothing the agent sent reached Kanzo until the agent was restarted.

A call is easy to cancel when it waits: on kanzo sync's lock, on the busy timeout, or on a slow shared board. Pressing Esc in the agent then cancels it.

To reproduce on main: run kanzo mcp from a copy of the program and send initialize. Hold kanzo.lock as sync does, call list_projects, cancel it with notifications/cancelled, and release the lock. Then touch the program, as an update does, and call again:

call 1 (cancelled)  -> no answer, as expected
call 2 after update -> no answer in 8 s
call 3              -> no answer in 3 s

With this branch, call 2 gets tools/list_changed and its answer from the new program, and call 3 is answered too.

The fix keeps the ids of the requests still waiting for an answer, rather than a count. An answer removes its id, and so does a notifications/cancelled naming it. Only incoming requests add ids, so the list can't fill again between the check and the handover. There's no new dependency, and MCP replies don't change.

Test: a_cancelled_request_is_not_waited_on sends request 1, a cancel for it, and request 2 through read_requests, and checks that only 2 is left to wait on. To let the test feed it, read_requests now takes the agent's input instead of reading stdin itself. Without the cancel handling the test fails with [1, 2].

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings and cargo test pass

  • A board change was tried in a browser, in light and dark mode (no board change)

  • The README says what changed for users, if anything did (nothing changed for users)
  • Diff: 257 lines (+192 / -65) across 3 files Reviewer: emanuele-em Review duration: 891m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 257 lines diff across 3 files
    0.39
    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.332
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #45"
    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: 39.1% (MEDIUM) · Higher = larger blast radius
    39.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: 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: 15.5% · Safe to merge
    15.5%