fix(mcp): report a Failed task's failureReason instead of a bare status

get_task/batch_get_tasks now return failureReason (max_turns|timeout|error|
cancelled|unknown) plus failureTurnsUsed/failureMaxTurns on a Failed task, so
max_turns (worktree usually fine, continue_task) is distinguishable from a
real error (reset_failed_task) without pulling get_task_log's raw NDJSON.
Classified and stamped onto TaskEntity by TaskRunner.MarkFailed via
TaskStateService.FailAsync; TaskRunEntity also keeps the CLI's raw
terminal_reason/result_subtype/errors for deeper diagnosis. reset_failed_task's
description now warns explicitly that it discards the worktree and points at
continue_task for max_turns. Surfaced on the task card's status-chip tooltip.
This commit is contained in:
mika kuns
2026-08-10 14:20:00 +02:00
parent 6a2a19cc9e
commit a067a7bfff
19 changed files with 1295 additions and 24 deletions
+6
View File
@@ -32,6 +32,12 @@ public sealed class TaskEntity
public string? Result { get; set; }
public string? ReviewFeedback { get; set; }
public int RoadblockCount { get; set; }
// Denormalized from the failing run, same pattern as RoadblockCount, so get_task/
// batch_get_tasks can report why a Failed task stopped without a second query.
// Null on a non-Failed task, or on a Failed task predating this field ("unknown").
public string? FailureReason { get; set; }
public int? FailureTurnsUsed { get; set; }
public int? FailureMaxTurns { get; set; }
public string? LogPath { get; set; }
public required DateTime CreatedAt { get; init; }
public DateTime? StartedAt { get; set; }
@@ -21,6 +21,11 @@ public sealed class TaskRunEntity
public DateTime? StartedAt { get; set; }
public DateTime? FinishedAt { get; set; }
public string? Model { get; set; }
// Raw diagnostics from the CLI's stream-json result event (StreamAnalyzer), kept verbatim
// for get_run/get_task_log — TaskEntity.FailureReason is the classified, MCP-facing summary.
public string? ResultSubtype { get; set; }
public string? TerminalReason { get; set; }
public string? Errors { get; set; }
// Navigation property
public TaskEntity Task { get; set; } = null!;