fix(cli): surface gateway→embedded fallback session divergence in --json output#111645
Merged
Conversation
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Jul 20, 2026
steipete
added a commit
that referenced
this pull request
Jul 21, 2026
…law agent (#112074) A Gateway timeout or closed connection now fails the command with an actionable stderr hint instead of silently re-running the whole turn embedded under a fresh gateway-fallback-* session. The silent fallback could double-execute side effects (the Gateway may still finish an accepted turn), returned context-free answers to --session-key callers, and ran with the CLI host's local config. --local remains the only embedded execution path. Also deletes the resultMetaOverrides plumbing (the fallback was its only writer) and the fallback marker fields added in #111645.
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Jul 22, 2026
…law agent (openclaw#112074) A Gateway timeout or closed connection now fails the command with an actionable stderr hint instead of silently re-running the whole turn embedded under a fresh gateway-fallback-* session. The silent fallback could double-execute side effects (the Gateway may still finish an accepted turn), returned context-free answers to --session-key callers, and ran with the CLI host's local config. --local remains the only embedded execution path. Also deletes the resultMetaOverrides plumbing (the fallback was its only writer) and the fallback marker fields added in openclaw#111645.
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.
What Problem This Solves
When the CLI↔gateway agent websocket drops or times out mid-turn, the CLI falls back to running the agent embedded. To avoid concurrently double-driving the caller's session (the gateway may still be resuming it — the hazard fixed in a428765), the fallback deliberately runs under a fresh
gateway-fallback-<uuid>session rather than the caller's--session-key. That safety behavior is correct, but it was silent: the only signal was a human stderr line, and a--jsoncaller got a different result with a different session and no structured way to detect that continuity was intentionally not preserved.Why This Change Was Made
A script or integration passing
--session-key X --jsonneeds to know, programmatically, when a turn ran under a fallback session instead of the one it asked for. This adds that signal without changing the safety behavior.User Impact
--jsonresults for both fallback reasons (timeout, connection-closed) now carrymeta.fallback: { reason, requestedSessionKey, sessionKey }, so callers can detect the divergence and the original vs actual session key.--session-keyis intentionally still not reused in fallback.Evidence
src/commands/agent-via-gateway.ts:68,1005-1028.src/agents/command/types.ts(fallbackfield); populated insrc/commands/agent-via-gateway.ts.src/commands/agent-via-gateway.test.tsassert the structured marker (requested vs actual key) for both fallback reasons.check:changedexit 0, AutoReview clean (0.91). No behavior change to selection/triggering.