{
 "number": 36642,
 "input_hash": "38d4597238092a20",
 "model": "ledger",
 "prompt_hash": null,
 "created": "2026-11-02T01:12:05+00:00",
 "result": {
  "summary": "Reset the request ID and JSON-RPC version fields at the start of JSONRPCRequest::parse. This ensures malformed non-object elements in a batch request do not inherit the ID and version of the preceding element when generating error replies.",
  "problem": "When processing a JSON-RPC batch, the server reuses a single JSONRPCRequest object across all items. If an element is not a JSON object, parse() throws an error before resetting the ID and version, causing the error response to reuse the previous element's ID or omit the error entirely if the previous element was a JSON-RPC 2.0 notification.",
  "card": "Reset request ID and JSON-RPC version fields at the beginning of request parsing rather than after validating object types. In a JSON-RPC batch, a malformed non-object element throws before resetting those fields on the reused request structure, causing the error reply to reuse the previous element's ID or suppress the error if the previous element was a notification. The author provides a new test in interface_rpc.py demonstrating the bug and verifying the fix.",
  "evidence": [
   "The author demonstrates that a batch like [{\"jsonrpc\":\"2.0\",\"method\":\"getblockcount\",\"id\":\"X\"}, 2] generates two reply objects with id 'X' (one result and one error), and provides a new test case in test/functional/interface_rpc.py that fails on master and passes with this change (PR description)"
  ],
  "scope_notes": "",
  "changed_since_previous": "None; the previous description was created without the diff, and the diff matches the previous description.",
  "thread": {
   "last_event_at": "2026-11-01T18:41:36Z",
   "events": 5,
   "head_sha": "2ab7c47f6036cec706e6a0df58905aa3eeb1d843",
   "schema_floor": 2,
   "schema": 2
  },
  "waiting_on": [
   {
    "at": "2026-11-01",
    "id": "c:6562230978",
    "on": "reviewer",
    "url": "https://github.com/bitcoin/bitcoin/pull/36642#issuecomment-6562230978",
    "what": "re-review of updated commit 2ab7c47f60 from AndreaDiazCorreia and pinheadmz"
   }
  ],
  "risk": {
   "level": "medium",
   "touches": [
    "rpc_api",
    "tests"
   ],
   "why": "A mistake in RPC request state handling could misformat or drop batch responses, confusing RPC clients."
  },
  "discussion": {
   "author_status": "last statement processed 2026-11-01",
   "open_concerns": [],
   "resolved_concerns": [
    "AndreaDiazCorreia: remove the redundant m_json_version reset before the jsonrpc check (fixed by fametrano 2026-11-01)",
    "pinheadmz: remove the copy of the reset statement on line 221 (fixed by fametrano 2026-11-01)",
    "pinheadmz: simplify functional test assertions by verifying response correctness and distinct IDs (fixed by fametrano 2026-11-01)"
   ]
  },
  "reviewability": {
   "state": "Ready",
   "label": "Ready",
   "reason": "Nothing known that would invalidate a review now."
  },
  "agreement": {
   "state": "Strong",
   "summary": "Strong: substantive support, no open objection (pinheadmz)",
   "reason": "fametrano addressed all three suggestions by removing the redundant version reset and simplifying functional test assertions in push 2ab7c47f60.",
   "evidence": [
    "AndreaDiazCorreia: ACK \u2014 Reviewed and tested, looks good to me.",
    "pinheadmz: Concept ACK \u2014 This is a reasonable follow up to #27101 and fixes something we missed from the jsonrpc 2.0 spec that could confuse consumers of the interface expecting unique IDs in batch responses."
   ],
   "objections": [
    {
     "reviewer": "AndreaDiazCorreia",
     "association": "NONE",
     "type": "suggestion",
     "kind": "maintenance",
     "harm": "",
     "request": "remove the redundant m_json_version reset before the jsonrpc check",
     "question": "",
     "text": "remove the redundant m_json_version reset before the jsonrpc check",
     "clears_with": "answer",
     "blocking": false,
     "status": "fixed",
     "status_note": "removed redundant reset in push 2ab7c47f60",
     "cleared": true,
     "author_replied": true,
     "others_replied": false,
     "fix_pushed": true,
     "replies": [
      "c:6562230978"
     ],
     "evidence": "2026-10-26: 'the existing m_json_version reset before the jsonrpc check is now redundant and could be removed'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36642#pullrequestreview-5646637313",
     "id": "r:5646637313",
     "at": "2026-10-26",
     "status_at": "2026-11-01",
     "status_by": "fametrano",
     "resolution_evidence": "2026-11-01: fametrano: 'I removed the second `m_json_version` reset'",
     "pin": null,
     "from_schema": 2
    },
    {
     "reviewer": "pinheadmz",
     "association": "MEMBER",
     "type": "suggestion",
     "kind": "maintenance",
     "harm": "",
     "request": "remove the copy of the reset statement on line 221",
     "question": "",
     "text": "remove the copy of the reset statement on line 221",
     "clears_with": "answer",
     "blocking": false,
     "status": "fixed",
     "status_note": "removed duplicate reset in push 2ab7c47f60",
     "cleared": true,
     "author_replied": true,
     "others_replied": false,
     "fix_pushed": true,
     "replies": [
      "c:6562230978"
     ],
     "evidence": "2026-10-26: 'remove the copy of this statement on line 221?'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36642#discussion_r4381855545",
     "id": "rc:4381855545",
     "at": "2026-10-26",
     "status_at": "2026-11-01",
     "status_by": "fametrano",
     "resolution_evidence": "2026-11-01: fametrano: 'I removed the second `m_json_version` reset'",
     "pin": null,
     "from_schema": 2
    },
    {
     "reviewer": "pinheadmz",
     "association": "MEMBER",
     "type": "suggestion",
     "kind": "approach",
     "harm": "",
     "request": "simplify functional test assertions by verifying response correctness and distinct IDs",
     "question": "",
     "text": "simplify functional test assertions by verifying response correctness and distinct IDs",
     "clears_with": "answer",
     "blocking": false,
     "status": "fixed",
     "status_note": "simplified test assertions in push 2ab7c47f60",
     "cleared": true,
     "author_replied": true,
     "others_replied": false,
     "fix_pushed": true,
     "replies": [
      "c:6562230978"
     ],
     "evidence": "2026-10-26: 'what if you just assert the response to the valid request is correct and the second response exists, and doesn't have the same id?'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36642#discussion_r4381879933",
     "id": "rc:4381879933",
     "at": "2026-10-26",
     "status_at": "2026-11-01",
     "status_by": "fametrano",
     "resolution_evidence": "2026-11-01: fametrano: 'simplified the test's asserts'",
     "pin": null,
     "from_schema": 2
    }
   ],
   "support": [
    {
     "reviewer": "AndreaDiazCorreia",
     "reason": "Reviewed and tested, looks good to me.",
     "substantive": false,
     "verdict": "ACK",
     "id": "r:5646637313",
     "url": "https://github.com/bitcoin/bitcoin/pull/36642#pullrequestreview-5646637313",
     "at": "2026-10-26",
     "association": "NONE",
     "evidence": "both",
     "areas": []
    },
    {
     "reviewer": "pinheadmz",
     "reason": "This is a reasonable follow up to #27101 and fixes something we missed from the jsonrpc 2.0 spec that could confuse consumers of the interface expecting unique IDs in batch responses.",
     "substantive": true,
     "verdict": "Concept ACK",
     "id": "r:5658199014",
     "url": "https://github.com/bitcoin/bitcoin/pull/36642#pullrequestreview-5658199014",
     "at": "2026-10-26",
     "association": "MEMBER",
     "evidence": "read",
     "areas": []
    }
   ],
   "participants": [
    {
     "login": "AndreaDiazCorreia",
     "stance": "support",
     "note": "ACKed after testing, suggested removing redundant m_json_version reset",
     "association": "NONE",
     "comments": 1,
     "first": "2026-10-26",
     "last": "2026-10-26"
    },
    {
     "login": "pinheadmz",
     "stance": "support",
     "note": "Concept ACKed, suggested removing duplicate reset and simplifying test assertions",
     "association": "MEMBER",
     "comments": 3,
     "first": "2026-10-26",
     "last": "2026-10-26"
    }
   ],
   "derivation": "substantive support, no open objection (pinheadmz)",
   "model_state": null,
   "corrections": [],
   "notes": "fametrano addressed all three suggestions by removing the redundant version reset and simplifying functional test assertions in push 2ab7c47f60."
  },
  "dependencies": {
   "depends_on": [],
   "enables": []
  },
  "categories": [
   {
    "name": "rpc",
    "member": true,
    "evidence": "Matches the RPC/REST/ZMQ area label and updates JSON-RPC request parsing in src/rpc/request.cpp.",
    "band": "P3",
    "reason_tag": "bug fix",
    "score": 0.4,
    "factors": {
     "bug_severity": 1,
     "leverage": 0,
     "performance": 0,
     "security_stability": 0,
     "user_value": 1
    },
    "rationale": "Fixes an RPC batch error-handling bug where malformed elements can reuse the previous request's ID or omit errors entirely. In src/rpc/request.cpp, parse() reuses state across batch items, causing malformed non-object items to inherit the preceding item's ID or notification status (PR description, pinheadmz review). While fixing spec compliance for returned batch responses, this only affects malformed batch payloads and is reasonably deferrable."
   }
  ],
  "confidence": "high",
  "uncertainties": [],
  "needs": []
 },
 "cost_usd": 0.0,
 "source": {
  "record": "2026-11-02T01:12:05+00:00",
  "code": "2026-10-26T01:25:11+00:00",
  "judgments": 1
 }
}