Skip to content

fix: let local TUI /auth sign in to providers again - #200605

Merged
daniel-lxs merged 4 commits into
openclaw:mainfrom
ArcueidMP:codex/fix-tui-local-auth-owner
Nov 27, 2026
Merged

daniel-lxs merged 4 commits into
openclaw:mainfrom
ArcueidMP:codex/fix-tui-local-auth-owner

Conversation

@ArcueidMP

@ArcueidMP ArcueidMP commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Closes #200558
Closes #201751

What Problem This Solves

In openclaw tui --local, built-in provider login started a child process that tried to take the state lock already held by the TUI. The login could fail before the provider prompt opened.

A second failure appeared once login could finish. After the TUI had completed a chat turn, saving a protected token left the existing session with its previous credentials. The next message failed locally with secret reference was not materialized by the active runtime. GitHub Copilot uses this storage path by default.

User Impact

Users can sign in from the local TUI and send the next message with the new credential and the same model, including after an earlier chat turn. Cancelling returns to the TUI. Quitting with a sign-in prompt open cancels it. If a replacement credential is still waiting to be written, the previous credential stays in place. External Codex sign-in continues through codex login.

Why This Change Was Made

Built-in login runs under the TUI's existing state owner and uses the shared login flow's refresh callback to publish credentials into the embedded runtime. A fresh session prepares its credentials on its first turn. An active session refreshes its existing provider snapshot before chat resumes. A queued credential write checks the TUI's cancellation signal after it acquires the profile lock.

The shutdown comparison exposed a second lifetime to release. A prepared model generation held a plugin source capture, which kept its native resource broker alive after command cleanup. The executable waits for model retirement to settle before closing the shared database and native workers. If model retirement fails, it reports the error and continues with shared-state cleanup. Borrowed command invocations leave that process-wide lifetime with their caller.

Evidence

I reproduced both shutdown failures reported on c156520b8b4 and repeated the same checks on d2e80ad2129. Shutdown report

Scenario Before After
Send SIGTERM to the built TUI while a protected credential is waiting for the profile lock, then release the lock Login reported a save and left one profile and one protected token. The process exited with code 0, with no saved profile or protected token. A separate regression test verified that a cancelled replacement preserves the previous credential.
Make a prepared model fail to close, with SQLite, a native worker and a PostgreSQL pool endpoint still open The model error was logged and all three resources remained open. The error was logged and all three closed. A delayed failure also keeps shared resources available until the model disposer settles.

The two original built-CLI PTY scenarios also passed. Both the inline key and the protected tokenRef reached the next model request on the original model, and both processes exited normally on SIGTERM. The original reporter independently verified real GitHub Copilot device-code sign-in and reauthentication after a completed turn on c156520b8b4. Reporter's Linux run

Redacted shutdown probe output, checks and replay on d2e80ad2129

The held-lock probe used the built local TUI and a synthetic provider. The cleanup probe used the compiled CLI cleanup scope, a real SQLite handle, an owned native worker, and an isolated PostgreSQL pool endpoint.

Before (c156520b8b4)
Built local TUI reached the held per-profile credential lock.
The provider observed the TUI abort before the writer lock was released.
CLI reported a saved auth profile: True
After exit: profile rows=1, protected tokens=1, exit code=0.

CLI cleanup failed: shared-state: Prepared model runtime failed to close | synthetic model-close fault
After the rejected model disposer: {"sqliteClosed":false,"nativeWorkerClosed":false,"postgresPoolClosed":false}

After (d2e80ad2129)
Built local TUI reached the held per-profile credential lock.
The provider observed the TUI abort before the writer lock was released.
CLI reported a saved auth profile: False
After exit: profile rows=0, protected tokens=0, exit code=0.

CLI cleanup failed: prepared-model-runtime: Prepared model runtime failed to close | synthetic model-close fault
After the rejected model disposer: {"sqliteClosed":true,"nativeWorkerClosed":true,"postgresPoolClosed":true}

The two committed regressions failed against the previous production code and passed with this fix. In total, 79 focused tests in eight files passed, in addition to the two built-CLI PTY scenarios on Node 24.22.1 and the pinned OpenClaw Bun runtime. The QA runtime build, core and affected test typechecks, scoped lint, formatting and git diff --check passed. Local autoreview covered the complete PR diff from 265577c4c15 to the tree committed as d2e80ad2129 and reported no actionable P0–P2 findings. Queued credential regression · Cleanup regression

node scripts/run-vitest.mjs run src/cli/models-cli.auth-login.integration.test.ts src/cli/runtime-cleanup-scope.test.ts --maxWorkers=1
Earlier sign-in, recovery and SIGTERM evidence on c156520b8b4

After integrating #203394 from main (265577c4c15), I rebuilt c156520b8b4 and ran the local TUI in a real Linux PTY. With either an inline API key or a protected token, the next model request used the new credential and the original model. For the protected case, a completed chat turn preceded sign-in and the profile on disk contained only a store-backed tokenRef. The provider and loopback model were synthetic. The GitHub-hosted device-code exchange was outside these runs. Committed PTY scenarios

Both cases covered cancellation, retry, and SIGTERM at a new sign-in prompt. Both processes exited normally within the existing four-second limit. A separate run surfaced an expired device code and displayed the provider-specific retry command in the TUI. Two isolated Gateway tests exercised node access for both credential-only and app-guided sign-in.

Terminal excerpts and focused validation on c156520b8b4

These are ordered excerpts from the built CLI. Terminal controls, redraws, masked input and host-specific identifiers have been omitted.

Inline API key
opening auth flow for tui-pty-mock
Enter T05 local auth API key
Setup cancelled.
auth flow failed: wizard cancelled
opening auth flow for tui-pty-mock
Enter T05 local auth API key
auth flow finished for tui-pty-mock
prompt after local auth
LOCAL_AUTH_RESPONSE
opening auth flow for tui-pty-mock
Enter T05 local auth API key

Protected token after a completed chat turn
warm the session before sign-in
WARM_SESSION_READY
opening auth flow for tui-pty-mock
Enter T05 local auth token
Setup cancelled.
auth flow failed: wizard cancelled
opening auth flow for tui-pty-mock
Enter T05 local auth token
auth flow finished for tui-pty-mock
prompt after local auth
STORED_TOKEN_RESPONSE
opening auth flow for tui-pty-mock
Enter T05 local auth token

From delivery of the final SIGTERM to exit_group(0), Linux recorded 282 ms for the inline key and 294 ms for the protected token. Both exit codes were 0 with no terminating signal.

The built-CLI cases passed with the pinned OpenClaw Bun runtime on this commit and with Node 24.22.1 on the identical staged source tree. Another 165 tests in 10 files passed, including Gateway node access, CLI recovery, command cleanup and prompt stability. The QA runtime build, core and commands-test typechecks, scoped formatting and lint, and git diff --check passed. Local autoreview covered the complete PR diff from 265577c4c15 to the staged tree committed as c156520b8b4 and reported no actionable P0–P2 findings.

Original failure controls and the November 18–19 terminal captures
Revision and scenario Observed result
Original base eceb208abea, local built-in login The login child reported that it could not acquire gateway state ownership while the TUI held it.
Previous PR head a7273a36e2b, protected login after a completed turn The profile contained a store-backed tokenRef. The next message produced the reported local error and zero new model requests.
Previous PR head, SIGTERM with a new sign-in prompt open The process remained alive past 18 s. An instrumented refresh-only comparison traced the live broker to one retained plugin source. Invoking the prepared-model runtime's close released that claim and the process exited normally.
Earlier verified head 6feedfb9b51, inline API key and warm-session protected token Both requests used the new credential and the original model. The protected profile contained only the reference. Both CLI processes exited with status 0 and no terminating signal within the original 4 s timeout.

On 6feedfb9b51, all 250 focused tests across 12 files passed. The two built-CLI auth scenarios passed under Node 24.21.0 and the pinned Bun runtime. The QA runtime build, production and affected test typechecks, scoped lint and formatting, staged line-cap check, and git diff --check passed. Independent local review of the staged PR range found no P0–P2 issues.

Terminal capture on 6feedfb9b51

Redacted terminal excerpts and signal observations

The excerpts below retain the order of observed product output. Terminal controls, repeated redraws, masked input, local paths, and the credential owner identifier have been omitted.

Protected login after one completed turn on the previous PR head

warm the session before sign-in
WARM_SESSION_READY
opening auth flow for tui-pty-mock
Enter T05 local auth token
auth flow finished for tui-pty-mock
prompt after local auth
secret reference was not materialized by the active runtime

Inline API key on commit 6feedfb9b51fe185c7adea67d171cd41fabd8fb3

opening auth flow for tui-pty-mock
Enter T05 local auth API key
Setup cancelled.
auth flow failed: wizard cancelled
opening auth flow for tui-pty-mock
Enter T05 local auth API key
auth flow finished for tui-pty-mock
prompt after local auth
LOCAL_AUTH_RESPONSE
local ready | idle
opening auth flow for tui-pty-mock
Enter T05 local auth API key

Protected token after one completed turn on the updated commit

warm the session before sign-in
WARM_SESSION_READY
local ready | idle
opening auth flow for tui-pty-mock
Enter T05 local auth token
Setup cancelled.
auth flow failed: wizard cancelled
opening auth flow for tui-pty-mock
Enter T05 local auth token
auth flow finished for tui-pty-mock
prompt after local auth
STORED_TOKEN_RESPONSE
local ready | idle
opening auth flow for tui-pty-mock
Enter T05 local auth token

On the updated commit, a Linux syscall trace measured 247 ms and 265 ms from the final SIGTERM to exit_group(0) for the inline and protected cases, respectively. The PTY runner also checked the process exit status and the absence of a terminating signal in each case. The wire and storage checks are runner assertions.

Earlier API-key terminal capture (2026-11-18)

This earlier replay used the clean commit a7273a36e2b9a1c4797af193a9421d8e7f803015, with the product PTY stream captured through the existing OPENCLAW_TUI_PTY_MIRROR_PATH hook. The driver launches the built openclaw.mjs tui --local in its own PTY and uses the embedded backend. The API-key provider and local HTTP model endpoint are synthetic, as in the reported reproduction.

Result: passed, 9.205 s for the scenario and 53.400 s wall time including worker preparation. The terminal capture shows cancellation, successful retry, resumed chat returning LOCAL_AUTH_RESPONSE, and another authentication prompt. At that last prompt the driver sends SIGTERM; the scenario verifies that the TUI exits with code 0.

The same passing committed scenario also checks the persisted credential digest against the entered value, verifies that the default model stays unchanged, and checks that the subsequent model request carries the new credential. These are test assertions; the block below is the captured terminal stream plus the corresponding runner output.

Sanitized product terminal capture and matching runner output
OpenClaw local TUI /auth — captured product terminal output
PR: openclaw/openclaw#200605
Commit: a7273a36e2b9a1c4797af193a9421d8e7f803015
Source state: clean before and after the run; existing committed scenario and capture hook, no source edits.
Captured: 2026-11-18 00:32:41 +08
UTC interval: 2026-11-17T16:32:41.043854+00:00 — 2026-11-17T16:33:34.443674+00:00
Host: Linux; launcher Node 24.21.0; package manager pnpm 12.15.0.
Build: pnpm build qaRuntime — passed.
Product entry: built openclaw.mjs tui --local in a real PTY, with the embedded backend.
External services: synthetic API-key provider and isolated local HTTP model endpoint.
Capture source: OPENCLAW_TUI_PTY_MIRROR_PATH (the product PTY output stream).
Runner exit: 0; observed wall time: 53.400 s.
Presentation: ANSI/OSC controls, empty/border rows and transient spinner frames removed.
Mask-only input redraws are replaced with explicit bracketed annotations.
The local worktree path is redacted. Credential text is absent; the prompt masks input.
Repeated conversation lines are normal TUI redraws and are retained.
This is a terminal capture, not a live hosted-provider OAuth qualification.

--- Product PTY output ---
◇
OpenClaw 2026.11.4 (a7273a3) — Your task has been queued; your dignity has been deprecated.
 openclaw tui - local embedded - agent main - session main
 agent main | session main | unknown | deliver:off | tokens ?
 session agent:main:main
 local ready | idle
 agent main | session main | gpt-5.5 | deliver:off | tokens ?/128k
 opening auth flow for tui-pty-mock; TUI will resume when it exits
 local ready | auth
 agent main | session main | gpt-5.5 | deliver:off | tokens ?/128k
◆  Enter T05 local auth API key
│  _
■  Enter T05 local auth API key
└  Setup cancelled.
 openclaw tui - local embedded - agent main - session main
 session agent:main:main
 opening auth flow for tui-pty-mock; TUI will resume when it exits
 auth flow failed: wizard cancelled
 local ready | error
 agent main | session main | gpt-5.5 | deliver:off | tokens ?/128k
 opening auth flow for tui-pty-mock; TUI will resume when it exits
 local ready | auth
 agent main | session main | gpt-5.5 | deliver:off | tokens ?/128k
◆  Enter T05 local auth API key
│  _
│  [masked input redraws omitted]
◇  Enter T05 local auth API key
│  [masked credential]
 openclaw tui - local embedded - agent main - session main
 session agent:main:main
 opening auth flow for tui-pty-mock; TUI will resume when it exits
 auth flow failed: wizard cancelled
 opening auth flow for tui-pty-mock; TUI will resume when it exits
 auth flow finished for tui-pty-mock
 local ready | idle
 agent main | session main | gpt-5.5 | deliver:off | tokens ?/128k
prompt after local auth
 agent main | session main | gpt-5.5 | deliver:off | tokens ?/128k
LOCAL_AUTH_RESPONSE
 agent main | session main | gpt-5.5 | deliver:off | tokens ?/128k
 session agent:main:main
 opening auth flow for tui-pty-mock; TUI will resume when it exits
 auth flow failed: wizard cancelled
 opening auth flow for tui-pty-mock; TUI will resume when it exits
 auth flow finished for tui-pty-mock
prompt after local auth
LOCAL_AUTH_RESPONSE
 agent main | session main | gpt-5.5 | deliver:off | tokens ?/128k
 local ready | idle
 agent main | session main | gpt-5.5 | deliver:off | tokens 2/128k (0%)
 opening auth flow for tui-pty-mock; TUI will resume when it exits
 local ready | auth
 agent main | session main | gpt-5.5 | deliver:off | tokens 2/128k (0%)
◆  Enter T05 local auth API key
│  _

--- Matching test-runner output excerpt ---
 RUN  v5.0.5 [isolated-worktree]
 ✓ |tui-pty| src/tui/tui-pty-local.e2e.test.ts > TUI PTY real backends > authenticates a manifest-discovered provider and resumes the unchanged local model 9205ms
 Test Files  1 passed (1)
      Tests  1 passed | 11 skipped (12)
   Start at  00:32:42
   Duration  51.06s (transform 78%, tests 18%, import 3%, worker 1%)
real 53.39
user 130.48
sys 23.00
Replay the normal sign-in PTY scenarios
pnpm build qaRuntime
OPENCLAW_TUI_PTY_INCLUDE_LOCAL=1 OPENCLAW_TUI_PTY_USE_BUILT_CLI=1 \
  node scripts/run-vitest.mjs run --config test/vitest/vitest.tui-pty.config.ts \
  src/tui/tui-pty-local.e2e.test.ts \
  -t 'authenticates a manifest-discovered provider' --maxWorkers=1

@clawsweeper

clawsweeper Bot commented Nov 17, 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 commands Command implementations size: M labels Nov 17, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Runs built-in provider login inside the local TUI, refreshes active credentials, and completes cancellation and resource cleanup during shutdown.

Example: Run /auth github-copilot after a completed local TUI chat turn.

  • Before: Login can encounter competing state ownership or leave the next message failing with “secret reference was not materialized by the active runtime.”
  • After: Sign-in and the next message succeed in the same session with the selected model preserved.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong production-entry-point evidence and focused owner repairs; required broad CI has not executed on the current head.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Inspected jtmyershp's Linux Copilot screenshot and terminal report covering real device-code login, warm-session reauthentication, subsequent replies, and clean exit on c156520; the unchanged successful-login path is supported by latest-head built-CLI replays, and d2e80ad adds before/after terminal evidence for queued-save cancellation and real-resource cleanup after model-close rejection.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Local TUI users cannot reliably finish built-in provider sign-in and use the saved credential without restarting.
Reason: Restores documented /auth behavior, preserves model selection and external Codex delegation, and resolves concrete shutdown failures reported by a maintainer.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this PR repairs current local TUI sign-in failures and addresses both maintainer-reported shutdown defects; no actionable code findings remain.

Reviewed head: d2e80ad212965b727b68ae12e6c54c1f5652bb92

Before merge

  • Await maintainer action - Approve the workflow runs awaiting action for d2e80ad so required CI can execute.

Findings

None.

Agent review details

How this fits together

The local TUI holds state ownership and drives the embedded agent; provider login saves credentials through shared persistence, publishes them into the active runtime, and returns control to chat.

flowchart TD
  A[Local TUI] --> B[Shared provider login]
  B --> C[Credential persistence]
  C --> D[Active credential snapshot]
  D --> E[Embedded model request]
  A --> F[Shutdown owner]
  F --> G[Prepared model retirement]
  G --> H[Database and worker cleanup]
Loading

Technical review

Best possible solution:

Land the existing-owner sign-in and shutdown repair after the approved current-head workflows satisfy required CI.

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

Current-main source establishes the competing process ownership and stale credential-publication paths, corroborated by supplied failure controls; this read-only review executed no target code.

Is this the best way to solve the issue?

The patch fixes the responsible boundaries directly by reusing shared login, persistence, snapshot publication, and ordered cleanup instead of adding another state owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current main retains the conflicting process boundary: Current main still launches built-in models auth login as a child while runTui retains local state ownership, so the central repair is not already implemented. (src/tui/tui.ts:1009, d0f826bea860)
  • Existing owners provide the complete repair: runLocalProviderLogin invokes the shared login command with a non-exiting runtime, cancellation, and the existing provider-auth snapshot refresh; the obsolete built-in child invocation is removed. (src/tui/tui-auth-invocation.ts:13, d2e80ad21296)
  • Queued credential cancellation reaches persistence: The new assertCurrent callback reaches the existing beforeWrite check after per-profile lock acquisition; the added integration regression aborts a waiting replacement and verifies that the previous credential survives. (src/cli/models-cli.auth-login.integration.test.ts:122, d2e80ad21296)
  • Rejected model retirement no longer skips shared cleanup: Prepared model retirement uses a separate ordered disposer whose rejection is reported by the existing cleanup owner; the regression verifies delayed settlement followed by database, worker, and PostgreSQL cleanup. (src/cli/runtime-cleanup-scope.ts:113, d2e80ad21296)
  • Independent live Copilot verification: jtmyershp verified real GitHub Copilot device-code login, a model reply, warm-session reauthentication, another reply on the same model, and clean exit on c156520; the downloaded terminal screenshot corroborates both successful exchanges: fix: let local TUI /auth sign in to providers again #200605 (comment). (c156520b8b48)
  • Latest-head shutdown evidence: The full PR body records before/after built-TUI output for cancellation while awaiting the profile lock and compiled cleanup output with real SQLite, native-worker, and PostgreSQL resources; both reported failures are resolved on d2e80ad. (d2e80ad21296)

Likely related people:

  • Vincent Koc: Raw commit 4591070 adds src/tui/tui-auth-invocation.ts:12 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4591070b2f4b; files: src/tui/tui-auth-invocation.ts)
  • Peter Steinberger: Raw commit c83937d adds src/agents/prepared-model-runtime.lifecycle.ts:7 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c83937d8ebfd; files: src/agents/prepared-model-runtime.lifecycle.ts)

PR surface

Source +40, Tests +120, Docs +2. Total +162 across 16 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 9 130 90 +40
Tests 6 277 157 +120
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 409 247 +162

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Root-cause cluster

Relationship: canonical
Canonical: #200605
Summary: This PR owns the combined local sign-in ownership and same-session credential-publication repair.

Members:

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

Labels

Label changes:

  • add status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: ⏳ waiting on maintainer.

Label justifications:

  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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.

History

Review history (4 earlier review cycles)
  • reviewed 2026-11-17T13:45:50.787Z sha a7273a3 :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-17T16:46:18.669Z sha a7273a3 :: blocked before merge. :: none
  • reviewed 2026-11-19T11:31:58.449Z sha 6feedfb :: needs maintainer review before merge. :: none
  • reviewed 2026-11-22T08:31:06.165Z sha c156520 :: needs maintainer review before merge. :: none

Reviewed November 27, 2026, 1:41 AM ET / 06:41 UTC (Revision 5).

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Added the requested sanitized product terminal capture directly to the PR body under Captured terminal evidence (2026-11-18). It was freshly recorded from the built CLI at unchanged head a7273a36e2b9a1c4797af193a9421d8e7f803015.

The capture shows cancellation, successful retry, resumed chat, and the final authentication prompt before SIGTERM. The matching scenario passed in 9.205 s and verifies credential persistence, next-request credential use, unchanged model selection, and exit code 0. The synthetic-provider/local-model scope and redaction details are stated alongside the capture.

@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

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: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Nov 17, 2026
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes agents Agent runtime and tooling size: L and removed size: M labels Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please review 6feedfb9b51fe185c7adea67d171cd41fabd8fb3 for #200558 and #201751. The PR body now includes redacted terminal excerpts from the old and updated revisions. The built local TUI uses the new store-backed token on the next HTTP request after an earlier chat turn. The prompt-open SIGTERM comparison also identified and verified cleanup of the retained model runtime. Both the inline-key and protected-token cases exited normally within the original four-second limit.

@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Nov 19, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. labels Nov 19, 2026
wangmiao0668000666 added a commit to wangmiao0668000666/openclaw that referenced this pull request Nov 19, 2026
The child-process login could not acquire gateway state ownership while the
TUI held it, so /auth failed before the post-login refresh ever ran. Run the
login in-process through the TUI's own state owner (sharing the embedded
runtime), matching the approved openclaw#200605 shape.

The post-login republish still goes through the module-scoped secrets-layer
binding (refreshRuntimeAuthProfileStoreAfterLogin), so the persisted store is
re-observed and republished into the active runtime generation without
relying on an external file event. The prepared-model-runtime lifetimes key is
exposed so CLI cleanup releases model generations backed by native workers,
letting the TUI exit on SIGTERM while an auth prompt is open.

Regression: the built-CLI PTY scenario now exercises cancellation, retry,
credential entry, and a resumed request carrying the new credential for both
an inline API key and a store-backed token.

Co-Authored-By: nebulacoder-v8.0 <[email protected]>
Merge upstream main after openclaw#203394. Keep provider recovery messages and Gateway node access in the shared sign-in flow while the local TUI retains prompt cancellation and credential refresh.
@ArcueidMP

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Nov 22, 2026
@ArcueidMP

Copy link
Copy Markdown
Contributor Author

@jtmyershp thanks again for the detailed reports in #200558 and #201751. This PR fixes both and is waiting for maintainer review. One part is still unverified: my runs used a synthetic provider and token, so GitHub Copilot's real device-code sign-in wasn't covered.

If you have a few minutes, could you try the PR head (c156520b8b4) on your setup?

  1. Check out the PR (gh pr checkout 200605) and build it the way you built 83e3641e092.
  2. In openclaw tui --local, re-run your steps from both issues with the built-in GitHub Copilot sign-in, without restarting the TUI.
  3. If you can, sign in once more after a chat turn has completed in the same session, then send another message.

A short reply is enough: whether it worked, or where it failed with the error text (for example, secret reference was not materialized by the active runtime). Please leave tokens out of anything you paste.

@jtmyershp

jtmyershp commented Nov 26, 2026 •

Copy link
Copy Markdown

@ArcueidMP Sorry for the delay, and thank you for everything you've done so far!

I built and tested PR head c156520b8b4 (pnpm build qaRuntime, Node v24.22.3 on Linux) against an unmodified clean state directory with github-copilot/claude-sonnet-5 and live GitHub Copilot browser device-code sign-in.

Everything worked end-to-end without restarting the TUI:

  1. Started node ./openclaw.mjs tui --local (claude-sonnet-5) and ran /auth → GitHub device login. Device-code auth completed in-process with no state-ownership conflict (auth flow finished for github-copilot), and sending test immediately returned a model reply.
  2. In the same warm session (after that completed turn), ran /auth again, confirmed re-running login (Auth profile: github-copilot:github (github-copilot/token)), and sent test again — it replied normally on github-copilot/claude-sonnet-5 with no secret reference was not materialized by the active runtime error.
  3. Exited cleanly via /exit (exit code 0).
openclaw-tui
Redacted terminal excerpt
openclaw tui - local embedded - agent main - session main
session agent:main:main
opening auth flow for github-copilot; TUI will resume when it exits
auth flow finished for github-copilot
test
Hey — I'm your new assistant, freshly booted up in this workspace. Before we get into anything, what would you like to call me?
opening auth flow for github-copilot; TUI will resume when it exits
auth flow finished for github-copilot
test again
Still waiting on you for this one — what should I call you (me, I mean)? Once I've got a name I'll pick a vibe and emoji, then we can move on to an avatar.
agent main | session main | claude-sonnet-5 medium | deliver:off | tokens 21k/200k (10%)
[state/agent-db] agent database clean-close receipt: written; agent=main

@ArcueidMP

Copy link
Copy Markdown
Contributor Author

@jtmyershp Thanks! This was the one check I couldn't run myself: the real GitHub Copilot device-code sign-in. Your run covers both reports. Sign-in finished in-process with no state-ownership conflict (#200558), and signing in again after a completed turn kept working on the same model without the materialization error (#201751). Nothing more is needed from you; the PR is now waiting for maintainer review.

@daniel-lxs

Copy link
Copy Markdown
Member

I reproduced two shutdown bugs on c156520 that need fixing before merge. Aborting the local TUI while a credential save is waiting still lets the save go through with no cancellation guard and report success. Also, in runtime-cleanup-scope.ts, if closing the prepared model runtime rejects, the SQLite, native worker, and Postgres pool cleanup after it gets skipped.

Pass the local shutdown guard to the credential writer so a pending save cannot replace an existing profile after cancellation. Retire prepared models as a separate ordered CLI disposer so a rejected model close still allows shared resources to drain.
@ArcueidMP

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Both shutdown cases reported on c156520b8b4 are fixed in d2e80ad2129. I reproduced the credential save after SIGTERM and the skipped resource cleanup on the previous head. The same probes pass on this commit, along with the original local sign-in scenarios. The PR description includes the redacted before/after output and links to both regression tests.

@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 27, 2026
@ArcueidMP

Copy link
Copy Markdown
Contributor Author

Thanks for catching these. Both are fixed in d2e80ad:

  1. Aborting the local TUI while a credential save is waiting no longer saves or reports success. The TUI now passes its abort signal as the login's assertCurrent, and the credential write checks it after getting the auth profile lock and before writing. Covered by keeps the previous credential when the local TUI exits with a save waiting in src/cli/models-cli.auth-login.integration.test.ts.
  2. Retiring prepared model runtimes is now its own ordered CLI disposer, before shared-state. A rejected or overdue model close is reported, and the SQLite, native worker, and Postgres cleanup still runs after it. Covered by closes shared resources in order after an overdue prepared model fails to close in src/cli/runtime-cleanup-scope.test.ts.

Both tests fail on c156520 and pass on d2e80ad.

@daniel-lxs
daniel-lxs merged commit a8f3e66 into openclaw:main Nov 27, 2026
142 of 144 checks passed
vincentkoc added a commit that referenced this pull request Nov 27, 2026
* commit 'fd681ab8786e062045fa5ec6261b1b06f60832eb': (2115 commits)
  fix: keep doctor --fix pending checks from creating SQLite sidecars (#206485)
  fix(ci): update iOS screenshot reducer gate (#206497)
  fix: keep chat photo previews sharp within their byte limits (#206461)
  fix: let agents use short Workboard card IDs
  fix(tui): run provider sign-in in the local TUI (#200605)
  improve(config): reduce repeated directory checks for larger agent rosters (#206494)
  perf(test): reuse the Periphery producer workflow snapshot (#189681)
  fix(ci): keep locale assets within the installed package budget (#206492)
  fix: preserve failed Apple chat messages across partial history pages (#205404)
  improve: avoid merging unrelated settings for agent directory lookups (#206489)
  fix: show typing while a queued follow-up turn runs (#201920)
  fix: stop 2026-11-17 main Git checkouts from half-switching on a schema update (#206341)
  refactor(codex): centralize native completion delivery (#206447)
  fix(subagents): finish claimed stops after session rotation (#206405)
  fix: let owners fork a chat with exec after a subagent or exec completion (#206483)
  test(cli): gate agent --local cold-start processes and workers (#206466)
  perf(ci): skip baseline inventory when line-cap debt is empty (#189909)
  refactor(test): share core process-result fixtures (#174149)
  refactor(ci): reuse canonical budget flag parsing (#189480)
  fix: recover Codex chats after oversized requests (#206475)
  ...
vincentkoc added a commit that referenced this pull request Nov 27, 2026
* commit 'fd681ab8786e062045fa5ec6261b1b06f60832eb': (923 commits)
  fix: keep doctor --fix pending checks from creating SQLite sidecars (#206485)
  fix(ci): update iOS screenshot reducer gate (#206497)
  fix: keep chat photo previews sharp within their byte limits (#206461)
  fix: let agents use short Workboard card IDs
  fix(tui): run provider sign-in in the local TUI (#200605)
  improve(config): reduce repeated directory checks for larger agent rosters (#206494)
  perf(test): reuse the Periphery producer workflow snapshot (#189681)
  fix(ci): keep locale assets within the installed package budget (#206492)
  fix: preserve failed Apple chat messages across partial history pages (#205404)
  improve: avoid merging unrelated settings for agent directory lookups (#206489)
  fix: show typing while a queued follow-up turn runs (#201920)
  fix: stop 2026-11-17 main Git checkouts from half-switching on a schema update (#206341)
  refactor(codex): centralize native completion delivery (#206447)
  fix(subagents): finish claimed stops after session rotation (#206405)
  fix: let owners fork a chat with exec after a subagent or exec completion (#206483)
  test(cli): gate agent --local cold-start processes and workers (#206466)
  perf(ci): skip baseline inventory when line-cap debt is empty (#189909)
  refactor(test): share core process-result fixtures (#174149)
  refactor(ci): reuse canonical budget flag parsing (#189480)
  fix: recover Codex chats after oversized requests (#206475)
  ...
tideclaw-bot pushed a commit that referenced this pull request Nov 28, 2026
Run built-in provider sign-in under the local TUI's existing state owner and
refresh saved credentials for the next message on the selected model.

Cancel pending credential writes during shutdown and retire prepared model
runtimes before draining shared state.

(cherry picked from commit a8f3e66)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 28, 2026
Run built-in provider sign-in under the local TUI's existing state owner and
refresh saved credentials for the next message on the selected model.

Cancel pending credential writes during shutdown and retire prepared model
runtimes before draining shared state.
tideclaw-bot pushed a commit that referenced this pull request Nov 28, 2026
Run built-in provider sign-in under the local TUI's existing state owner and
refresh saved credentials for the next message on the selected model.

Cancel pending credential writes during shutdown and retire prepared model
runtimes before draining shared state.

Release adaptation: Extend the existing inline login options and pass the abort signal to Clack. Keep stable relogin identity, persistence checks, and error propagation; omit the upstream type split, node auth surface, and failure formatter. Retain the upstream in-process login, runtime snapshot refresh, orderly model-runtime disposal, and external Codex login path.

Follow-ups: No later changes in the pinned main range touch the production owners.

(cherry picked from commit a8f3e66)
Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
* perf(agents): prepare fallback rate-limit routes with model snapshots

Reuse configured fallback models within the admitted config snapshot and share provider handles across configured normalization hooks. Preserve cold resolution for standalone or mismatched snapshots and reload route facts with their owning snapshot.

* fix(agents): preserve static model selection during fallback preparation

Skip projection for agents without configured fallbacks. Match the production plugin-runtime scope in fallback benchmarks and regressions so both variants use the same retained registry.

(cherry picked from commit 2b58c8e)

Companion audit: #201632 is selected to preserve registry and metadata ownership for the fallback hot path. #200605, #203901, #203095 and #202618 make independent TUI, custody, module separation and model listing changes; none is required by this port.

Co-authored-by: RomneyDa <[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 cli CLI command changes commands Command implementations docs Improvements or additions to documentation 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: L status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

3 participants