From 5fdce4a8052eed5f00e3bd849587906a350b0ee2 Mon Sep 17 00:00:00 2001 From: sam Date: Fri, 16 Oct 2026 13:43:42 +0800 Subject: [PATCH] feat(core): enable turn auto retries by default (3) --- docs/configuration.md | 2 +- docs/zh/configuration.md | 4 ++-- services/core/internal/execution/turn_retry.go | 3 +++ services/core/internal/processconfig/config.go | 4 ++-- services/core/internal/processconfig/config_test.go | 7 +++++-- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 06d7649c3..98251f93f 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -53,7 +53,7 @@ Model providers are not process settings; see [Default models](#default-models). | `OAC_EXECUTION_CONCURRENCY` | `4` | Concurrent execution work, from 1 to 1024 | | `OAC_SANDBOX_MAX_ACTIVE` | `100` | Active sandbox limit for direct Providers with suspension, from 1 to 100000. Independent of execution concurrency and node capacity | | `OAC_SANDBOX_MAX_RETAINED` | `400` | Retained sandbox limit for direct Providers, from 1 to 100000, including active, suspended and unconfirmed cleanup. Must be at least the active limit | -| `OAC_TURN_AUTO_RETRIES` | `0` | Automatic retries of a Turn that failed on a recoverable model or tool error, from 0 to 5. `0` turns it off | +| `OAC_TURN_AUTO_RETRIES` | `3` | Automatic retries of a Turn that failed on a recoverable model or tool error, from 0 to 5. `0` turns it off | | `OAC_DEFAULT_HARNESS` | `codex` | Harness used when a request does not name one | | `OAC_HARNESSES` | Every registered Harness | Comma-separated Harnesses to enable besides the default one. Unknown names stop startup | | `OAC_WRITE_AUDIT_RETENTION` | `2160h` | Minimum `1h` | diff --git a/docs/zh/configuration.md b/docs/zh/configuration.md index cca22759c..bc269449b 100644 --- a/docs/zh/configuration.md +++ b/docs/zh/configuration.md @@ -1,7 +1,7 @@ --- title: "配置参考" source: docs/configuration.md -source_hash: 9b3a2b1e7dcc2e742b252ebd700a088be56416ee0a293e78a79730df026b3576 +source_hash: e62a7ce6fb3c56f6522cb3444c8c5391a872ae12895122aca4cbf299e96f2c15 --- Core 安装的每项设置都恰好只有一个归属位置,分属以下三类: @@ -57,7 +57,7 @@ Core 安装的每项设置都恰好只有一个归属位置,分属以下三类 | `OAC_EXECUTION_CONCURRENCY` | `4` | Concurrent execution work, from 1 to 1024 | | `OAC_SANDBOX_MAX_ACTIVE` | `100` | 启用暂停能力的直接 Provider 的活跃沙箱上限,范围 1–100000;独立于执行并发度和节点容量 | | `OAC_SANDBOX_MAX_RETAINED` | `400` | 直接 Provider 的保留沙箱上限,范围 1–100000,包括活跃、已暂停以及尚未确认清理完成的分配;必须不小于活跃上限 | -| `OAC_TURN_AUTO_RETRIES` | `0` | Turn 因可恢复的模型或工具错误失败后的自动重试次数,0 到 5。`0` 表示关闭 | +| `OAC_TURN_AUTO_RETRIES` | `3` | Turn 因可恢复的模型或工具错误失败后的自动重试次数,0 到 5。设为 `0` 关闭 | | `OAC_DEFAULT_HARNESS` | `codex` | Harness used when a request does not name one | | `OAC_HARNESSES` | Every registered Harness | Comma-separated Harnesses to enable besides the default one. Unknown names stop startup | | `OAC_WRITE_AUDIT_RETENTION` | `2160h` | Minimum `1h` | diff --git a/services/core/internal/execution/turn_retry.go b/services/core/internal/execution/turn_retry.go index dbc00005f..f51dacc9c 100644 --- a/services/core/internal/execution/turn_retry.go +++ b/services/core/internal/execution/turn_retry.go @@ -11,6 +11,9 @@ import ( "github.com/MiniMax-AI/OpenAgentCore/services/core/internal/sessions" ) +// DefaultTurnAutoRetries is the OAC_TURN_AUTO_RETRIES value used when it is unset or empty. +const DefaultTurnAutoRetries = 3 + // MaxTurnAutoRetries bounds OAC_TURN_AUTO_RETRIES; zero turns the feature off. const MaxTurnAutoRetries = 5 diff --git a/services/core/internal/processconfig/config.go b/services/core/internal/processconfig/config.go index 2dcf27a91..c0f7b8e08 100644 --- a/services/core/internal/processconfig/config.go +++ b/services/core/internal/processconfig/config.go @@ -180,7 +180,7 @@ func (c Config) Settings() []api.InstallationSetting { setting("OAC_LOG_FORMAT", format, "auto", []api.InstallationService{api.InstallationCore, api.InstallationWeb}), setting("OAC_LOG_ADD_SOURCE", c.Log.AddSource, false, []api.InstallationService{api.InstallationCore, api.InstallationWeb}), setting("OAC_EXECUTION_CONCURRENCY", c.ExecutionConcurrency, execution.DefaultExecutionConcurrency, []api.InstallationService{api.InstallationCore}), - setting("OAC_TURN_AUTO_RETRIES", c.TurnAutoRetries, 0, []api.InstallationService{api.InstallationCore}), + setting("OAC_TURN_AUTO_RETRIES", c.TurnAutoRetries, execution.DefaultTurnAutoRetries, []api.InstallationService{api.InstallationCore}), setting("OAC_HARNESSES", c.Harnesses, (engine.Catalog{}).Kinds(), []api.InstallationService{api.InstallationCore}), setting("OAC_DEFAULT_HARNESS", c.DefaultHarness, defaultHarness, []api.InstallationService{api.InstallationCore}), setting("OAC_WRITE_AUDIT_RETENTION", duration(c.WriteAuditRetention), duration(defaultWriteAuditRetention), []api.InstallationService{api.InstallationCore}), @@ -279,7 +279,7 @@ func executionConcurrency() (int, error) { func turnAutoRetries() (int, error) { value := os.Getenv("OAC_TURN_AUTO_RETRIES") if value == "" { - return 0, nil + return execution.DefaultTurnAutoRetries, nil } limit, err := strconv.Atoi(value) if err != nil || limit < 0 || limit > execution.MaxTurnAutoRetries { diff --git a/services/core/internal/processconfig/config_test.go b/services/core/internal/processconfig/config_test.go index c745f3bb8..531a18544 100644 --- a/services/core/internal/processconfig/config_test.go +++ b/services/core/internal/processconfig/config_test.go @@ -223,6 +223,9 @@ func TestSettingsReportEffectiveValuesAndHideHistory(t *testing.T) { if setting.Key == "OAC_WRITE_AUDIT_RETENTION" && setting.Default != "2160h" { t.Fatal(setting.Default) } + if setting.Key == "OAC_TURN_AUTO_RETRIES" && setting.Default != 3 { + t.Fatal(setting.Default) + } if setting.Key == "OAC_HISTORY_SETTINGS_FILE" && (setting.Configured == nil || !*setting.Configured) { t.Fatal("history file was not reported as configured") } @@ -234,10 +237,10 @@ func TestSettingsReportEffectiveValuesAndHideHistory(t *testing.T) { func TestTurnAutoRetries(t *testing.T) { required(t) - if c, err := Load(); err != nil || c.TurnAutoRetries != 0 { + if c, err := Load(); err != nil || c.TurnAutoRetries != 3 { t.Fatal(c.TurnAutoRetries, err) } - for value, want := range map[string]int{"0": 0, "3": 3, "5": 5} { + for value, want := range map[string]int{"": 3, "0": 0, "3": 3, "5": 5} { t.Setenv("OAC_TURN_AUTO_RETRIES", value) if c, err := Load(); err != nil || c.TurnAutoRetries != want { t.Fatal(value, c.TurnAutoRetries, err)