Fix gateway timeout embedded fallback session lock#74543
Conversation
|
Codex review: needs maintainer review before merge. What this changes: The PR changes Maintainer follow-up before merge: This is an open implementation PR paired with #62981; the remaining action is maintainer review, CI validation, and product judgment on fresh-session fallback semantics, not an automated replacement fix lane. Security review: Security review cleared: The diff only changes CLI fallback control flow and unit tests, with no new permissions, dependency sources, secret handling, workflow, package, or downloaded-code execution surface. Review detailsBest possible solution: Land a reviewed variant that prevents an accepted Gateway run which later times out from contending with embedded fallback on the same transcript, with focused regression coverage and clear fallback metadata; if maintainers prefer wait/abort semantics over session forking, adjust that behavior before merge. Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 68912111cfea. |
91457fc to
7e88f46
Compare
|
Landed in fbae2a6. Thanks @HemantSudarshan. Maintainer fixup before landing:
Proof:
I also attempted the Testbox |
* Agent: isolate gateway timeout fallback sessions * fix(cli): isolate gateway timeout fallback sessions --------- Co-authored-by: Peter Steinberger <[email protected]>
* Agent: isolate gateway timeout fallback sessions * fix(cli): isolate gateway timeout fallback sessions --------- Co-authored-by: Peter Steinberger <[email protected]>
* Agent: isolate gateway timeout fallback sessions * fix(cli): isolate gateway timeout fallback sessions --------- Co-authored-by: Peter Steinberger <[email protected]>
* Agent: isolate gateway timeout fallback sessions * fix(cli): isolate gateway timeout fallback sessions --------- Co-authored-by: Peter Steinberger <[email protected]>
* Agent: isolate gateway timeout fallback sessions * fix(cli): isolate gateway timeout fallback sessions --------- Co-authored-by: Peter Steinberger <[email protected]>
Summary
openclaw agenthit the gateway final-response timeout, embedded fallback reused the same session/run id while the gateway could still hold the session lock.session file locked, then cascade through model fallbacks.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
agentCliCommand()reused the original local options after a gateway timeout, so embedded fallback inherited the same session id/run id as the still-running gateway agent path.agentRPC can acknowledge a run and continue working after the CLI-side final response timeout expires.Regression Test Plan (if applicable)
src/commands/agent-via-gateway.test.tsgateway-fallback-*session/run id instead of the locked original values.callGateway()rejects.User-visible / Behavior Changes
Gateway timeout fallback still attempts embedded execution, but the embedded run uses a fresh fallback session/run id to avoid racing the gateway-held session lock.
Diagram (if applicable)
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation: N/ARepro + Verification
Environment
Steps
callGateway()to reject with a typed gateway timeout.agentCliCommand()with an existingsessionIdandrunId.gateway-fallback-*session/run id.Expected
Actual
Evidence
Human Verification (required)
What you personally verified (not just CI), and how:
pnpm test src/commands/agent-via-gateway.test.ts -t "uses a fresh embedded session when gateway agent times out" -- --reporter=verbosepnpm test src/commands/agent-via-gateway.test.ts -- --reporter=verbosepnpm test src/commands/agent-via-gateway.test.ts src/gateway/call.test.ts src/agents/run-wait.test.ts -- --reporter=verbosepnpm check:changedpnpm test:changedsessionIdandrunId.Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations