fix: CLI backend session resume + TUI output#1921
Merged
steipete merged 4 commits intoopenclaw:mainfrom Jan 25, 2026
Merged
Conversation
- Add resumeArgs to DEFAULT_CLAUDE_BACKEND for proper --resume flag usage - Fix gateway not preserving cliSessionIds/claudeCliSessionId in nextEntry - Add test for CLI session ID preservation in gateway agent handler - Update docs with new resumeArgs default
CLI backends (claude-cli etc) don't emit streaming assistant events, causing TUI to show "(no output)" despite correct processing. Now emits assistant event with final text before lifecycle end so server-chat buffer gets populated for WebSocket clients.
769042d to
c1b98ff
Compare
Contributor
rodrigouroz
pushed a commit
to rodrigouroz/openclaw
that referenced
this pull request
Jan 26, 2026
8 tasks
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.
AI-Assisted
Summary
Problem 1: Session Resume
Claude CLI requires different flags for new vs resumed sessions:
--session-id <id>--resume <id>Without proper
resumeArgs, follow-up messages would try to use--session-idwith an existing session ID, causing:Two bugs prevented session continuity:
DEFAULT_CLAUDE_BACKENDhad noresumeArgs, so it always used--session-idagent.tswasn't copyingcliSessionIds/claudeCliSessionIdtonextEntry, so CLI session IDs were lost between requestsProblem 2: TUI "(no output)"
TUI uses WebSocket streaming events. Flow:
evt.stream === "assistant"events → buffer populated → final message has textemitChatFinalsends undefined → TUI shows "(no output)"Changes
Session Resume
src/agents/cli-backends.ts- AddresumeArgsto Claude backendsrc/gateway/server-methods/agent.ts- Preserve CLI session ID fields innextEntrysrc/gateway/server-methods/agent.test.ts- Add regression testTUI Output
src/auto-reply/reply/agent-runner-execution.ts- Emitassistantevent with final text before lifecycleendfor CLI backendsTest plan
pnpm buildpassespnpm lintpassespnpm testpasses (unrelated heartbeat test failures pre-existing)