{
 "number": 36284,
 "input_hash": "0df06f17bcdb0d32",
 "model": "openrouter/google/gemini-3.8-flash",
 "batch": false,
 "created": "2026-09-17T16:24:37+00:00",
 "provider": "Google",
 "stop_reason": "end_turn",
 "usage": {
  "input_tokens": 12023,
  "cache_creation_input_tokens": 0,
  "cache_read_input_tokens": 0,
  "output_tokens": 1601
 },
 "cost_usd": 0.015021,
 "error": null,
 "result": {
  "display": {
   "goal": [
    "Prevent spurious insufficient funds errors when using avoidpartialspends or avoid_reuse"
   ],
   "reviewability": [
    "Ready for review, minimal one-line bug fix with functional test"
   ],
   "agreement": [
    "No reviews or comments yet"
   ],
   "categories": [
    {
     "name": "wallet",
     "why": [
      "P3 because it fixes an edge-case transaction creation failure for avoid_reuse users",
      "Prevents discarded ineligible coins from being deducted twice from the available balance"
     ]
    }
   ]
  },
  "summary": "Fixes a bug where output groups ineligible for coin selection are added twice to `ret_discarded_groups` when `-avoidpartialspends` or `-avoid_reuse` is active. Because `AutomaticCoinSelection` deducts discarded groups from the total balance, double counting them could trigger a false insufficient funds error even when sufficient confirmed funds exist. The fix records discards only during the mixed group pass, accompanied by a regression test.",
  "problem": "When `-avoidpartialspends` or `-avoid_reuse` is set, `GroupOutputs` evaluates groups across both mixed and positive-only maps. Outputs that fail eligibility filters (such as hitting mempool ancestor limits) are pushed to `ret_discarded_groups` in both passes, artificially doubling the discarded coin total and potentially causing transaction creation to fail.",
  "discussion": {
   "open_concerns": [],
   "resolved_concerns": [],
   "author_status": "active"
  },
  "reviewability": {
   "state": "Ready",
   "label": "Ready",
   "reason": "The PR is small (+2/-1 in spend.cpp plus a functional test), cleanly isolated, and passes CI."
  },
  "agreement": {
   "state": "Crickets",
   "summary": "No reviews or comments yet",
   "reason": "The PR was recently opened and has not received reviewer engagement yet.",
   "evidence": []
  },
  "dependencies": {
   "depends_on": [],
   "enables": []
  },
  "categories": [
   {
    "name": "wallet",
    "member": true,
    "evidence": "Modifies coin selection output grouping in src/wallet/spend.cpp.",
    "band": "P3",
    "reason_tag": "bug fix",
    "score": 0.45,
    "factors": {
     "security_stability": 0,
     "bug_severity": 2,
     "performance": 0,
     "user_value": 1,
     "leverage": 0
    },
    "rationale": "Fixes a bug where coin selection can fail with a false insufficient funds error when using avoidpartialspends. As author fjahr notes, `AutomaticCoinSelection` 'subtracts it twice and could fail with an insufficient funds error even when there would be enough confirmed coins to cover the payment'. While real, this is an edge case requiring specific wallet flags combined with discarded unconfirmed coins, making it a worthwhile fix rather than a release blocker."
   }
  ],
  "confidence": "high",
  "uncertainties": [],
  "needs": [],
  "card": "Fixes a double-counting bug in output group coin selection under -avoidpartialspends and -avoid_reuse. When output groups are filtered out as ineligible, they were added twice to the discarded list, causing AutomaticCoinSelection to over-subtract and potentially fail with an erroneous insufficient funds error. The patch ensures discarded groups are only recorded once and adds a functional test reproducing the failure. The PR is newly opened and has no reviews yet."
 },
 "raw_text": null
}