Skip to content

fix(agents): preserve valid CLI session bindings - #128732

Merged
vincentkoc merged 5 commits into
openclaw:mainfrom
SunnyShu0925:fix/cli-session-format-failover-128698
Aug 25, 2026
Merged

vincentkoc merged 5 commits into
openclaw:mainfrom
SunnyShu0925:fix/cli-session-format-failover-128698

Conversation

@SunnyShu0925

@SunnyShu0925 SunnyShu0925 commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #128698

What Problem This Solves

OpenClaw could discard a valid persisted CLI/Agent SDK conversation binding after a failure that did not prove the provider-side session was gone. The next turn then started without the prior conversation.

Root Cause and Fix

  • Only FailoverError(reason === "session_expired") proves a provider conversation binding is invalid.
  • CliBackendConfig.freshSessionRecovery now owns fresh-recovery policy. Undefined or replace-binding preserves existing Gemini/external clear-and-reseed behavior; Anthropic opts into invalidated-only.
  • The policy decision lives with the recoverable-failure predicate in src/agents/cli-runner/cli-run-recovery.ts.
  • The command path retains the canonical latest-store/CAS guard, so an older retry cannot overwrite a concurrent rebind.
  • Credential identity changes remain owned by the auth-profile/auth-epoch invalidation path.

AbortError Audit

AbortError cleanup remains unchanged. It represents terminal local process cleanup, not a FailoverError identity decision. Existing reuse, fork-marker, and detached-media coverage still passes.

Release Note

Fixed Claude Agent SDK-backed conversations losing their persisted resume binding after format, authentication, rate-limit, TLS, and other non-session-expiration failures, while preserving Gemini and external CLI backends' existing fresh-session recovery behavior.

Evidence

Exact head: c6a6599fff8ee1103f7af9e566fbd5e0a28dffe9

  • Direct AWS Crabbox run run_253be58aff3c succeeded on clean implementation head 48cccd4667309355cb01482aed9b6fa1150ebbd4: 40/40 session invalidation tests, 90/90 recovery tests, 121/121 persisted command-path tests, 51/51 Anthropic descriptor tests, and 27/27 Google descriptor tests. Git status was clean before and after.
  • The Crabbox dependency manifests resolved @anthropic-ai/claude-agent-sdk 0.3.232 and @google/genai 2.17.1.
  • Full-clone remote GWT/Testbox proof also passed the combined recovery/backend matrix (102/102), Anthropic + Google setup/descriptor coverage (85/85), targeted formatting, oxlint, git diff --check, plugin SDK surface, full core-test type graph, and build/runtime postbuild.
  • The runtime implementation head 48cccd4667309355cb01482aed9b6fa1150ebbd4 completed hosted CI: https://github.com/openclaw/openclaw/actions/runs/32790806640
  • The pre-rebase docs head d0e5dc2eceb81c9bfcb22170f5be5fef65eb2b10 completed hosted CI: https://github.com/openclaw/openclaw/actions/runs/32797209366
  • This docs-only follow-up documents the public freshSessionRecovery values and legacy default. Remote proof passed targeted formatting, MDX validation (779 files), internal-link audit (6,555 links, zero broken), git diff --check, and the docs-only changed gate.
  • The rebased exact head is based on main b840a3c84e2ce43708ca8810caec0a1896c167c1 with zero touched-file overlap. Remote Testbox proof passed 40/40 session, 90/90 recovery, 121/121 persisted command-path, and 51/51 Anthropic descriptor tests; plugin SDK surface, formatting, boundaries, dead-export scan, and core production typecheck also passed. The core-test type shard reached only the known shared-install baseline: missing pako declarations in ui/vite.config.ts.
  • All 16 current failover reasons are covered, including tls_certificate; only session_expired clears the persisted binding.
  • Claude format failure performs one attempt, retains the binding on disk, and the next normal turn resumes it. Claude session_expired clears and starts fresh. Gemini format/timeout retains its two-attempt clear-and-reseed contract. Concurrent rebind replacement is refused.

Direct @anthropic-ai/claude-agent-sdk 0.3.232 source/types confirm Options.resume supplies the session to resume and result messages carry session_id. The real SDK subprocess transport was exercised on implementation head 48cccd4667309355cb01482aed9b6fa1150ebbd4 with a deterministic representative Claude executable; the rebased exact head reran the focused recovery matrix above:

{"sdkVersion":"0.3.232","exactHead":"48cccd4667309355cb01482aed9b6fa1150ebbd4","firstResult":"error_during_execution","firstSessionId":"11111111-1111-4111-8111-111111111111","secondResumeArg":"--resume=11111111-1111-4111-8111-111111111111","secondResult":"success","secondSessionId":"11111111-1111-4111-8111-111111111111","bindingRetained":true}

No live Anthropic credential was available in the sanitized proof environment. This is exact-head proof through the real SDK process transport and result/session contract, not a live API claim.

The shipped Codex app-server path is unaffected: it owns thread/resume in codex-rs/app-server-protocol and codex-rs/app-server, outside the generic CliBackendConfig flow.

Size

Production: +41/-2 (net +39). Tests: +268/-29 (net +239). Total: +309/-31 (net +278) across nine files.

The positive production delta is the additive plugin ownership boundary and canonical recovery-policy contract.

AI Assistance

  • AI-assisted: Yes
  • Confirmed understanding of the changes: Yes

Co-authored-by: SunnyShu [email protected]

Co-authored-by: Vincent Koc [email protected]

@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Aug 24, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 10:01 PM ET / August 25, 2026, 02:01 UTC.

ClawSweeper review

What this changes

Adds a documented CLI-backend recovery policy so Anthropic sessions survive non-expiration failures while existing backends keep their default fresh-session retry behavior.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: current main still clears every failed CLI binding, while this PR makes recovery backend-owned and preserves Anthropic bindings only when invalidation is proven. The previous review findings are addressed and supplied real-process proof is sufficient; it awaits normal maintainer merge review and exact-head CI.

Priority: P1
Reviewed head: c6a6599fff8ee1103f7af9e566fbd5e0a28dffe9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong focused proof and a coherent owner-boundary fix, with ordinary compatibility and exact-head CI checks remaining before merge.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The supplied exact-head recovery matrix and redacted real Agent SDK process trace show a retained binding followed by a resumed invocation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The supplied exact-head recovery matrix and redacted real Agent SDK process trace show a retained binding followed by a resumed invocation.
Evidence reviewed 7 items Current-main defect: Current main clears any failed reusable CLI binding for every FailoverError, including format failures.
Owner-boundary repair: The branch introduces a generic recovery policy and blocks fresh replacement for invalidated-only backends unless the failure is session_expired.
Concurrency guard: The command path rereads the latest session entry before clearing, so an older recovery cannot erase a concurrent rebinding.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

pnpm openclaw --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128732-sQboyU/target$ pnpm openclaw --help
$ node scripts/run-node.mjs --help
pnpm openclaw --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 109.17 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 14.1s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4208ms (slowest: built plugin control-plane loads 3439ms)

OpenClaw 2026.8.1 (c6a6599) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console
… output truncated …

Assertions:

  • PASS expect_output: Usage:

How this fits together

CLI backends execute provider processes for agent turns and store resumable session bindings. Recovery either preserves that binding for the next turn or clears it before a fresh retry.

flowchart LR
  A[Agent turn] --> B[CLI backend]
  B --> C[Persisted session binding]
  B --> D[Failure classification]
  D --> E[Backend recovery policy]
  E --> F[Preserve or clear binding]
  F --> G[Next resumed or fresh turn]
Loading

Before merge

  • Resolve merge risk (P1) - This adds a public CLI-backend compatibility setting; third-party backends must continue to inherit the undefined default clear-and-reseed behavior. The runtime growth is justified by the generic owner boundary and latest-store guard rather than a provider-specific core branch.
  • Complete next step (P2) - No repair lane is needed because this focused implementation PR already owns the fix; normal maintainer merge review and exact-head CI are next.
Agent review details

Security

None.

PR surface

Source +39, Tests +239, Docs +15. Total +293 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 5 41 2 +39
Tests 4 268 29 +239
Docs 1 15 0 +15
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 324 31 +293

Review metrics

Metric Value Why it matters
Runtime, docs, and tests runtime +39/-2, docs +15/-0, tests +239/-29 The runtime growth establishes the generic backend policy and compare-and-swap protection; the remaining changes document and exercise it.

Stored data model

Persistent data-model change detected: serialized state: src/agents/cli-runner.reliability.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #128698
Summary: This PR explicitly implements the reported persisted Claude CLI binding failure.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Verify default-policy compatibility (recommended)
    Merge after exact-head validation confirms undefined recovery policy retains clear-and-reseed behavior for existing CLI backends.

Technical review

Best possible solution:

Merge the documented backend-owned policy only after exact-head checks confirm both the default fresh-retry path and Anthropic retained-binding path.

Do we have a high-confidence way to reproduce the issue?

Yes, source establishes it with high confidence: current main clears a binding after any FailoverError, while the added two-turn persisted-store coverage exercises the format-failure path.

Is this the best way to solve the issue?

Yes. The recovery choice belongs to the backend contract, and the default preserves existing behavior instead of adding a Claude-specific core branch.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4ded341a28b7.

Labels

Label justifications:

  • P1: The fix prevents silent loss of persisted agent conversation context after recoverable CLI failures.
  • merge-risk: 🚨 compatibility: A new public backend policy changes recovery semantics while existing plugins must retain the undefined default.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The supplied exact-head recovery matrix and redacted real Agent SDK process trace show a retained binding followed by a resumed invocation.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied exact-head recovery matrix and redacted real Agent SDK process trace show a retained binding followed by a resumed invocation.

Evidence

What I checked:

Likely related people:

  • vincentkoc: The supplied history attributes the recovery refactor and current documentation head to this contributor, and their member comments record exact-head recovery proof. (role: recent area contributor and reviewer; confidence: high; commits: 1ee58d4465c2, c6a6599fff8e; files: src/agents/cli-runner/cli-run-recovery.ts, src/agents/cli-session.ts, src/plugins/cli-backend.types.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Let the queued exact-head checks complete before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (12 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-24T20:50:55.642Z sha def086c210b06c26900ddab27eb64a004fc9acd5 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-24T21:21:15.025Z sha def086c210b06c26900ddab27eb64a004fc9acd5 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-24T22:04:51.926Z sha def086c210b06c26900ddab27eb64a004fc9acd5 :: needs changes before merge. :: [P1] Limit retained-binding recovery to Claude CLI
  • reviewed 2026-08-24T23:52:14.226Z sha 48cccd4667309355cb01482aed9b6fa1150ebbd4 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-25T00:25:49.655Z sha 48cccd4667309355cb01482aed9b6fa1150ebbd4 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-25T01:00:06.780Z sha 48cccd4667309355cb01482aed9b6fa1150ebbd4 :: needs changes before merge. :: [P2] Document the public recovery-policy option
  • reviewed 2026-08-25T01:28:01.970Z sha d0e5dc2eceb81c9bfcb22170f5be5fef65eb2b10 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-25T01:47:54.474Z sha d0e5dc2eceb81c9bfcb22170f5be5fef65eb2b10 :: needs maintainer review before merge. :: none

@SunnyShu0925
SunnyShu0925 force-pushed the fix/cli-session-format-failover-128698 branch from e95d791 to 20a54e9 Compare August 24, 2026 15:10
@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc vincentkoc self-assigned this Aug 24, 2026
@vincentkoc

vincentkoc commented Aug 24, 2026 •

Copy link
Copy Markdown
Member

Exact-head session-state proof for 65e007cca042bce5ba4739745e24f6997c07adc2:

  • The shared shouldClearCliSession owner predicate preserves bindings for all 15 non-expiration failover reasons and clears only session_expired.
  • Focused exact-head Testbox proof passed and was recorded in the PR body.

@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Aug 24, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Exact-head CI follow-up for 65e007cca042bce5ba4739745e24f6997c07adc2:

  • Hosted checks-node-changed-extensions-config-6 had one unrelated browser timeout-race failure in extensions/browser/src/node-host/invoke-browser.test.ts; the other 2,621 tests in that shard passed.
  • The exact failing file passed 37/37 on Testbox against the PR head.
  • Re-ran only hosted job 97574883603; no full workflow restart.

@vincentkoc

Copy link
Copy Markdown
Member

Exact-head proof for def086c210b06c26900ddab27eb64a004fc9acd5:

  • cli-session.test.ts: 40/40
  • cli-runner.reliability.test.ts: 88/88
  • attempt-execution.cli.test.ts: 121/121
  • format, git diff --check, scoped oxlint: passed
  • changed gate: all relevant checks and production typecheck passed; only the known unrelated Testbox pako declaration gap failed the core-test type shard

The recovery regression now proves a retained format binding does not spawn a replacement fresh attempt. A later normal turn invokes the CLI with the original session id, and readSessionStore() confirms the same binding remains on disk.

Representative real Anthropic Agent SDK 0.3.232 transport trace on this head:

{"sdkVersion":"0.3.232","firstResult":"error_during_execution","firstSessionId":"11111111-1111-4111-8111-111111111111","secondResumeArg":"--resume=11111111-1111-4111-8111-111111111111","secondResult":"success","secondSessionId":"11111111-1111-4111-8111-111111111111","bindingRetained":true}

No live Anthropic credential was available in the sanitized Testbox; this is representative proof through the real SDK process transport and result/session parser, not a live API claim.

@vincentkoc

vincentkoc commented Aug 24, 2026 •

Copy link
Copy Markdown
Member

Exact-head recovery proof for def086c210b06c26900ddab27eb64a004fc9acd5:

  • Recovery-boundary and two-turn persisted-resume coverage passed.
  • The latest-store guard preserves an existing binding instead of replacing it with a fresh session.

@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 24, 2026
@vincentkoc vincentkoc changed the title fix(agents): preserve CLI session binding on format-class failover fix(agents): preserve valid CLI session bindings Aug 24, 2026
@vincentkoc

vincentkoc commented Aug 24, 2026 •

Copy link
Copy Markdown
Member

Exact-head session-state proof for def086c210b06c26900ddab27eb64a004fc9acd5:

  • openclaw/ci-gate and all executed checks passed.
  • The shared owner policy clears only session_expired; the latest-store guard prevents stale recovery from replacing a preserved binding; the 16-reason matrix and two-turn ProcessTransport proof passed.
  • Direct inspection of pinned @anthropic-ai/[email protected] confirms resume loads the supplied session history.
  • The resolved merge-risk: 🚨 session-state label was removed after evidence review.

No pending maintainer or risk decision remains.

@vincentkoc vincentkoc removed the merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. label Aug 24, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 25, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Aug 25, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 25, 2026
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Aug 25, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 25, 2026
SunnyShu0925 and others added 5 commits August 25, 2026 01:44
shouldClearFailedCliSessionBinding cleared the stored CLI session
binding for every FailoverError, including format-class failures
(output limit exceeded, parser error, unsupported image input). A
format-class failover means the stream could not be read, not that
the CLI session on disk is invalid — clearing the binding silently
lost the conversation context on the next turn.

Narrow the condition to only session-invalidating failover reasons
(session_expired, auth, auth_permanent) using a whitelist so new
reasons default to preserving the binding.

Fixes openclaw#128698
@vincentkoc
vincentkoc force-pushed the fix/cli-session-format-failover-128698 branch from d0e5dc2 to c6a6599 Compare August 25, 2026 01:54
@vincentkoc

Copy link
Copy Markdown
Member

Maintainer compatibility-risk acceptance for exact head c6a6599fff8ee1103f7af9e566fbd5e0a28dffe9.

  • Undefined or replace-binding preserves the legacy clear-and-reseed behavior for existing CLI backends.
  • invalidated-only is scoped to Anthropic, and only session_expired proves the binding invalid.
  • The public contract and default are documented; exact-head required CI is green and ClawSweeper reports no findings.
  • Native landing will use the live RepositoryRole actor 2 exemption because the strict Clownfish exact-merge job is pinned to an obsolete head and cannot consume the personally verified sibling Codex proof. No preflight automation is changed or bypassed outside that documented repository-role path.

@vincentkoc vincentkoc removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Aug 25, 2026
@vincentkoc
vincentkoc merged commit e2deb87 into openclaw:main Aug 25, 2026
462 of 465 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 25, 2026
* fix(agents): preserve CLI session binding on format-class failover

shouldClearFailedCliSessionBinding cleared the stored CLI session
binding for every FailoverError, including format-class failures
(output limit exceeded, parser error, unsupported image input). A
format-class failover means the stream could not be read, not that
the CLI session on disk is invalid — clearing the binding silently
lost the conversation context on the next turn.

Narrow the condition to only session-invalidating failover reasons
(session_expired, auth, auth_permanent) using a whitelist so new
reasons default to preserving the binding.

Fixes openclaw#128698

* fix(agents): preserve valid CLI session bindings

* fix(agents): retain CLI binding across format recovery

* fix(agents): scope fresh CLI recovery by backend

* docs(plugins): document CLI recovery policy

---------

Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: anthropic P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: A format-class stream failover silently deletes a still-valid Claude CLI session binding

2 participants