← Back to Pull requests

Make create_task and next_task safe to retry with optional request IDs #56

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

Stacked on #57 and #58: merge it last. Until they're in, GitHub shows their commits here too. This PR's own commit is the last one, Make create_task and next_task safe to retry with a request_id.

When an agent's reply is lost, because it was interrupted or the connection dropped, it can't tell whether its call happened. create_task and next_task now take an optional request_id. If the call is sent again with the same id, it answers with the task the first call made or took, and nothing is done twice. Fixes #53.

This is the smaller version from the review:

  • Only create_task and next_task: retrying them is what leaves a duplicate behind, a second task or a second task taken.

  • Kept for a day, and deleted with its task, also when its project is deleted. A receipt is the id, a 64-bit hash of what the call asked, and the task id. It holds no titles, descriptions or comments, so nothing of a deleted task stays behind or goes out with kanzo sync.

  • A new id for every call, as the schema says: New for each call; resend it only to retry that call, which then runs once. The same id sent with another call is refused, and nothing is done.

  • A next_task that took nothing keeps no receipt, since there's nothing to do twice.

  • Size: about 340 lines including tests, instead of 1,400.
  • On a retry, the reply says Already created earlier: api#2 in todo: …, or Already taken earlier: followed by the task as it is now. Calls without request_id, and their replies, are unchanged.

    Migration 13 adds the requests table. It has no triggers, so a retry doesn't wake the board, and older Kanzo versions keep opening it. measure.py's board doesn't use request ids, so its database only gains the empty table and its index.

    Tokens: the tool list grows by 246 bytes (request_id on two tools).

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings and cargo test pass (141 tests, with #58 and #57)

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

  • The README says what changed for users, if anything did (all four READMEs)
  • Diff: 267 lines (+200 / -67) across 3 files Reviewer: emanuele-em Review duration: 24830m
    All Vouch review confidence checks passed
    Residual risk 0.16 = 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 · 267 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.334
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #56"
    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.4% (MEDIUM) · Higher = larger blast radius
    39.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: 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.6% · Safe to merge
    15.6%