(ctx context.Context, executor *StreamingToolExecutor, req skills.SkillShellPermissionRequest)
| 900 | } |
| 901 | } |
| 902 | if IsFatalAPIError(msg) { |
| 903 | e.rememberAPIError(state, msg) |
| 904 | ev := NewStreamEvent("error", msg, metadata) |
| 905 | e.LastState = state |
| 906 | return StreamAction{Return: true, Event: &ev, ConsecutiveAPIErrors: consecutiveAPIErrors} |
| 907 | } |
| 908 | if IsPTLErrorMessage(msg) && !IsFatalAPIError(msg) { |
| 909 | turn.PTLDetected = true |
| 910 | turn.PTLErrorMsg = msg |
| 911 | return StreamAction{Break: true, ConsecutiveAPIErrors: consecutiveAPIErrors} |
| 912 | } |
| 913 | turn.StreamHadError = true |
| 914 | consecutiveAPIErrors++ |
| 915 | if ShouldCommitFinalTextAfterStreamError(turn) { |
| 916 | return StreamAction{Break: true, ConsecutiveAPIErrors: consecutiveAPIErrors} |
| 917 | } |
| 918 | e.rememberAPIError(state, msg) |
| 919 | ev := NewStreamEvent("error", msg, metadata) |
| 920 | if consecutiveAPIErrors >= MaxAPIErrorRetries { |
| 921 | e.LastState = state |
| 922 | return StreamAction{Return: true, Event: &ev, ConsecutiveAPIErrors: consecutiveAPIErrors} |
| 923 | } |
| 924 | metadata["recovered"] = true |
| 925 | ev.Metadata = metadata |
| 926 | return StreamAction{Break: true, Event: &ev, ConsecutiveAPIErrors: consecutiveAPIErrors} |
| 927 | } |
| 928 | return StreamAction{ConsecutiveAPIErrors: consecutiveAPIErrors} |
| 929 | } |
| 930 | |
| 931 | func (e *CoreExecutionEngine) executeAndCommitTools(ctx context.Context, state *AgentState, executor *StreamingToolExecutor, out chan<- StreamEvent) { |
| 932 | var toolResults []map[string]any |
| 933 | for executor.HasPendingWork() { |
| 934 | for _, event := range e.drainSkillPermissionEvents() { |
| 935 | sendStream(ctx, out, event) |
| 936 | } |
| 937 | for _, progress := range executor.DrainProgress() { |
| 938 | sendStream(ctx, out, BuildProgressEvent(progress)) |
no test coverage detected