Skip to content

fix(tui): local /auth exits 1 with no diagnostics when the session provider is CLI-backed - #125677

Merged
obviyus merged 2 commits into
openclaw:mainfrom
P5ina:fix/tui-local-auth-diagnostics
Aug 28, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
P5ina:fix/tui-local-auth-diagnostics

Conversation

@P5ina

@P5ina P5ina commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #125635

What Problem This Solves

Fixes an issue where local TUI users could run /auth, get only auth flow failed (exit 1), and find no useful tui/auth record.

It also fixes a dead end where a session that uses a CLI-only provider could send that provider to an OpenClaw auth wizard that cannot authenticate it.

Why This Change Was Made

The foreground auth-child owner now records one bounded, redacted JSON argument list and the child result. The TUI uses that same result for the visible failure message. This preserves the existing child shutdown owner from #126476.

The provider-auth command now detects a requested CLI-only provider through the existing provider registry. It explains the mismatch and opens the supported provider picker. It does not hardcode a provider.

Explicit OpenAI auth still delegates to codex login. Session-derived CLI providers no longer enter the Codex path by accident.

User Impact

  • A failed local /auth action ends with an actionable bounded result.
  • The file log records redacted tui/auth spawn and result events.
  • A CLI-only session provider opens the provider picker instead of a dead-end wizard.
  • Interactive terminal behavior, successful provider auth, and Codex delegation stay unchanged.

Evidence

Live red and green used the real local TUI in a PTY. Each run used disposable HOME, OpenClaw state, config, XDG, workspace, binary, and temp directories. A deterministic child failed or succeeded at the real process boundary.

Scenario Dispatch main 640d73e Live-proven repair cb1aaf0
Failed /auth openai Final frame: auth flow failed (exit 1); 0 tui/auth records Final frame includes bounded redacted JSON arguments and retry guidance; 2 tui/auth records
Session provider is CLI-only Provider command rejects the provider; final result stays generic Provider picker opens; captured child arguments are ["models","auth","login","--provider","claude-cli"]
Explicit /auth openai Delegates to Codex Still delegates to Codex; captured Codex arguments are ["login"]; TUI reports success

The failure child wrote a fake secret-like diagnostic. It did not appear in the repaired visible result or either repaired tui/auth record.

The security follow-up at cbdcb64 changes only the auth argument redactor and its regression test. Auth arguments now use the existing merged UI-payload policy, so custom logging.redactPatterns add to built-in token masking instead of replacing it. The new formatter-boundary test failed on cb1aaf0 because a token-shaped argument remained visible, then passed on cbdcb64; the operator's custom pattern remained active in the same result.

Current main was also checked at 5b07247. The affected auth and redaction owner files have no overlapping repair that supersedes this PR.

Required Codex Source Check

The reviewer personally inspected the sibling Codex source at commit a73bf25d17805 and mapped it to the retained PTY result:

  • codex-rs/cli/src/main.rs:1515-1555 routes a bare login argument to run_login_with_chatgpt.
  • codex-rs/cli/src/login.rs:116-119 writes browser-login guidance to stderr.
  • codex-rs/cli/src/login.rs:170-200 exits with status 0 on success or status 1 with an stderr error on failure.
  • The repaired PTY capture records the explicit OpenAI child arguments as exactly ["login"].
  • The OpenClaw child keeps inherited interactive standard input and output, so the Codex interaction contract is unchanged.

Validation on the exact repaired head:

  • One full build passed. Its build and runtime stamps name cb1aaf06f30e631f496f37333caa264b3d3a55ed.
  • 230 focused TUI tests passed on the live-proven repair.
  • 45 provider-auth tests passed on the live-proven repair.
  • 3 real-PTY auth-child tests passed on the live-proven repair.
  • The security follow-up passed 179 redaction tests and 6 TUI auth tests.
  • The security regression failed before the redactor cutover and passed after it.
  • Focused formatting and lint passed on the security follow-up.
  • Exact-head hosted CI passed on cbdcb64ceda68daa6dc9c7b1d4e7613f1ec58573.
  • Exact-head local ClawSweeper passed with no findings, security concerns, maintainer decisions, or rank-up moves.
  • The changed-scope gate passed formatting, type checks, lint, dead-code scans, dependency guards, and repository guards.
  • git diff --check passed.

Change Size

  • Production: +80/-31 lines, net +49.
  • Tests: +143/-6 lines, net +137.

The production growth adds one bounded diagnostic result at the existing foreground-child owner and one registry-driven picker route. The security follow-up is net-neutral production and reuses the existing merged UI redactor. The repair replaces the contributor branch's parallel lifecycle path and reduces its earlier net production growth by 96 lines. No new config, schema, protocol, fallback stack, or provider-specific policy was added.

@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@P5ina
P5ina marked this pull request as ready for review August 18, 2026 06:54
@P5ina
P5ina force-pushed the fix/tui-local-auth-diagnostics branch from 12972a6 to 6af711b Compare August 18, 2026 06:57
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 18, 2026
@clawsweeper

clawsweeper Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 28, 2026, 8:42 AM ET / 12:42 UTC.

ClawSweeper review

What this changes

The branch adds bounded local TUI auth diagnostics and redirects CLI-backed providers without an OpenClaw auth method to the interactive provider picker.

Regression provenance

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

Merge readiness

⚠️ Needs maintainer review before merge - 6 items remain

Keep open: the current head fixes a real P1 local-auth dead end, but its newly displayed and persisted auth argv can bypass built-in secret masking when custom log patterns are configured.

Priority: P1
Reviewed head: cb1aaf06f30e631f496f37333caa264b3d3a55ed

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The real-PTY evidence is strong, but the new diagnostic output needs the established merged redaction policy before it is merge-ready.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body documents red/green real local-TUI PTY runs with a deterministic child, including the observed improved failure result and retained lifecycle behavior.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body documents red/green real local-TUI PTY runs with a deterministic child, including the observed improved failure result and retained lifecycle behavior.
Evidence reviewed 5 items Introduced secret-exposure path: The new argv formatter uses log redaction before placing user-controlled auth arguments in both the TUI failure message and tui/auth records.
Redaction contract: Configured logging.redactPatterns replaces standard patterns for logs, while UI and diagnostic safety surfaces must retain independent built-in masking; the tool-payload helper explicitly merges both sets.
Current-main necessity: Current main still emits only a bare nonzero auth failure, records no auth-child diagnostic outcome, and rejects an unmatched CLI backend before reopening the provider picker.
Findings 1 actionable finding [P2] Use UI-safe redaction for the recorded auth argv
Security Needs attention Auth argv loses built-in secret masking: Custom log patterns replace ordinary log defaults, while the new formatter calls ordinary log redaction before sending argv to a UI safety surface and persistent subsystem logs.

How this fits together

The local TUI delegates /auth to either Codex or OpenClaw’s provider-auth command, then resumes and reports the foreground child result. Provider discovery determines whether a selected provider has an OpenClaw authentication flow or should return to the picker.

flowchart LR
  User[Local TUI user] --> Command[/auth command]
  Command --> Route[Provider auth routing]
  Route --> Child[Foreground auth child]
  Child --> Outcome[Exit result]
  Outcome --> Transcript[TUI transcript]
  Outcome --> Logs[Diagnostic logs]
Loading

Before merge

  • Use UI-safe redaction for the recorded auth argv (P2) - redactSensitiveText inherits logging.redactPatterns, which replaces the built-in patterns when customized. Because /auth arguments reach this newly displayed and persisted diagnostic, a token-like argument can be exposed despite the documented UI/diagnostic safety contract. Use redactToolPayloadText (or the equivalent merged-default policy) and add a custom-pattern regression.
  • Resolve security concern: Auth argv loses built-in secret masking - Custom log patterns replace ordinary log defaults, while the new formatter calls ordinary log redaction before sending argv to a UI safety surface and persistent subsystem logs.
  • Resolve merge risk (P1) - Custom logging.redactPatterns replaces built-in log masks, so the new argv diagnostic can expose a token-like /auth argument in the TUI and durable tui/auth logs.
  • Resolve merge risk (P1) - The net production delta is +49 lines; the redaction repair should be absorbed into the existing formatter rather than add another diagnostic path.
  • Resolve merge risk (P1) - Direct sibling Codex source was unavailable in this read-only environment, so the retained bare codex login contract was not independently rechecked here.
  • Complete next step (P2) - A focused mechanical redaction repair and regression test can address the sole blocking finding without changing the auth-routing design.

Findings

  • [P2] Use UI-safe redaction for the recorded auth argv — src/tui/tui.ts:191-192
  • [medium] Auth argv loses built-in secret masking — src/tui/tui.ts:192
Agent review details

Security

Needs attention: The new auth-argv diagnostic can expose sensitive text when users configure custom log redaction patterns.

PR surface

Source +49, Tests +114. Total +163 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 3 80 31 +49
Tests 4 120 6 +114
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 200 37 +163

Review metrics

Metric Value Why it matters
Production versus tests production +80/-31 (net +49); tests +120/-6 (net +114) The added diagnostic and provider-routing behavior is covered by focused auth, handler, formatter, and PTY tests, but needs the custom-redaction case.

Stored data model

Persistent data-model change detected: serialized state: src/tui/tui.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #125635
Summary: This PR is the active candidate fix for the reported local-TUI auth diagnostic and CLI-provider-picker bug.

Members:

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

Merge-risk options

Maintainer options:

  1. Preserve built-in masking for auth diagnostics (recommended)
    Use the UI/tool-payload redaction policy for rendered auth argv and add coverage with custom logging patterns before merge.
  2. Pause the diagnostic expansion
    If the redaction contract cannot be preserved without changing the diagnostic design, pause this branch rather than persist the new argv surface.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Use the merged UI/tool-payload redaction policy for rendered auth argv and add a custom-pattern regression covering the visible failure text and tui/auth logs.

Technical review

Best possible solution:

Keep one foreground-child diagnostic flow, but route its rendered argv through the merged UI/tool-payload redaction policy and prove custom-pattern configurations preserve built-in token masking.

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

Yes for the source path: current main returns only the exit status and rejects the CLI-backed provider before the picker; the supplied PR body also records a red/green real-PTY run, though this read-only review did not execute it.

Is this the best way to solve the issue?

No: recording the child outcome at the existing owner is the right shape, but the formatter must use the safety-surface redaction contract before exposing argv.

Full review comments:

  • [P2] Use UI-safe redaction for the recorded auth argv — src/tui/tui.ts:191-192
    redactSensitiveText inherits logging.redactPatterns, which replaces the built-in patterns when customized. Because /auth arguments reach this newly displayed and persisted diagnostic, a token-like argument can be exposed despite the documented UI/diagnostic safety contract. Use redactToolPayloadText (or the equivalent merged-default policy) and add a custom-pattern regression.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.93

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 468054f93c43.

Labels

Label changes:

  • add merge-risk: 🚨 security-boundary: The patch creates a new persistent and visible argv diagnostic that can weaken built-in secret masking under custom log configuration.
  • remove merge-risk: 🚨 compatibility: Current PR review merge-risk labels are merge-risk: 🚨 security-boundary, merge-risk: 🚨 auth-provider.
  • remove merge-risk: 🚨 availability: Current PR review merge-risk labels are merge-risk: 🚨 security-boundary, merge-risk: 🚨 auth-provider.

Label justifications:

  • P1: This fixes a broken interactive provider-auth path that currently leaves users with an unactionable failure.
  • merge-risk: 🚨 security-boundary: The patch creates a new persistent and visible argv diagnostic that can weaken built-in secret masking under custom log configuration.
  • merge-risk: 🚨 auth-provider: The patch changes how CLI-backed provider selections transition into the OpenClaw provider-auth picker.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The PR body documents red/green real local-TUI PTY runs with a deterministic child, including the observed improved failure result and retained lifecycle behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body documents red/green real local-TUI PTY runs with a deterministic child, including the observed improved failure result and retained lifecycle behavior.

Evidence

Security concerns:

  • [medium] Auth argv loses built-in secret masking — src/tui/tui.ts:192
    Custom log patterns replace ordinary log defaults, while the new formatter calls ordinary log redaction before sending argv to a UI safety surface and persistent subsystem logs.
    Confidence: 0.96

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs src/tui/tui.local-auth.test.ts src/tui/tui-command-handlers.test.ts src/logging/redact.test.ts.
  • [P1] node scripts/run-vitest.mjs run --config test/vitest/vitest.tui-pty.config.ts src/tui/tui-auth-child-pty.e2e.test.ts.
  • [P1] node scripts/check-changed.mjs -- src/tui/tui.ts src/tui/tui.local-auth.test.ts.
  • [P1] git diff --check.

What I checked:

  • Introduced secret-exposure path: The new argv formatter uses log redaction before placing user-controlled auth arguments in both the TUI failure message and tui/auth records. (src/tui/tui.ts:192, cb1aaf06f30e)
  • Redaction contract: Configured logging.redactPatterns replaces standard patterns for logs, while UI and diagnostic safety surfaces must retain independent built-in masking; the tool-payload helper explicitly merges both sets. (src/logging/redact.ts:960, cb1aaf06f30e)
  • Current-main necessity: Current main still emits only a bare nonzero auth failure, records no auth-child diagnostic outcome, and rejects an unmatched CLI backend before reopening the provider picker. (src/tui/tui-command-handlers.ts:483, 468054f93c43)
  • Prior lifecycle fix retained: The branch continues to register the spawned child with the foreground owner, which the merged lifecycle repair introduced for shutdown safety. (src/tui/tui-auth-child.ts:62, 13fd88828162)
  • Focused regression coverage: The new PTY test covers a failed child after TUI resume, and the formatter test covers bounded default redaction, but neither covers a custom logging.redactPatterns configuration. (src/tui/tui.local-auth.test.ts:8, cb1aaf06f30e)

Likely related people:

  • steipete: Auth-child ownership and shutdown behavior were introduced in the merged local-auth lifecycle repair; current branch retains that owner. (role: recent TUI lifecycle owner; confidence: high; commits: 13fd88828162, cf7f06e69e23; files: src/tui/tui-auth-child.ts, src/tui/tui.ts)
  • Jesse Merhi: Recent auth-area history includes the provider-auth work that the picker fallback extends, though deeper provenance was unavailable in this partial clone. (role: recent provider-auth contributor; confidence: medium; files: src/commands/models/auth.ts)

Rank-up moves

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

  • Replace the formatter’s log-redaction call with the UI/tool-payload policy and test custom logging.redactPatterns.
  • Re-run the failed local-TUI PTY scenario after the redaction repair and redact any private output.

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 (13 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-18T08:29:05.113Z sha 92603ae7a448c325094350d403618fb95d51f0b5 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-18T08:59:46.120Z sha 00a4a43a95784377eed2cfa68f2d5484e0b3d7cb :: needs changes before merge. :: [P2] Preserve direct auth for CLI backends with provider auth
  • reviewed 2026-08-18T09:41:00.734Z sha 0ec3ca0d36e6818e76aaec1d9235a730853a3b4a :: needs changes before merge. :: [P1] Consult the local TUI's scoped registry for provider auth
  • reviewed 2026-08-18T10:09:07.644Z sha 7c17c859fdc30553f1417ee4aa293150db817414 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-21T15:27:27.621Z sha 7c17c859fdc30553f1417ee4aa293150db817414 :: needs changes before merge. :: [P1] Retain the current auth-child owner
  • reviewed 2026-08-22T19:09:05.819Z sha 7c17c859fdc30553f1417ee4aa293150db817414 :: needs changes before merge. :: [P1] Retain the current auth-child owner
  • reviewed 2026-08-24T19:44:02.419Z sha 7c17c859fdc30553f1417ee4aa293150db817414 :: needs changes before merge. :: [P1] Retain the foreground auth-child owner
  • reviewed August 24, 2026, 4:14 PM ET / 20:14 UTC sha unknown :: needs changes before merge. :: [P1] Retain the foreground auth-child owner

@P5ina

P5ina commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the review in db8c6bd534:

Retry-command quoting (P2, src/tui/tui.ts:1366) — fixed. Command-line rendering now goes through formatAuthWizardCommandLine, which quotes tokens per platform: double quotes with "" escaping for cmd.exe (covers the spaced C:\Program Files\Codex\codex.bat shim case from the finding), single quotes with '\'' escaping for POSIX shells. The helper owns rendering for both the chat retry hint and the tui/auth log entries, so the display logic exists once. Regression coverage added in src/tui/tui.local-auth.test.ts for the spaced Windows shim path, a spaced+quoted POSIX path, and the unquoted simple case (242 TUI unit tests green; pnpm check:changed green).

Codex sibling inspection (P1 merge risk) — done before the original push; the citations are in the PR body's "Why This Change Was Made": codex-rs/cli/src/login.rs:114-118 (progress via eprintln! on stderr), :168-200 (run_login_with_chatgpt exits 0/1 via std::process::exit), :174-181 (disallowed login method → instant exit 1), :100-110 (codex's own login file log). This PR does not change the codex invocation: same resolved binary, same single login argument, stdio: "inherit" retained, and the openai → codex login delegation is explicitly excluded from the CLI-backed picker fallback.

Production LOC (P1 merge risk) — the net production growth is the new capability itself: a tui/auth subsystem logger where the TUI previously had none, a structured spawn outcome (commandLine) replacing the bare exit status, and the CLI-backed-provider gate reusing the existing isCliProvider abstraction. Duplicate display logic is absorbed into the single rendering helper; the remainder has no smaller expression that keeps the failure outcome recorded and pasteable.

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. label Aug 18, 2026
@P5ina

P5ina commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up finding addressed in 75cc5aed31: formatAuthWizardCommandLine now uses a per-platform safe-token whitelist instead of a whitespace/quote blacklist — any token outside [\w@%+=:,./-] (POSIX) / [\w@+=:,.\/\\-] (win32; % excluded because cmd expands %var% even inside double quotes) is quoted. Added regression cases for $ in a POSIX path and &/%USERNAME% in Windows paths (243 TUI unit tests green).

@P5ina

P5ina commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Percent-expansion finding addressed in cf539bfe22, following the "do not advertise this string as pasteable" option: formatAuthWizardCommandLine now returns { commandLine, pasteable }. pasteable is false when no quoting can make the line safe to paste — win32 tokens containing % (cmd expands %var% even inside double quotes) or newlines, POSIX tokens containing newlines. /auth keeps the rerun hint only for pasteable lines and otherwise shows failed command (quote it for your shell before rerunning): …, so the recovery text never promises a paste that cmd.exe would corrupt. Regression coverage: %USERNAME% path now asserts pasteable: false plus a handler test for the degraded message (244 TUI unit tests green, pnpm check:changed green).

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 18, 2026
@P5ina

P5ina commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

The "picker cannot be reached without --provider" finding does not match the shipped parser: models auth login declares the flag as optional — src/cli/models-cli.ts:374 is .option("--provider <id>", …), not .requiredOption; the requiredOption("--provider …") declarations at :432/:458/:501/:522 belong to other models auth subcommands (e.g. paste-token). Live PTY proof added to the PR body's Evidence section: on this head (cf539bf), bare node openclaw.mjs models auth login renders the interactive "Select a provider" picker with no parsing error (isolated state, plugins enabled, ANSI-stripped capture quoted). The earlier picker-fallback PTY run's tui/auth log line (auth wizard spawn: provider=(picker) command=… models auth login → auth wizard finished) already exercised exactly this invocation through /auth claude-cli.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 18, 2026
@P5ina

P5ina commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Picker-intent finding confirmed and fixed in 92603ae7a4 — good catch, it reproduced live (fake codex shim on PATH, session on openai/gpt-5.5: /auth claude-cli printed the picker promise, then invoked the shim).

Fix follows the suggested shape: the auth target is now a closed TuiAuthFlowRequest ({kind: "provider", provider} | {kind: "picker"}) declared in src/tui/tui-types.ts, so picker intent is represented once at the auth-run boundary and can never be read as "no provider". The session-derived Codex rule in runAuthFlow is deleted outright — the handler already resolves the session provider before building the request, so codex login now triggers only on an explicit openai target (/auth no-arg in an OpenAI session still delegates, unchanged).

Evidence added to the PR body: live before/after with the shim (before: FAKE-CODEX-LOGIN-INVOKED; after: tui/auth log auth wizard spawn: provider=(picker) command=… models auth login, no shim output), plus a handler regression test for the explicit-provider/OpenAI-session combination that fails pre-fix. 245 TUI unit tests green, pnpm check:changed green.

On the LOC merge-risk item: this round is production +34/−12 by numstat, but the semantic change is net-reducing — the duplicated session-derived delegation branch is gone and picker intent exists in exactly one place; the numstat growth is the discriminated-union type plus formatter reflow of the touched promise signature.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 18, 2026
@P5ina

P5ina commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Dual-registration finding addressed in 0ec3ca0d36, following the suggested gate: the picker fallback now requires absent provider auth, not CLI-backend classification alone.

  • New runtimeProviderRegistersAuth(providerId) in src/plugins/active-runtime-registry.ts reads the active runtime registry (normalized id match, provider.auth non-empty). Placed on the light registry path deliberately — no loader/providers.runtime import added to the TUI static graph; pnpm build passes with no bootstrap-import or dynamic-import gate violations.
  • isCliBackedAuthWizardProvider(candidate, config) (exported from src/tui/tui.ts) diverts to the picker only when the id is CLI-backed AND no plugin registers auth under it, with the explicit openai → codex delegation still excluded.
  • Regression coverage: registry-level tests for runtimeProviderRegistersAuth (auth-capable id → true, auth-less/unknown/no-registry → false, case-normalized) and predicate tests including the dual-registration case (CLI-backed id with registered auth keeps its direct flow). 248 TUI + 11 registry tests green, pnpm check:changed green.

Also noting for the exact-head CI item: the previous head's openclaw/ci-gate failure was the Control-UI startup-JS budget (334.1 vs 334.0 KiB) from a merge-ref against a pre-fix main window — this PR adds no UI bytes; after rebasing onto current main the full suite ran green (93 success / 0 failure) on 00a4a43a.

@P5ina

P5ina commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Scoped-registry finding addressed in 7c17c859fd, per the suggested repair: the gate now resolves auth availability from the setup provider contract, not the global registry alone.

  • New pluginSetupProviderRegistersAuth({provider, config}) in src/plugins/setup-registry.runtime.ts — reads enabled plugins' setup.providers[].authMethods from the same metadata snapshot (and with the same isInstalledPluginEnabled filter) that resolvePluginSetupCliBackendDescriptor uses, so it is visible exactly where isCliProvider's setup-metadata half is visible, including scoped/embedded registries and pre-runtime states.
  • isCliBackedAuthWizardProvider now mirrors isCliProvider's dual sourcing: divert to the picker only when neither the runtime registry (runtimeProviderRegistersAuth) nor setup metadata registers auth under the id.
  • Boundary regression added at the metadata layer (setup-registry.runtime.test.ts: auth-methods id → true; env-var-only, disabled-plugin, unknown → false; case-normalized) plus a predicate case where auth is visible only through setup metadata. 249 TUI + 16 plugins tests green, pnpm check:changed green.
  • Bundled reality check: the anthropic plugin registers cliBackends: ["claude-cli"] with setup provider id anthropic — ids differ, so the reported claude-cli → picker behavior is unchanged; only a plugin declaring setup auth under its own CLI-backend id keeps its direct flow.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 18, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 21, 2026
@obviyus
obviyus force-pushed the fix/tui-local-auth-diagnostics branch from 7c17c85 to cb1aaf0 Compare August 28, 2026 12:28
@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: M and removed size: L labels Aug 28, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Aug 28, 2026
@obviyus
obviyus merged commit 22d4279 into openclaw:main Aug 28, 2026
265 checks passed
@obviyus

obviyus commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Thanks @P5ina!

Proof: In an isolated real local TUI session, a deterministic provider-auth child exited with status 1. The old build ended with only auth flow failed (exit 1) and no tui/auth record. The repaired build showed bounded redacted arguments and retry guidance, wrote spawn and result records, opened the provider picker for a CLI-only session provider, and kept explicit OpenAI auth delegated to Codex. A follow-up regression also proved that custom log patterns cannot disable built-in token masking.

  • Bug: Local /auth failures lost useful diagnostics, and CLI-only session providers could enter an auth wizard that could not authenticate them.
  • Fix: The foreground auth-child owner now returns and logs one bounded redacted result, while the provider-auth owner opens its supported picker and keeps built-in masking active.

Example

Before After
auth flow failed (exit 1) with no auth log Bounded redacted arguments, retry guidance, and tui/auth spawn/result records

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 29, 2026
Make local TUI auth failures actionable while preserving the foreground child lifecycle, provider picker routing, and built-in token masking under custom redaction patterns.

Co-authored-by: Timur Turatbekov <[email protected]>
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

commands Command implementations merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: TUI /auth (local mode) — spawned auth wizard exits 1 instantly, no diagnostics in TUI or file log

2 participants