Skip to content

Commit b5be6d3

Browse files
committed
Mark truncated batch queries as partial failures (#1472 #1616)
1 parent c332d84 commit b5be6d3

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/CodeIndex/Mcp/McpToolHandlers.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2452,7 +2452,7 @@ void AppendRateLimitedSlot(int requestIndex, string? toolName, JsonNode? toolArg
24522452
["total_count"] = queries.Count,
24532453
["success_count"] = successCount,
24542454
["failure_count"] = failureCount,
2455-
["partial_failure"] = failureCount > 0,
2455+
["partial_failure"] = failureCount > 0 || cascadeStartedAtIndex.HasValue,
24562456
["failure_scope"] = GetBatchFailureScope(queries.Count, successCount, failureCount, cascadeStartedAtIndex),
24572457
["cascade_started_at_index"] = cascadeStartedAtIndex,
24582458
["metadata"] = new JsonObject
@@ -2539,7 +2539,7 @@ private int EstimateBatchResponseBytes(JsonNode? id, string summary, int submitt
25392539
["total_count"] = submittedCount,
25402540
["success_count"] = successCount,
25412541
["failure_count"] = failureCount,
2542-
["partial_failure"] = failureCount > 0,
2542+
["partial_failure"] = failureCount > 0 || cascadeStartedAtIndex.HasValue,
25432543
["failure_scope"] = failureScope,
25442544
["cascade_started_at_index"] = cascadeStartedAtIndex,
25452545
["metadata"] = new JsonObject

tests/CodeIndex.Tests/McpServerTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6468,6 +6468,7 @@ public void ToolsCall_BatchQuery_TruncatesAggregateResponse_Issue1416()
64686468
Assert.Equal(0, structured["metadata"]!["errors"]!.GetValue<int>());
64696469
Assert.Equal("cascading", structured["failure_scope"]!.GetValue<string>());
64706470
Assert.NotNull(structured["cascade_started_at_index"]);
6471+
Assert.True(structured["partial_failure"]!.GetValue<bool>());
64716472

64726473
var truncatedQueries = structured["truncated_queries"]!.AsArray();
64736474
Assert.NotEmpty(truncatedQueries);

0 commit comments

Comments
 (0)