Repository navigation
Conversation
When a node is retried after its sandbox was recreated, .agentflow is re-prepared and the Codex thread's rollout file is gone. The runtime still passes the stored session id and Codex answers thread/resume: thread/resume failed: no rollout found for thread id ... (code -32600) lostCLISession() did not recognise that phrasing, so dropLostCLISession() never fired and the node was parked on a human gate even though its code had already been committed and pushed. Match the Codex phrasings so the node restarts in a fresh session instead.
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.
Problem
When a node is retried after its sandbox was recreated, the workspace's
.agentflow/directory is re-prepared and the Codex thread's rollout file isgone. The runtime still passes the stored session id
(
nr.ResumeSessionID/nr.SessionID,internal/engine/node_execute.go:686-689),so Codex answers:
lostCLISession()only matchedno conversation found,session not found,no such sessionandconversation does not exist, sodropLostCLISession()never fired: the node was parked on
waiting_approvalinstead of restarting ina fresh session.
Reproduction (LoopForge 0.4.0, self-hosted Compose, Codex CLI on an
OpenAI-compatible gateway,
generic-backend-deliverySOP):mrnode; the node commits and pushes the work branch(
origin==HEAD, 12 files changed).signal: killed.no rollout founderror above and therun stays
waiting; the only way forward is to clearrun_nodes.payload.sessionIdby hand.This is a user-visible contradiction: the work is already pushed, but the run
looks broken and needs database surgery to continue. Any restart of the control
plane, or any sandbox reclaim/recreate that re-prepares
.agentflow, hits it.Fix
Recognise the Codex phrasings as lost sessions so the existing recovery path
(
dropLostCLISession→agent.session.dropped→ restart the node with a freshsession) takes over:
plus
TestLostCLISessioncovering every phrasing, including the full Codexmessage, and a negative list (
exit status 1,503, gate REJECT) that mustnot be treated as a lost session.
gofmtclean. Two files, +50/−1.中文摘要
重试被中断的节点时,沙箱重建会把
.agentflow/里的 Codex rollout 清掉,但节点仍带着旧sessionId去resume,Codex 返回code -32600 / no rollout found;lostCLISession()不认这个措辞,导致本该"丢弃会话重新开始"的自动恢复没有触发,节点被挂到人工审批。
本 PR 只扩展匹配列表并补单测,不改其它行为。
Follow-up (separate issues, not in this PR)
internal/runtime/browser.gobuilds the Chromium sidecar with a hard-coded15 * time.Minutetimeout and only on first use. On slow networks the buildis killed every attempt (
docker build browser image: signal: killed) whilepulling ~177 Debian packages. Suggest
AGENTFLOW_BROWSER_BUILD_TIMEOUTandwarming it at startup like
PrebuildIsolatedImage().rm -f style commands are not permitted, which breaks theusual "clean the temp classes dir and recompile" loop for JVM projects; a
documented workaround (e.g. use
mktemp -d) in the agent rules would help.