Fix MCP gating on openai#55
Conversation
Greptile SummaryThis PR fixes a 400 error from OpenAI's Responses API where a reconstructed
Confidence Score: 5/5Safe to merge — the change is a targeted, well-tested fix for the OpenAI 400 on replayed function calls. The logic is narrow and correct: function_call_item_id covers all three meaningful call_id shapes, the unit test exercises each branch, and the integration test verifies the id/call_id split end-to-end. No existing behavior changes for non-OpenAI providers since they ignore the item id. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant Hadrian
participant DB as Approvals DB
participant OpenAI
Client->>Hadrian: POST /responses (mcp_approval_response, approve: true/false)
Hadrian->>DB: "take_by_id_and_org (claim & delete row)"
DB-->>Hadrian: "McpPendingApproval { call_id: "call_abc123", ... }"
Note over Hadrian: function_call_item_id("call_abc123") → "fc_abc123"
Hadrian->>Hadrian: "Build FunctionToolCall { id: "fc_abc123", call_id: "call_abc123" }"
Hadrian->>Hadrian: "Build FunctionCallOutput { call_id: "call_abc123" }"
Hadrian->>OpenAI: "Replay input [ function_call(id="fc_abc123"), function_call_output(call_id="call_abc123") ]"
OpenAI-->>Hadrian: 200 OK (id starts with fc_ ✓)
Hadrian-->>Client: Response
Reviews (3): Last reviewed commit: "Review fixes" | Re-trigger Greptile |
No description provided.