feat: support long text and safe attachment batches
Build web service image / build (push) Successful in 1m15s

This commit is contained in:
2026-09-30 09:16:36 +08:00
parent a977902b25
commit edba7d0d38
26 changed files with 720 additions and 82 deletions
+26 -3
View File
@@ -31,6 +31,9 @@ public sealed record LocalRemoteTaskRecord
[JsonPropertyName("reported")]
public bool Reported { get; init; }
[JsonPropertyName("resultReportErrorCode")]
public string? ResultReportErrorCode { get; init; }
[JsonPropertyName("updatedAt")]
public DateTimeOffset UpdatedAt { get; init; }
}
@@ -136,6 +139,7 @@ public sealed class RemoteTaskLedger
Result = scopes.Length == 0 ? result with { Content = null } : result,
ReportingScopes = scopes,
Reported = false,
ResultReportErrorCode = null,
UpdatedAt = DateTimeOffset.UtcNow
};
SaveLocked();
@@ -147,7 +151,7 @@ public sealed class RemoteTaskLedger
lock (_gate)
{
return _records.Values
.Where(record => !record.Reported && record.Result is not null)
.Where(record => !record.Reported && record.Result is not null && record.ResultReportErrorCode is null)
.Select(record => record.Result!)
.ToArray();
}
@@ -158,19 +162,37 @@ public sealed class RemoteTaskLedger
lock (_gate)
{
return _records.Values
.Where(record => !record.Reported && record.Result is not null)
.Where(record => !record.Reported && record.Result is not null && record.ResultReportErrorCode is null)
.Select(record => new UnreportedRemoteTask(record.Result!, record.ReportingScopes))
.ToArray();
}
}
public int UnreportableResultCount()
{
lock (_gate)
return _records.Values.Count(record => !record.Reported && record.Result is not null && record.ResultReportErrorCode is not null);
}
public void MarkReported(string taskId)
{
lock (_gate)
{
if (_records.TryGetValue(taskId, out var existing) && existing.Result is not null)
{
_records[taskId] = existing with { Reported = true, UpdatedAt = DateTimeOffset.UtcNow };
_records[taskId] = existing with { Reported = true, ResultReportErrorCode = null, UpdatedAt = DateTimeOffset.UtcNow };
SaveLocked();
}
}
}
public void MarkResultTaskNotFound(string taskId)
{
lock (_gate)
{
if (_records.TryGetValue(taskId, out var existing) && existing.Result is not null && !existing.Reported)
{
_records[taskId] = existing with { ResultReportErrorCode = "TaskNotFound", UpdatedAt = DateTimeOffset.UtcNow };
SaveLocked();
}
}
@@ -190,6 +212,7 @@ public sealed class RemoteTaskLedger
Result = new RemoteTaskResult(pair.Value.TaskId, pair.Value.AccountId, pair.Value.LeaseGeneration,
RemoteTaskStatus.ResultUnconfirmed, "AgentRestartedWithIncompleteTask", "Execution was not replayed.", true, null, Guid.NewGuid().ToString("N")),
Reported = false,
ResultReportErrorCode = null,
UpdatedAt = DateTimeOffset.UtcNow
};
changed = true;