Repository navigation
docs(cli-backends): say which Claude login supplies the history recovery boundary - #174457
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThe PR explains which Claude login route permits saved-history recovery and why saving a token does not repair existing unowned history. Example: A Claude chat loses its native transcript after starting with only
Review scores
ProductKind: Docs · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR: it provides a useful, source-supported clarification of the two documented Claude authentication routes without changing recovery policy. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe CLI runner combines the selected credential with recorded transcript ownership to decide whether a fresh Claude process receives saved conversation text or only a metadata notice. flowchart TD
A[Claude authentication route] --> B[Selected credential]
B --> C[History boundary owner]
D[Saved transcript coverage] --> C
C --> E[Recovery prompt preparation]
E --> F[Fresh Claude process]
Technical reviewBest possible solution: Merge the focused documentation clarification while leaving native-login ownership support to its separate feature discussion. Do we have a high-confidence way to reproduce the issue? Current source confirms the documented authentication distinction and late-token limitation; linked CLI experiments support both paths, and no target code was executed during review. Is this the best way to solve the issue? The additions connect existing login instructions to the existing recovery contract without weakening isolation or claiming to implement native identity support. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 60ae44b74559. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceDocs +4. Total +4 across 1 file. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 16, 2026, 1:14 PM ET / 17:14 UTC. |
|
Landed in 035c9fb. I checked the text against current main: the |
- prepare.ts: main's comment lines (openclaw#175226, openclaw#168244) kept; the history gate stays inline on replayableTarget(cliHistoryWriter) as on the branch, so the file does not grow past its line-cap count - cli-runtime.test.ts: main's rewrite (openclaw#174630); the branch's it.for over assertCurrent and assertPrivateInputCurrent and its two private-input tests move into it, and createContext takes ClaudeCliExecuteContext overrides; cli-runtime.test-harness.ts and cli-runtime.private-input.test.ts deleted (the split only kept the old file under the line cap) - history-boundary.test.ts: branch fixture import plus main's prepareCliHistoryCompactionBoundary import (openclaw#175090) - docs/.generated config baseline regenerated with pnpm config:docs:gen - cli-backends.md: main's opaque-login paragraphs (openclaw#174457) now name the attestNativeLogin opt-in
…ery boundary (openclaw#174457) ## What Problem This Solves `docs/gateway/cli-backends.md` documents two ways to run the `claude-cli` backend: a native `claude auth login` registered with `openclaw models auth login --provider anthropic --method cli`, and a saved subscription token from `openclaw models auth paste-token --provider anthropic`. The page says saved-history recovery needs "a resolved static credential or a named OAuth account" and that "opaque CLI logins" cannot authorize replay, but it never says which of its two documented routes is which. Readers who follow the native route then meet `cli session history refused across auth boundary: reason=auth-unknown` on every fresh Claude session and cannot tell from the page whether that is expected or how to get recovery. The reports on openclaw#154716 show this: the issue author, [Rimmy555](openclaw#154716 (comment)) and [benjamin1492](openclaw#154716 (comment)) ran the native route; benjamin1492 traced `--method cli` to a migration result with no profiles; [hammadmo](openclaw#154716 (comment)) saved a token after the chat existed and saw no change, which the page also does not explain. ## User Impact Operators on the native route can read, in the section that describes that route, that it is the opaque login the boundary section excludes, what the refusal line means, that native resume of the same Claude session is unaffected, and that a saved subscription token is the documented route that gives new chats a recoverable owner. The boundary section adds the one rule the reports tripped over: a token saved after a chat has history does not relabel that chat; a new chat gets the boundary. No behavior changes. No config changes. The native-login history ownership question stays with openclaw#154716. ## Why This Change Was Made Two paragraphs added to `docs/gateway/cli-backends.md`: 1. After the `paste-token` block in the native-login section: > A native login alone is an opaque CLI login for saved-history recovery: OpenClaw sees no account identity for it, and `--method cli` saves no auth profile. When a chat on it needs a fresh Claude session (an invalidated binding or a missing native transcript), OpenClaw logs `cli session history refused across auth boundary: reason=auth-unknown` and the new session receives only the metadata notice about earlier messages, not the saved transcript. Native resume of the same Claude session is unaffected. A saved subscription token is a resolved static credential, so chats started while it is selected recover their saved history in a fresh Claude session. See [History account boundaries](#history-account-boundaries). 2. After "A reset that retains messages cannot relabel them." in History account boundaries: > A native `claude auth login` registered with `--method cli` is an opaque CLI login and cannot authorize automatic replay. A subscription token saved with `openclaw models auth paste-token --provider anthropic` gives new `claude-cli` chats a recoverable owner. Chats that already hold history without a recorded boundary stay refused after the token is saved; a new chat establishes the boundary. Source at `1d81055f89`: `src/agents/cli-runner/history-boundary.ts` derives the history owner only from an `oauth` credential with an account id or email, an `api_key` or a `token` (`const owner =` at line 281 through line 301); `extensions/anthropic/cli-backend.ts` types the native credential as `{ type: "oauth"; access; expires }` with no account id (line 24); `extensions/anthropic/cli-migration.ts` returns `profiles: []` for `--method cli` (line 158); the saved token reaches the child through `CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR` (`cli-backend.ts`). ## Evidence Real built `openclaw agent --local` at main `1d81055f89edfc3ac7a6c10edc850189dc8547a5` on a Mac Studio, real SQLite session store and auth-profile store, isolated `HOME`, `OPENCLAW_STATE_DIR` and config per arm. Only the `claude` executable is a synthetic child that speaks the stream-json protocol and records the user message it receives; it writes no native transcript, so every turn 2 starts a fresh Claude session (the only fresh-session path exercised). Tokens are synthetic (`sk-ant-oat01-` prefix, 91 characters, never printed). No `api.anthropic.com` call appears in any stderr. Records, redacted: [proof-154716-docs/](https://github.com/etzelm/openclaw/blob/f7f9d2f1fdeffd891006a0befdc5f0d867fe7a8e/proof-154716-docs/REPORT.md). The synthetic child records the login it would run under at each spawn: arm A shows `"loginAccount":"account-A","credentialAccount":"account-A","loginCredentialPresent":true` ([A/fake-claude.log](https://github.com/etzelm/openclaw/blob/f7f9d2f1fdeffd891006a0befdc5f0d867fe7a8e/proof-154716-docs/A/fake-claude.log)) and arm B shows `"loginAccount":null,"credentialAccount":null,"loginCredentialPresent":false`. Turn 1 is "Remember: the vault codeword is PINEAPPLE-7. Reply STORED." and turn 2 is "What is the codeword?" on the same session id. "User message" is what the child received. | Arm | Login on disk | Turn 2 user message | Refusal line | Stored boundary | |---|---|---|---|---| | A: native login only ([turn2.err](https://github.com/etzelm/openclaw/blob/f7f9d2f1fdeffd891006a0befdc5f0d867fe7a8e/proof-154716-docs/A/turn2.err)) | native login files, no OpenClaw profile | 436 chars, no `PINEAPPLE-7` | `cli session history refused across auth boundary: reason=auth-unknown` | none | | B: saved token only ([turn2.err](https://github.com/etzelm/openclaw/blob/f7f9d2f1fdeffd891006a0befdc5f0d867fe7a8e/proof-154716-docs/B/turn2.err)) | `paste-token`, no native login | 516 chars with `PINEAPPLE-7` | none | `known`, maxSeq 4 | | Bn: native login plus saved token | both | 516 chars with `PINEAPPLE-7` | none | `known`, maxSeq 4 | | C: token saved after turn 1 ([turns.log](https://github.com/etzelm/openclaw/blob/f7f9d2f1fdeffd891006a0befdc5f0d867fe7a8e/proof-154716-docs/C/turns.log)) | native for turn 1, token saved before turn 2 | 436 chars, no `PINEAPPLE-7` | `reason=auth-unknown` | none | | C, new session id after the token (turns 3, 4) | token | turn 4: 510 chars with `MANGO-5` | none | `known`, maxSeq 4 | The reset and refusal lines of arm A turn 2 (`turn2.err`): ``` [agents/agent-command] cli session reset: provider=claude-cli reason=transcript-missing sessionKey=agent:main:explicit:s1 [agent/cli-backend] cli session reset: provider=claude-cli reason=missing-transcript [agent/cli-backend] cli session history refused across auth boundary: reason=auth-unknown ``` Arm B turn 2 carries the same two reset lines and no refusal line. The child's recorded environment names (values never logged) include `CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR` in arm B and not in arm A ([fake-claude.log](https://github.com/etzelm/openclaw/blob/f7f9d2f1fdeffd891006a0befdc5f0d867fe7a8e/proof-154716-docs/B/fake-claude.log)). `openclaw models auth list` prints `anthropic:manual [anthropic/token]` in B and C and `Profiles: (none)` in A ([B/models-status.txt](https://github.com/etzelm/openclaw/blob/f7f9d2f1fdeffd891006a0befdc5f0d867fe7a8e/proof-154716-docs/B/models-status.txt), [A/models-status.txt](https://github.com/etzelm/openclaw/blob/f7f9d2f1fdeffd891006a0befdc5f0d867fe7a8e/proof-154716-docs/A/models-status.txt)). The saved profile was selected with no `--set-default`, account order or `@profile` suffix; the config had a single profile. Docs checks at the branch tree (base `189b9b159dc`), logs under [proof-154716-docs/gates/](https://github.com/etzelm/openclaw/blob/f7f9d2f1fdeffd891006a0befdc5f0d867fe7a8e/proof-154716-docs/gates/lint-docs.log): `format:docs:check` (`Docs formatting clean (1364 files)`), `lint:docs` (`Summary: 0 issues in 0 files`), `docs:check-mdx` (`Docs MDX check passed (1376 files`), `docs:check-links` (`broken_links=0`), all exit 0. `docs:check-i18n-glossary` (exit 1, it picks its own comparison commit and prints it) and `docs:spellcheck` (exit 65) produce byte-identical output on the pristine base ([docs-check-i18n-glossary-main.log](https://github.com/etzelm/openclaw/blob/f7f9d2f1fdeffd891006a0befdc5f0d867fe7a8e/proof-154716-docs/gates/docs-check-i18n-glossary-main.log), [docs-spellcheck-main.log](https://github.com/etzelm/openclaw/blob/f7f9d2f1fdeffd891006a0befdc5f0d867fe7a8e/proof-154716-docs/gates/docs-spellcheck-main.log)); neither names `cli-backends.md`. ## Gaps - Not tested with a real Claude binary, a real token, token expiry or refresh, more than one saved profile, or a fresh session caused by anything other than a missing native transcript. "Native resume of the same Claude session is unaffected" restates the page's existing "Native resume remains available"; no resume was exercised. - `docs/providers/anthropic.md` repeats the saved-token paragraph and is not changed; it does not describe the native route. - Translated docs are not updated; the glossary check is already red on main. Related: openclaw#154716 Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
docs/gateway/cli-backends.mddocuments two ways to run theclaude-clibackend: a nativeclaude auth loginregistered withopenclaw models auth login --provider anthropic --method cli, and a saved subscription token fromopenclaw models auth paste-token --provider anthropic. The page says saved-history recovery needs "a resolved static credential or a named OAuth account" and that "opaque CLI logins" cannot authorize replay, but it never says which of its two documented routes is which. Readers who follow the native route then meetcli session history refused across auth boundary: reason=auth-unknownon every fresh Claude session and cannot tell from the page whether that is expected or how to get recovery. The reports on #154716 show this: the issue author, Rimmy555 and benjamin1492 ran the native route; benjamin1492 traced--method clito a migration result with no profiles; hammadmo saved a token after the chat existed and saw no change, which the page also does not explain.User Impact
Operators on the native route can read, in the section that describes that route, that it is the opaque login the boundary section excludes, what the refusal line means, that native resume of the same Claude session is unaffected, and that a saved subscription token is the documented route that gives new chats a recoverable owner. The boundary section adds the one rule the reports tripped over: a token saved after a chat has history does not relabel that chat; a new chat gets the boundary. No behavior changes. No config changes. The native-login history ownership question stays with #154716.
Why This Change Was Made
Two paragraphs added to
docs/gateway/cli-backends.md:paste-tokenblock in the native-login section:Source at
5aec205816:src/agents/cli-runner/history-boundary.tsderives the history owner only from anoauthcredential with an account id or email, anapi_keyor atoken(const owner =at line 281 through line 301);extensions/anthropic/cli-backend.tstypes the native credential as{ type: "oauth"; access; expires }with no account id (line 24);extensions/anthropic/cli-migration.tsreturnsprofiles: []for--method cli(line 158); the saved token reaches the child throughCLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR(cli-backend.ts).Evidence
Real built
openclaw agent --localat main5aec205816506ceb6983a5ab1c549c9e0b301a61on a Mac Studio, real SQLite session store and auth-profile store, isolatedHOME,OPENCLAW_STATE_DIRand config per arm. Only theclaudeexecutable is a synthetic child that speaks the stream-json protocol and records the user message it receives; it writes no native transcript, so every turn 2 starts a fresh Claude session (the only fresh-session path exercised). Tokens are synthetic (sk-ant-oat01-prefix, 91 characters, never printed). Noapi.anthropic.comcall appears in any stderr. Records, redacted: proof-154716-docs/. The synthetic child records the login it would run under at each spawn: arm A shows"loginAccount":"account-A","credentialAccount":"account-A","loginCredentialPresent":true(A/fake-claude.log) and arm B shows"loginAccount":null,"credentialAccount":null,"loginCredentialPresent":false.Turn 1 is "Remember: the vault codeword is PINEAPPLE-7. Reply STORED." and turn 2 is "What is the codeword?" on the same session id. "User message" is what the child received.
PINEAPPLE-7cli session history refused across auth boundary: reason=auth-unknownpaste-token, no native loginPINEAPPLE-7known, maxSeq 4PINEAPPLE-7known, maxSeq 4PINEAPPLE-7reason=auth-unknownMANGO-5known, maxSeq 4The reset and refusal lines of arm A turn 2 (
turn2.err):Arm B turn 2 carries the same two reset lines and no refusal line. The child's recorded environment names (values never logged) include
CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTORin arm B and not in arm A (fake-claude.log).openclaw models auth listprintsanthropic:manual [anthropic/token]in B and C andProfiles: (none)in A (B/models-status.txt, A/models-status.txt). The saved profile was selected with no--set-default, account order or@profilesuffix; the config had a single profile.Docs checks at the branch tree (base
8162c2e637f), logs under proof-154716-docs/gates/:format:docs:check(Docs formatting clean (1364 files)),lint:docs(Summary: 0 issues in 0 files),docs:check-mdx(Docs MDX check passed (1376 files),docs:check-links(broken_links=0), all exit 0.docs:check-i18n-glossary(exit 1, it picks its own comparison commit and prints it) anddocs:spellcheck(exit 65) produce byte-identical output on the pristine base (docs-check-i18n-glossary-main.log, docs-spellcheck-main.log); neither namescli-backends.md.Gaps
docs/providers/anthropic.mdrepeats the saved-token paragraph and is not changed; it does not describe the native route.Related: #154716