feat(agent): 云端 Agent 运行时 - 完善 Pi 桥接、上下文压力与临时故障重试

This commit is contained in:
ddcat666 committed 2026-10-04 02:20:30 +08:00
1 parent 0030f4da9b
commit 76ca0fd247
32 files changed
+1663 -1485

No files matched your search

@@ -27,7 +27,8 @@ func cloudAgentRetryReceipt(groupID string, attempt int, status string) map[stri
}
// Count per tool, not per model step: intervening reads must not reset a failed
// write's allowance. Only explicitly typed, pre-execution errors are repairable.
// write's allowance. Only explicitly typed argument errors and safe, pre-submission
// transient admission errors are repairable.
func cloudAgentTrackToolRepair(runID string, state *cloudAgentRuntime, call cloudAgentCall, result any, err error, payload map[string]any) bool {
previous, exists := state.ToolRepairs[call.Function.Name]
if err == nil {
@@ -39,7 +40,10 @@ func cloudAgentTrackToolRepair(runID string, state *cloudAgentRuntime, call clou
}
detail, _ := result.(map[string]any)
var argumentErr *cloudAgentArgumentError
if !errors.As(err, &argumentErr) || detail["taskSubmitted"] == true || detail["phase"] == "completion" {
argumentRepairable := errors.As(err, &argumentErr)
var admissionErr *cloudAgentMediaAdmissionError
admissionRepairable := errors.As(err, &admissionErr) && admissionErr.Retryable && detail["phase"] == "admission" && detail["taskSubmitted"] != true
if (!argumentRepairable && !admissionRepairable) || detail["taskSubmitted"] == true || detail["phase"] == "completion" {
return false
}
if state.ToolRepairs == nil {