Skip to content

fix: preserve account selection and recovery lifecycle ownership - #140973

Merged
steipete merged 2 commits into
mainfrom
codex/release-2026.9.3-main-repairs
Sep 7, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/release-2026.9.3-main-repairs

Conversation

@steipete

@steipete steipete commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes cases where removing an explicitly selected model account silently changed the account used for a turn, internal recovery lost the original request, native handoffs rejected requests during replacement, or Claude reused a process before host-owned cleanup finished. Doctor could also inspect retired model credentials before importing legacy credentials, preventing the repair it was meant to perform.

Release verification exposed these failures alongside stale fixtures for plugin runtime services, Gateway removal, compaction, and Windows compiler scheduling. This carries the reviewed repairs to main independently of release preparation.

Why This Change Was Made

Keep ownership with the existing account-selection, session, process, plugin, and Doctor coordinators. Preserve explicit account selection through admission, retain durable request context during model-only retries, await canonical CLI cleanup, retain relay listeners through their locator handoff, and run credential migration before model-route repair. Plugin runtime construction preserves supplied lazy service descriptors and the existing Gateway SDK aliases.

The fixture repairs exercise the correct owners and public outcomes. Windows compiler sequences run serially on Windows; explicit concurrent-owner coverage, source/config invalidation assertions, and every deadline remain intact. The static plugin-loader inventory also names the canonical injected resolver owner introduced by #140667. Main already contains the equivalent Discord and permission-refresh fixture repairs.

User Impact

Users receive actionable missing-account recovery, retain their requests and completed work during retries, and avoid premature process replacement or migration-order failures. Exhausted long usage windows select eligible fallback promptly while temporary throttles retain bounded backoff. Workshop learning preserves one-time request scope and grounds recovery lessons in observed results.

Evidence

Current head is f3fa986f09596b06f3193f22e9a9a8c198fa3f6f (tree d403e469c3562a9b5f4715439809516e43bffbfa), based on pinned main 6b54af7fc30c0b0399f08d8afca9e3d53f9844a8. This refresh incorporates the landed CI prerequisite repairs #141092/#141085 (Mermaid fixture ownership), #141137 (planner discovery reuse and CLI fixture startup), and #141139/#141148 (Telegram fixture line budget). The combined prerequisite CI for #141137 succeeded in run 34114761822.

The only conflict was the permission-refresh fixture, independently fixed on main by #141020. The resolution keeps main's complete fixture, canonical session-list call, dynamic roster state, and existing permission assertions; those two browser cases pass and the resolution review is clean. All remaining code/test patch content is identical to the previous reviewed head f5528d796a36ca85f4b7ddf0f9d1ea92a9d10c67. The Doctor documentation paragraph differs only in blank-line placement. The earlier schema-result, owned-updater guard, and manual-recovery decisions remain intact.

Proof retained from the earlier reviewed checkpoints:

  • At initial commit 1b4b2e2980884488caf376075d639fc3c0f50fbc, full changed-file checks, all typecheck lanes, lint, dead-code and runtime-cycle checks, private-QA build, and UI asset budgets passed. Independent aggregate and incremental P2 reviews were clean.
  • All 91 selected built E2E cases passed across the original run and focused preparation recovery: Doctor, Claws, Discord voice, subagent yield, timeout compaction, Codex refusal/retry continuity, and Telegram failure settlement. UI permission tests passed 2/2; native SDK loader compatibility passed 3/3.
  • Focused account/model/Anthropic/boundary suites passed 291 tests, plus missing-pin readiness 29, state preflight 47, embedded retry 56, relay/CLI lifecycle 152, QA child 101, and Workshop 46. Existing platform skips remain explicit in the logs.
  • At the previous main rebase, 40 schema/updater cases, 28 current Discord E2Es, and six Doctor admission E2Es passed; scoped gates and fresh resolution reviews were clean.
  • The Windows scheduling repair passed all seven selected cases on native Windows Server 2022 with four-CPU affinity. Required hosted Windows CI remains authoritative for the current PR head.

The earlier CI at merge 6be599c5f47a4913efc7558eff870d564454e6a4 failed on the inherited Mermaid mock, planner growth workload, and a real-Gateway widget timeout. The first two have the landed prerequisites above. The unchanged widget source passed all 31 exact-tree cases on both macOS and Linux, plus five source-blind behavior checks; no widget patch is included. Current-head CI run 34136755589 completed successfully at f3fa986f09596b06f3193f22e9a9a8c198fa3f6f; required checks are green before native preparation.

Two initial local QA cases timed out because staged runtime sources caused each repository CLI child to rebuild. A clean checkpoint and canonical private-QA build resolved that preparation issue without changing source, assertions, or deadlines. These are synthetic subprocess/Gateway proofs; full release and live-provider qualification remain separate.

@clawsweeper

clawsweeper Bot commented Sep 7, 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 channel: discord Channel integration: discord app: web-ui App: web-ui commands Command implementations agents Agent runtime and tooling extensions: anthropic extensions: qa-lab size: XL maintainer Maintainer-authored PR labels Sep 7, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. labels Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 7, 2026, 11:27 AM ET / 15:27 UTC.

ClawSweeper review

What this changes

Preserves selected accounts and request context during recovery, coordinates native process cleanup, repairs Doctor sequencing, and updates plugin loading and regression fixtures.

Merge readiness

⛔ Blocked before merge - 1 item remains

This PR remains useful: current main still clears missing explicit account selections and lacks the coordinated restart capability. No blocking introduced defect was found. The prior mixed-version warning does not establish a supported upgrade regression.

Priority: P2
Reviewed head: f3fa986f09596b06f3193f22e9a9a8c198fa3f6f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful owner-level repair with focused regression coverage and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its body reports synthetic Gateway/subprocess recovery and native Windows evidence; inspected restart and relay paths leave no material unresolved authority case requiring exceptional proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its body reports synthetic Gateway/subprocess recovery and native Windows evidence; inspected restart and relay paths leave no material unresolved authority case requiring exceptional proof.
Evidence reviewed 11 items Pinned introduction and merge ownership: Reviewed the merge-base-to-head changes. The locally inspected test merge records the pinned base followed by the exact PR head, matching host introduction evidence; unrelated base-branch changes were excluded.
Central repair remains absent from main: Fetched main still clears a missing non-personal explicit profile in session selection. Its live-session capability also lacks restart. The supplied merged related PRs address prerequisites or adjacent fixtures, not these central repairs.
Restart authority and cleanup: The new capability delegates to existing cleanup ownership, rejects required-generation replacement, and retains caller checks before close and after awaited cleanup. Regression coverage exercises caller revocation during cleanup and refusal to close an exact required generation.
Findings None None.
Security None None.

How this fits together

OpenClaw turns session requests and selected credentials into provider or CLI executions. Its recovery coordinators preserve conversation state, retire processes, and prepare compatible configuration and databases before subsequent work.

flowchart TD
  A[Session request and selected account] --> B[Account and model preparation]
  B --> C[Provider or CLI execution]
  C --> D[Recovery coordinator]
  D --> E[Preserved conversation context]
  D --> F[Process cleanup and replacement]
  G[Doctor configuration and database checks] --> B
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +145, Tests +428, Docs +20, Other +1. Total +594 across 55 files.

View PR surface stats
Area Files Added Removed Net
Source 22 179 34 +145
Tests 27 642 214 +428
Docs 4 20 0 +20
Config 0 0 0 0
Generated 0 0 0 0
Other 2 3 2 +1
Total 55 844 250 +594

Review metrics

Metric Value Why it matters
CLI host capability 1 required method added The documented restart operation exposes the existing host cleanup barrier, with its bundled consumer migrated in the same patch.

Stored data model

Persistent data-model change detected: migration/backfill/repair: config/max-lines-baseline.txt, migration/backfill/repair: src/commands/doctor.e2e-harness.ts, migration/backfill/repair: src/commands/doctor/repair-sequencing.ts, unknown-data-model-change: src/flows/doctor-health.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep account intent, transcript continuity, and process retirement with their existing owners, using the documented host cleanup capability and Doctor compatibility checks.

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

Yes, at source level: deleting an explicit stored account reaches main's override-clearing branch, and the supplied regressions exercise cleanup and retry ordering. No runtime reproduction was executed during this read-only review.

Is this the best way to solve the issue?

Yes. The patch repairs existing lifecycle owners and reuses their cleanup, credential, and transcript contracts; the coordinated host capability avoids a second cleanup implementation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9d64ec1e5dc6.

Labels

Label changes:

  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.

Label justifications:

  • P2: These are bounded account-selection, recovery, and maintenance correctness repairs without evidence of an emergency regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its body reports synthetic Gateway/subprocess recovery and native Windows evidence; inspected restart and relay paths leave no material unresolved authority case requiring exceptional proof.

Evidence

What I checked:

  • Pinned introduction and merge ownership: Reviewed the merge-base-to-head changes. The locally inspected test merge records the pinned base followed by the exact PR head, matching host introduction evidence; unrelated base-branch changes were excluded. (ca86b1eac90e)
  • Central repair remains absent from main: Fetched main still clears a missing non-personal explicit profile in session selection. Its live-session capability also lacks restart. The supplied merged related PRs address prerequisites or adjacent fixtures, not these central repairs. (src/agents/auth-profiles/session-override.ts:348, 9d64ec1e5dc6)
  • Restart authority and cleanup: The new capability delegates to existing cleanup ownership, rejects required-generation replacement, and retains caller checks before close and after awaited cleanup. Regression coverage exercises caller revocation during cleanup and refusal to close an exact required generation. (src/agents/cli-runner/cli-live-session-registry.ts:246, f3fa986f0959)
  • Prior compatibility concern reassessed: The host supplies the added method, existing capability methods remain, and the only production consumer found is the private bundled Anthropic plugin updated in the same patch. The public backend documentation describes the cleanup barrier. No concrete existing external deployment or supported mixed-version contract was identified, so the previous warning is not retained as a blocker. (extensions/anthropic/package.json:4, f3fa986f0959)
  • Retired relay rejects stale authority: Keeping the retired listener alive does not retain invocation authority: requests check the current registration and bridge before reading the body and again before invoking the relay. The added socket regression expects stale-registration rejection with no hook invocation. (src/agents/harness/native-hook-relay-bridge.ts:227, f3fa986f0959)
  • Doctor upgrade boundary: Doctor checks shared-state readability before its updater can use that database, then checks all database schemas if updating does not take over. Tests preserve database bytes, reject newer shared schemas before update admission, and retain the newer-agent-schema update path. Credential migration now precedes model-reference repair; no schema version or stored format is added. (src/flows/doctor-health.ts:72, f3fa986f0959)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Dinesh H Suthar: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (3 earlier review cycles)
  • reviewed 2026-09-07T07:40:50.884Z sha 1b4b2e2980884488caf376075d639fc3c0f50fbc :: blocked before merge. :: none
  • reviewed 2026-09-07T08:34:01.358Z sha f5528d7 :: blocked before merge. :: none
  • reviewed 2026-09-07T15:15:40.492Z sha f3fa986 :: blocked before merge. :: none

@steipete
steipete force-pushed the codex/release-2026.9.3-main-repairs branch from 1b4b2e2 to f5528d7 Compare September 7, 2026 08:13
@openclaw-barnacle openclaw-barnacle Bot removed the channel: discord Channel integration: discord label Sep 7, 2026
@steipete
steipete marked this pull request as ready for review September 7, 2026 08:18
@steipete
steipete requested a review from a team as a code owner September 7, 2026 08:18
Retain missing explicit model-account selections through chat and command
admission, preserve durable user context on internal retries, and fail over
exhausted usage windows without delaying temporary throttles. Keep retired
hook listeners alive for their locator grace period and await host-owned
Claude process cleanup before replacement.

Preserve supplied lazy plugin runtime services and Gateway protocol aliases.
Refuse unreadable shared state before Doctor update admission, migrate
credentials before model-route repair, and release staged QA auth-store
leases before child maintenance.

Align isolated Doctor, Claws, Discord, plugin, UI permission, compaction,
yield, and Windows worker-compilation fixtures with their existing contracts.
Keep deadlines, explicit concurrency coverage, authority checks, and
observable assertions intact. Account for the canonical injected provider
resolver owner introduced by #140667 in its exact static boundary inventory.

Release-note context: these repairs prevent silent account substitution,
lost retry context, stale relay connections, premature CLI process reuse,
and Doctor migration ordering failures. This forward-port carries the
reviewed release validation repairs independently to main without changing
release versions or publication state.
Match the current manual recovery contract: require process-stop and verified-backup guidance, and reject a misleading repeat-Doctor loop. Preserve the database bytes, failure cause, selected path, and no-migration assertions. Both old command-copy expectations reproduced failures after the rebase; all six admission cases, scoped checks, and P2 review now pass.
@steipete
steipete force-pushed the codex/release-2026.9.3-main-repairs branch from f5528d7 to f3fa986 Compare September 7, 2026 15:08
@openclaw-barnacle openclaw-barnacle Bot removed the app: web-ui App: web-ui label Sep 7, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 7, 2026
@steipete
steipete merged commit cb1b29d into main Sep 7, 2026
196 checks passed
@steipete
steipete deleted the codex/release-2026.9.3-main-repairs branch September 7, 2026 15:53
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
…nclaw#140973)

* fix: preserve runtime ownership across auth and recovery paths

Retain missing explicit model-account selections through chat and command
admission, preserve durable user context on internal retries, and fail over
exhausted usage windows without delaying temporary throttles. Keep retired
hook listeners alive for their locator grace period and await host-owned
Claude process cleanup before replacement.

Preserve supplied lazy plugin runtime services and Gateway protocol aliases.
Refuse unreadable shared state before Doctor update admission, migrate
credentials before model-route repair, and release staged QA auth-store
leases before child maintenance.

Align isolated Doctor, Claws, Discord, plugin, UI permission, compaction,
yield, and Windows worker-compilation fixtures with their existing contracts.
Keep deadlines, explicit concurrency coverage, authority checks, and
observable assertions intact. Account for the canonical injected provider
resolver owner introduced by openclaw#140667 in its exact static boundary inventory.

Release-note context: these repairs prevent silent account substitution,
lost retry context, stale relay connections, premature CLI process reuse,
and Doctor migration ordering failures. This forward-port carries the
reviewed release validation repairs independently to main without changing
release versions or publication state.

* test(doctor): assert manual recovery for unreadable state

Match the current manual recovery contract: require process-stop and verified-backup guidance, and reject a misleading repeat-Doctor loop. Preserve the database bytes, failure cause, selected path, and no-migration assertions. Both old command-copy expectations reproduced failures after the rebase; all six admission cases, scoped checks, and P2 review now pass.
obviyus added a commit that referenced this pull request Sep 8, 2026
Related: #140973

## What Problem This Solves

Model validation can reject an existing native Codex login as an unavailable `openai:default` profile when OpenClaw has no stored OAuth account. Automatic model discovery also loses the native login's OAuth mode.

## Why This Change Was Made

Pass the requested provider, explicit or preferred profile, and config to the existing scoped credential-discovery owner. The regression fixture now lets model resolution perform the first scoped lookup.

## User Impact

Eligible native logins work during model discovery without being imported into the managed auth store. Prepared selections, managed account ownership, missing-profile errors, and stored API keys retain their existing policy.

## Evidence

On pinned main `21ad735be2f44143bcd2f53ec2ffa8c128e5ede2`, this public command rejects the selected native profile; the candidate accepts it:

```sh
pnpm openclaw config set agents.defaults.model.primary '"openai/gpt-5.4@openai:default"' --strict-json --dry-run
```

The isolated fixture uses the OpenClaw model runtime, the OpenAI plugin, a synthetic future-dated native login, and real SQLite state. A configured external alias also validates. The candidate passes 36 focused tests; the cleaned regression suite fails on the original production owner for the two native-discovery cases.

Supplementary real-resolver checks observe default and alias OAuth selection and preserve prepared, managed, missing-managed, API-key, and non-OpenAI results. Shared auth rows and native-file hashes remain unchanged, with no agent-local credential copy. External networking is blocked. The network observer distinguishes loader Unix sockets from external requests.

This proves offline discovery and validation. It does not claim a real provider login, model turn, token refresh, browser login, or macOS Keychain execution. Prepared-mode and selected-auth-mode assertions are supplementary boundary proof because the public command does not expose those fields. Complete private raw captures are retained; published excerpts omit fixture paths and credential material.

Independent source-blind CLI checks cover native default, automatic selection, alias, managed refusals, stored keys, and invalid model input. Hidden auth-mode and implementation assertions remain separately reviewed source/boundary evidence.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 9, 2026
Related: openclaw#140973

## What Problem This Solves

Model validation can reject an existing native Codex login as an unavailable `openai:default` profile when OpenClaw has no stored OAuth account. Automatic model discovery also loses the native login's OAuth mode.

## Why This Change Was Made

Pass the requested provider, explicit or preferred profile, and config to the existing scoped credential-discovery owner. The regression fixture now lets model resolution perform the first scoped lookup.

## User Impact

Eligible native logins work during model discovery without being imported into the managed auth store. Prepared selections, managed account ownership, missing-profile errors, and stored API keys retain their existing policy.

## Evidence

On pinned main `c128afa34681ce5fe7c965de464888ebe0b7240b`, this public command rejects the selected native profile; the candidate accepts it:

```sh
pnpm openclaw config set agents.defaults.model.primary '"openai/gpt-5.4@openai:default"' --strict-json --dry-run
```

The isolated fixture uses the OpenClaw model runtime, the OpenAI plugin, a synthetic future-dated native login, and real SQLite state. A configured external alias also validates. The candidate passes 36 focused tests; the cleaned regression suite fails on the original production owner for the two native-discovery cases.

Supplementary real-resolver checks observe default and alias OAuth selection and preserve prepared, managed, missing-managed, API-key, and non-OpenAI results. Shared auth rows and native-file hashes remain unchanged, with no agent-local credential copy. External networking is blocked. The network observer distinguishes loader Unix sockets from external requests.

This proves offline discovery and validation. It does not claim a real provider login, model turn, token refresh, browser login, or macOS Keychain execution. Prepared-mode and selected-auth-mode assertions are supplementary boundary proof because the public command does not expose those fields. Complete private raw captures are retained; published excerpts omit fixture paths and credential material.

Independent source-blind CLI checks cover native default, automatic selection, alias, managed refusals, stored keys, and invalid model input. Hidden auth-mode and implementation assertions remain separately reviewed source/boundary evidence.

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

agents Agent runtime and tooling commands Command implementations docs Improvements or additions to documentation extensions: anthropic extensions: qa-lab maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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.

1 participant