Skip to content

docs(cli-backends): say which Claude login supplies the history recovery boundary - #174457

Merged
obviyus merged 1 commit into
openclaw:mainfrom
etzelm:docs/cli-history-owner-route
Oct 17, 2026
Merged

obviyus merged 1 commit into
openclaw:mainfrom
etzelm:docs/cli-history-owner-route

Conversation

@etzelm

@etzelm etzelm commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

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 #154716 show this: the issue author, Rimmy555 and benjamin1492 ran the native route; benjamin1492 traced --method cli to 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:

  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.

  1. 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 5aec205816: 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 5aec205816506ceb6983a5ab1c549c9e0b301a61 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/. 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.

Arm Login on disk Turn 2 user message Refusal line Stored boundary
A: native login only (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) 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) 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). openclaw models auth list prints anthropic:manual [anthropic/token] in B and C and Profiles: (none) in A (B/models-status.txt, 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 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) and docs:spellcheck (exit 65) produce byte-identical output on the pristine base (docs-check-i18n-glossary-main.log, 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: #154716

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: XS labels Oct 16, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:docs Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 clawsweeper:intake:docs Preliminary submission classification; full source review pending. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The 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 claude auth login.

  • Before: The documentation does not connect that login route to reason=auth-unknown.
  • After: The documentation explains the refusal and identifies a new chat using a saved subscription token as the recoverable route.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful documentation with source-verified claims, supporting CLI experiments, and no actionable defect found.
Proof confidence 🐚 platinum hermit (4/6) All changes are documentation; the inspected supporting CLI report uses isolated stores and a synthetic Claude child and does not claim real vendor authentication coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Docs · Worth it: Yes · Fix scope: Complete
User problem: Operators cannot tell which documented Claude login route supports saved-history recovery or why adding a token leaves an existing chat refused.
Reason: The clarification resolves the documentation gap while explicitly leaving the broader native-identity capability unchanged.

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
Reviewed head: 8b35596ddbc4bb8e34da55976b2a5708a0f5a221

Before merge

None.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Saved subscription credential selection keeps the original intent (2d49eca: Restore ordered saved-token forwarding for new sessions while preserving existing session accounts.)
  • Independent history-account boundary keeps the original intent (e20b56c: Recover continuously covered same-account history without relabeling unknown or mixed historical content.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit 2d49eca adds docs/gateway/cli-backends.md:237 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2d49eca81d35; files: docs/gateway/cli-backends.md)
  • Mitchell Etzel: Raw commit d472fc5 adds docs/gateway/cli-backends.md:397 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d472fc590701; files: docs/gateway/cli-backends.md)

PR surface

Docs +4. Total +4 across 1 file. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 4 0 +4

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is a bounded documentation clarification with no runtime or configuration change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 16, 2026, 1:14 PM ET / 17:14 UTC.

@obviyus
obviyus merged commit 035c9fb into openclaw:main Oct 17, 2026
79 of 80 checks passed
@obviyus

obviyus commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

Landed in 035c9fb. I checked the text against current main: the auth-unknown refusal and metadata-only notice (src/agents/cli-runner/session-history.ts), the missing history writer on a native login (prepare.ts), and --method cli returning no profiles (extensions/anthropic/cli-migration.ts) all still match. Thanks @etzelm.

etzelm added a commit to etzelm/openclaw that referenced this pull request Oct 18, 2026
- 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
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

2 participants