fix(shell): separate wait, idle, and runtime limits (#6228)

* fix(shell): separate wait, idle, and runtime limits

* fix(shell): separate wait, idle, and runtime limits

* fix(exec): preserve settings aliases and reclaim completed sessions

* fix(webui): make shell runtime limits explicit
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-16 13:44:15 +08:00
1 parent 70ac000ad9
commit 6310a39bac
36 files changed
+2392 -564

No files matched your search

+34
View File
@@ -69,6 +69,7 @@ def test_runtime_patch_persists_and_preserves_other_domains(tmp_path):
{"agents.defaults.max_concurrent_subagents": 0},
{"agents.defaults.max_tool_iterations": True},
{"tools.exec.timeout": -1},
{"tools.exec.timeout": 86401},
{"tools.exec.timeout": "60"},
{"tools.exec.enable": "false"},
{"tools.exec.allowed_env_keys": "TOKEN"},
@@ -99,6 +100,39 @@ def test_invalid_patch_is_atomic(tmp_path, values):
assert path.read_bytes() == before
@pytest.mark.parametrize("limit", [120, 86400, 172800])
def test_shell_runtime_editor_uses_the_configured_limit(tmp_path, limit):
path = tmp_path / "config.json"
config = Config.model_validate({"tools": {"exec": {"maxRuntimeLimit": limit}}})
save_config(config, path)
before = path.read_bytes()
with pytest.raises(WebUISettingsError, match=f"1–{limit} seconds"):
update_runtime_config_settings({"tools.exec.timeout": limit + 1}, config_path=path)
assert path.read_bytes() == before
payload = update_runtime_config_settings({"tools.exec.timeout": limit}, config_path=path)
assert payload["advanced"]["exec_max_runtime_limit"] == limit
assert payload["runtime_config"]["tools.exec.timeout"] == limit
saved = load_config(path).tools.exec
assert saved.max_runtime == limit
assert saved.max_runtime_limit == limit
def test_other_settings_preserve_a_longer_trusted_shell_runtime(tmp_path):
path = tmp_path / "config.json"
save_config(Config.model_validate({"tools": {"exec": {
"maxRuntime": 172800, "maxRuntimeLimit": 86400,
}}}), path)
update_runtime_config_settings({"tools.exec.path_append": "extra-bin"}, config_path=path)
saved = load_config(path).tools.exec
assert saved.max_runtime == 172800
assert saved.max_runtime_limit == 86400
assert saved.path_append == "extra-bin"
def test_remote_client_cannot_change_install_policy():
config = Config()
with pytest.raises(WebUISettingsError) as error: