← Back to Pull requests

Let a retry's redial that reaches another Machine move only its own client (#2989) #3146

Closed
unknown closed this pull request without merging on Oct 23, 2026 02:11 UTC
View on GitHub
unknown unknown commented on Oct 23, 2026 00:40 UTC
Author

Refs #2989. Follows #3111, from Codex's review there (https://github.com/getployz/ployz/pull/3111#discussion_r4354307356).

Summary

#3111 made Client clones share one channel. The ordinary unary-retry redial (Client::redial, used by call, try_read and so on, for example listed_copies) then wrote whatever channel it reached into that shared slot. So when a connection names no Machine ID and its endpoint now answers as another Machine, one retrying read moved every clone onto it, the Deploy's mutations included.

The redial still follows the new Machine, which server add/init need after a reset mints a new ID (leave_lost_to_a_daemon_restart_is_resent). But it now moves only its own client:

 Client
+  confirmed: Option<MachineId>   # the Machine the shared channel was last confirmed as; a failed redial keeps it
 Client::redial(&mut self)
   entry = None
-  entry = reconnect(None)?        # publishes to every clone
+  (channel, entry) = dial_confirmed()?
+  confirmed ≠ entry (both known) → this client takes `channel` alone; its clones keep theirs
+  otherwise                       → share(channel)
 Client::redial_shared(&self)     # a Deploy's: unchanged, refuses another Machine

The first version pinned the retry to the confirmed entry. Codex's review showed that breaks Leave recovery after a reset, so this version replaces it.

DESIGN.md bets

  • Bet 10 (client-first): a CLI-only change.

  • Bet 0: untouched. No RPC, wire or Store change.
  • Stable promise: additive only.

    Evidence

    a_retry_redial_that_reaches_another_machine_moves_only_that_client
      entry confirmed as a; endpoint now answers as b
      a clone redials (and a clone whose last redial failed, entry forgotten) → it reaches b
      the original client still reaches a's daemon                           before ✗ (moved to b)  after ✓
    leave_lost_to_a_daemon_restart_is_resent                                   ✓ (still follows the reset Machine)
    

    The cluster::, connect::, deploy:: and setup tests (428) pass, and cargo clippy -p ployz --all-targets is clean. I didn't do an Incus run: reproducing this needs an endpoint that a different Machine takes over between retries, and the test drives exactly that.

    Merge Danger

    Door: two-way.

    Blast Radius: narrow. Only a retry whose endpoint now answers as another Machine changes: its clones stay where they were.

    Diff: 302 lines (+226 / -76) across 3 files Reviewer: nick-potts Review duration: 90m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.40) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 302 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: 100% · Reviewer familiarity: 35%
    56%
    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.342
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3146"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 40.1% (MEDIUM) · Higher = larger blast radius
    40.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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 17.3% · Safe to merge
    17.3%
    Repository