The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(cron): cover execution identity and sync docs
Andrew Bagrin5cf4ffc6aee0
diff --git a/tests/cron/test_script_claim_heartbeat.py b/tests/cron/test_script_claim_heartbeat.pyindex da393b3ee35..8d81470576c 100644--- a/tests/cron/test_script_claim_heartbeat.py+++ b/tests/cron/test_script_claim_heartbeat.py@@ -369,7 +369,15 @@ def test_lost_fire_claim_stops_stale_delivery(monkeypatch):lost_seen.set()return False- def _run_job(job, *, defer_agent_teardown=None, extra_prompt=None, cancel_event=None):+ def _run_job(+ job,+ *,+ defer_agent_teardown=None,+ extra_prompt=None,+ cancel_event=None,+ execution_id=None,+ ):+ assert execution_id == job["execution_id"]assert lost_seen.wait(timeout=2)return True, "stale output", "stale response", Nonediff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/environment-variables.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/environment-variables.mdindex e4e71b8eb17..c39533eec5b 100644--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/environment-variables.md+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/environment-variables.md@@ -201,7 +201,7 @@ description: "Hermes Agent 使用的所有环境变量完整参考"| `TERMINAL_VERCEL_RUNTIME` | Vercel Sandbox 运行时(`node24`、`node22`、`python3.13`) || `TERMINAL_TIMEOUT` | 命令超时(秒) || `TERMINAL_LIFETIME_SECONDS` | 终端会话最大生命周期(秒) |-| `TERMINAL_CWD` | 终端会话的工作目录(仅 gateway/cron;CLI 使用启动目录) |+| `TERMINAL_CWD` | 已弃用的 gateway/cron 终端会话直接覆盖项。请优先使用 `config.yaml` 中的 `terminal.cwd`;CLI 仍使用启动目录。 || `SUDO_PASSWORD` | 无需交互提示即可使用 sudo |对于云沙箱后端,持久化以文件系统为导向。`TERMINAL_LIFETIME_SECONDS` 控制 Hermes 何时清理空闲终端会话,后续恢复可能会重新创建沙箱而非保持相同的活跃进程。diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/features/cron.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/features/cron.mdindex fb51b436538..e994473bf67 100644--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/features/cron.md+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/features/cron.md@@ -113,12 +113,12 @@ cronjob(设置 `workdir` 后:- 该目录中的 `AGENTS.md`、`CLAUDE.md` 和 `.cursorrules` 会被注入系统 prompt(发现顺序与交互式 CLI 相同)-- `terminal`、`read_file`、`write_file`、`patch`、`search_files` 和 `execute_code` 均以该目录为工作目录(通过 `TERMINAL_CWD`)+- `terminal`、`read_file`、`write_file`、`patch`、`search_files` 和 `execute_code` 均以该目录为工作目录- 路径必须是已存在的绝对目录——相对路径和不存在的目录在创建/更新时会被拒绝- 编辑时传入 `--workdir ""`(或工具中的 `workdir=""`)可清除该设置并恢复原有行为-:::note 串行化-设置了 `workdir` 的任务在调度器 tick 时串行运行,而非在并行池中运行。这是有意为之——`TERMINAL_CWD` 是进程全局变量,两个 workdir 任务同时运行会互相破坏各自的 cwd。无 workdir 的任务仍像以前一样并行运行。+:::note 隔离+每次 agent 运行都会将其 `workdir` 绑定到该次运行的唯一任务标识。设置了 workdir 的任务因此可使用正常的并行池,不会修改进程全局终端状态,也不会在并发运行之间泄漏路径。如需限制 cron 的总并发量,请设置 `cron.max_parallel_jobs`。:::## 在指定 profile 中运行 cron 任务