← Back to Pull requests

fix!(portfolio-contract): SimpleRebalance rejects offers that give or want funds #12960

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

refs: AGO-1678

Description

The SimpleRebalance continuing invitation uses the same proposal shape as the legacy Rebalance invitation, which accepts give: { Deposit } or want: { Cash }. But its handler always starts a rebalance flow with no amount, so the planner plans a rebalance:

  • a deposit was escrowed, then refunded without being deposited;

  • a withdrawal completed without paying out.
  • #12955 made the legacy Rebalance handler reject these proposals. That handler forwards to simpleRebalanceHandler, so this PR moves the check there. Both invitations now reject an offer that gives or wants funds, and the error points to Deposit / Withdraw. The check stays in the handler rather than the proposal shape because invitations made before an upgrade keep their old shape.

    Security Considerations

    None.

    Scaling Considerations

    None.

    Documentation Considerations

    A SimpleRebalance offer that gives or wants funds is now rejected instead of ignoring them. ymax-web always sends SimpleRebalance with empty give and want, so it isn't affected.

    Testing Considerations

    The contract test that Rebalance rejects funded offers now covers SimpleRebalance too. An exo unit test that called simpleRebalanceHandler with a bare {} seat now uses a stub seat with an empty proposal.

    Upgrade Considerations

    Ships with the next ymax contract upgrade.

    🤖 Generated with Claude Code

    Diff: 183 lines (+137 / -46) across 2 files Reviewer: gibson042 Review duration: 978m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.36) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 183 lines diff across 2 files
    0.36
    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.312
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #12960"
    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: 35.6% (MEDIUM) · Higher = larger blast radius
    35.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: 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: 15.4% · Safe to merge
    15.4%