Skip to content

Commit f02845e

Browse files
authored
fix(config): expose cua idle timeout in dashboard (#8075)
* fix(config): expose cua idle timeout in dashboard * fix(config): remove exposed cua ttl setting * fix(config): centralize cua idle timeout default
1 parent 49cd4d2 commit f02845e

6 files changed

Lines changed: 18 additions & 17 deletions

File tree

astrbot/core/computer/booters/cua_defaults.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"image": "linux",
33
"os_type": "linux",
44
"ttl": 3600,
5+
"idle_timeout": 0,
56
"telemetry_enabled": False,
67
"local": True,
78
"api_key": "",

astrbot/core/config/default.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@
178178
"shipyard_neo_ttl": 3600,
179179
"cua_image": CUA_DEFAULT_CONFIG["image"],
180180
"cua_os_type": CUA_DEFAULT_CONFIG["os_type"],
181-
"cua_ttl": CUA_DEFAULT_CONFIG["ttl"],
182-
"cua_idle_timeout": 0,
181+
"cua_idle_timeout": CUA_DEFAULT_CONFIG["idle_timeout"],
183182
"cua_telemetry_enabled": CUA_DEFAULT_CONFIG["telemetry_enabled"],
184183
"cua_local": CUA_DEFAULT_CONFIG["local"],
185184
"cua_api_key": CUA_DEFAULT_CONFIG["api_key"],
@@ -3348,10 +3347,10 @@
33483347
"provider_settings.sandbox.booter": "cua",
33493348
},
33503349
},
3351-
"provider_settings.sandbox.cua_ttl": {
3352-
"description": "CUA Sandbox TTL",
3350+
"provider_settings.sandbox.cua_idle_timeout": {
3351+
"description": "CUA Idle Timeout",
33533352
"type": "int",
3354-
"hint": "CUA 沙箱生存时间(秒)。当前作为会话配置保存,具体生效取决于 CUA SDK。",
3353+
"hint": "Idle timeout for CUA sandbox sessions in seconds. When greater than 0, AstrBot proactively shuts down an idle CUA sandbox after that amount of inactivity; 0 disables it.",
33553354
"condition": {
33563355
"provider_settings.computer_use_runtime": "sandbox",
33573356
"provider_settings.sandbox.booter": "cua",

dashboard/src/i18n/locales/en-US/features/config-metadata.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@
194194
"description": "CUA OS Type",
195195
"hint": "CUA sandbox operating system type. Defaults to linux."
196196
},
197-
"cua_ttl": {
198-
"description": "CUA Sandbox TTL",
199-
"hint": "CUA sandbox time-to-live in seconds. Actual behavior depends on the installed CUA SDK."
197+
"cua_idle_timeout": {
198+
"description": "CUA Idle Timeout",
199+
"hint": "Idle timeout for CUA sandbox sessions in seconds. When greater than 0, AstrBot proactively shuts down an idle CUA sandbox after that amount of inactivity; 0 disables it."
200200
},
201201
"cua_telemetry_enabled": {
202202
"description": "CUA Telemetry",

dashboard/src/i18n/locales/ru-RU/features/config-metadata.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@
194194
"description": "Тип ОС CUA",
195195
"hint": "Тип операционной системы песочницы CUA. По умолчанию linux."
196196
},
197-
"cua_ttl": {
198-
"description": "TTL песочницы CUA",
199-
"hint": "Время жизни песочницы CUA в секундах. Фактическое поведение зависит от установленного CUA SDK."
197+
"cua_idle_timeout": {
198+
"description": "Таймаут простоя CUA",
199+
"hint": "Таймаут простоя сессии песочницы CUA в секундах. Если значение больше 0, AstrBot автоматически завершит неактивную песочницу CUA после указанного времени бездействия; 0 отключает автоочистку."
200200
},
201201
"cua_telemetry_enabled": {
202202
"description": "Телеметрия CUA",

dashboard/src/i18n/locales/zh-CN/features/config-metadata.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@
196196
"description": "CUA 操作系统类型",
197197
"hint": "CUA 沙箱操作系统类型,默认 linux。"
198198
},
199-
"cua_ttl": {
200-
"description": "CUA Sandbox 存活时间(秒)",
201-
"hint": "CUA 沙箱生存时间(秒)。当前作为会话配置保存,具体生效取决于 CUA SDK"
199+
"cua_idle_timeout": {
200+
"description": "CUA 空闲超时(秒)",
201+
"hint": "CUA 沙箱空闲超时时间(秒)。大于 0 时,AstrBot 会在会话空闲达到该时长后主动关闭 CUA 沙箱;0 表示禁用"
202202
},
203203
"cua_telemetry_enabled": {
204204
"description": "CUA 遥测",

tests/unit/test_cua_computer_use.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ def test_cua_default_config_matches_booter_defaults():
273273
assert booter.api_key == CUA_DEFAULT_CONFIG["api_key"]
274274
assert sandbox_defaults["cua_image"] == CUA_DEFAULT_CONFIG["image"]
275275
assert sandbox_defaults["cua_os_type"] == CUA_DEFAULT_CONFIG["os_type"]
276-
assert sandbox_defaults["cua_ttl"] == CUA_DEFAULT_CONFIG["ttl"]
277-
assert sandbox_defaults["cua_idle_timeout"] == 0
276+
assert "cua_ttl" not in sandbox_defaults
277+
assert sandbox_defaults["cua_idle_timeout"] == CUA_DEFAULT_CONFIG["idle_timeout"]
278278
assert (
279279
sandbox_defaults["cua_telemetry_enabled"]
280280
== CUA_DEFAULT_CONFIG["telemetry_enabled"]
@@ -1383,7 +1383,8 @@ def test_cua_is_exposed_in_sandbox_config_metadata():
13831383
assert "CUA" in booter["labels"]
13841384
assert "provider_settings.sandbox.cua_image" in items
13851385
assert "provider_settings.sandbox.cua_os_type" in items
1386-
assert "provider_settings.sandbox.cua_ttl" in items
1386+
assert "provider_settings.sandbox.cua_ttl" not in items
1387+
assert "provider_settings.sandbox.cua_idle_timeout" in items
13871388
assert "provider_settings.sandbox.cua_telemetry_enabled" in items
13881389
assert "provider_settings.sandbox.cua_local" in items
13891390
assert "provider_settings.sandbox.cua_api_key" in items

0 commit comments

Comments
 (0)