Skip to content

Commit 81ca7bc

Browse files
obviyusfrankekn
andauthored
fix: keep claude cli sessions warm (#69679)
* feat(cli): keep claude cli sessions warm * test(cli): cover claude live session reuse * fix(cli): harden claude live session reuse * fix(cli): redact mcp session key logs * fix(cli): bound claude live session turns * fix(cli): reuse claude live sessions on resume * refactor(cli): canonicalize claude live argv * fix(cli): preserve claude live resume state * fix(cli): close dead claude live sessions * fix(cli): serialize claude live session creates * fix(cli): count pending claude live sessions * fix(cli): tighten claude live resume abort * fix(cli): reject closed claude live sessions * fix(cli): refresh claude live fingerprints * fix(cli): stabilize MCP resume hash * fix: preserve claude live inline resume (#69679) --------- Co-authored-by: Frank Yang <[email protected]>
1 parent dab46a7 commit 81ca7bc

18 files changed

Lines changed: 2172 additions & 27 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Docs: https://docs.openclaw.ai
1414
- Tokenjuice: add bundled native OpenClaw support for tokenjuice as an opt-in plugin that compacts noisy `exec` and `bash` tool results in Pi embedded runs. (#69946) Thanks @vincentkoc.
1515
- Providers/Tencent: add the bundled Tencent Cloud provider plugin with TokenHub and Token Plan onboarding, docs, `hy3-preview` model catalog entries, and tiered Hy3 pricing metadata. (#68460) Thanks @JuniperSling.
1616
- TUI: add local embedded mode for running terminal chats without a Gateway while keeping plugin approval gates enforced. (#66767) Thanks @fuller-stack-dev.
17+
- CLI/Claude: keep compatible `claude-cli` runs on a warm stdio session and resume from the stored Claude session after Gateway restarts or idle exits. (#69679) Thanks @obviyus.
1718

1819
### Fixes
1920

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
e77c14ad4db1be62275667537716917e4d0da73e1afb89be1edeb78d73346ae4 config-baseline.json
2-
ed4e305904b4b954ffa72c07ea1900a116bfd874ac0c637227883abb99f753f9 config-baseline.core.json
1+
3f08544c1a8143755a848aeb731f2eddf4f84cf70950c7d165f8889e01e4985d config-baseline.json
2+
2190e81fcd754b96b48a1e012600f3b74fdb9b91eac280d8e3e038fcb73d6546 config-baseline.core.json
33
6c0069b971ae298ae68516ebcd3eae0e8c82820d2e8f42ecbd2f53a2f9077371 config-baseline.channel.json
44
9096ec947597b03f97eef44186a3102fd80ffb7f3e791fb64544464d4571448f config-baseline.plugin.json

docs/gateway/cli-backends.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ The provider id becomes the left side of your model ref:
143143
1. **Selects a backend** based on the provider prefix (`codex-cli/...`).
144144
2. **Builds a system prompt** using the same OpenClaw prompt + workspace context.
145145
3. **Executes the CLI** with a session id (if supported) so history stays consistent.
146+
The bundled `claude-cli` backend keeps a Claude stdio process alive per
147+
OpenClaw session and sends follow-up turns over stream-json stdin.
146148
4. **Parses output** (JSON or plain text) and returns the final text.
147149
5. **Persists session ids** per backend, so follow-ups reuse the same CLI session.
148150

@@ -179,6 +181,10 @@ child process environment for the run.
179181
- `always`: always send a session id (new UUID if none stored).
180182
- `existing`: only send a session id if one was stored before.
181183
- `none`: never send a session id.
184+
- The bundled `claude-cli` backend uses `liveSession: "claude-stdio"` so
185+
follow-up turns reuse the live Claude process while it is active. If the
186+
Gateway restarts or the idle process exits, OpenClaw resumes from the stored
187+
Claude session id.
182188

183189
Serialization notes:
184190

extensions/anthropic/cli-backend.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export function buildAnthropicCliBackend(): CliBackendPlugin {
5353
"{sessionId}",
5454
],
5555
output: "jsonl",
56+
liveSession: "claude-stdio",
5657
input: "stdin",
5758
modelArg: "--model",
5859
modelAliases: CLAUDE_CLI_MODEL_ALIASES,

0 commit comments

Comments
 (0)