启动配置错误时保留 resumed session id - #40
Open
smf-h wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
$VISUAL/$EDITOR。AgentManager读取最新 run output,再决定是否清理last_session_id。背景
Hive 当前把任意 resumed run 的非零退出都当作保存的 session id 已损坏。
但 Codex 可能在还没进入交互提示符之前,就因为本地安装或配置问题退出,例如:
Missing optional dependency @openai/codex-win32-x64Cannot open external editorfailed to parse hooks config这些错误不代表之前的 session id 无效。此时清掉
last_session_id,会导致下一次启动不再带--resume,用户看到的结果就像会话上下文丢了,尽管原始 Codex session 文件仍然存在。复现 Demo
配置 worker:
{ "command": "node", "args": ["C:/tmp/fake-codex-startup-failure.mjs"], "resumeArgsTemplate": "--resume {session_id}", "sessionIdCapture": null }先写入
agent_sessions.last_session_id,然后启动 worker。修复前:fake command 退出后,Hive 会清掉保存的 session id。
修复后:Hive 会保留 session id,下一次启动仍然传入
--resume <session_id>。测试
volta run --node 22 --pnpm 10.30.3 pnpm exec tsc -p tsconfig.build.json --noEmitvolta run --node 22 --pnpm 10.30.3 pnpm exec biome check src/server/agent-run-start-context.ts src/server/agent-run-exit-handler.ts src/server/agent-run-starter.ts tests/unit/claude-session-resume-failure.test.tsvolta run --node 22 --pnpm 10.30.3 pnpm exec vitest run tests/unit/claude-session-resume-failure.test.ts --no-file-parallelism --maxWorkers=1关联 Issue:#39