Skip to content

fix(tui): restore provider auth in installed local mode - #119283

Merged
vincentkoc merged 6 commits into
mainfrom
t05-tui-local-recovery-auth-20260804
Aug 4, 2026
Merged

vincentkoc merged 6 commits into
mainfrom
t05-tui-local-recovery-auth-20260804

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where users running the installed TUI in local mode could start /auth, but the real provider-auth child failed before prompting because the built TUI bundle derived ../../openclaw.mjs above the installed OpenClaw package.

The failure interrupted provider authentication instead of returning the user to the unchanged local model and a working chat turn.

Why This Change Was Made

The current-CLI invocation policy now has one canonical owner in src/infra/openclaw-cli-invocation.ts, shared by TUI and auto-reply. It resolves the package with resolveOpenClawPackageRootSync, preserves Node, Bun, source-checkout, built/package, execArgv, package-entry, and symlinked-launcher behavior, and returns the canonical package-root cwd.

The final ownership repair also preserves a basename launcher only when entryPackageRoot proves it belongs to an OpenClaw package. A foreign /other/openclaw.mjs now falls back to the canonical current package CLI.

Best-fix verdict: this is the correct owner-boundary repair because TUI and auto-reply need the same current-package launch policy. Rejected alternatives were a PTY-only cwd/env workaround, retaining the relative import.meta.url wrapper guess, duplicating the policy in TUI, or importing auto-reply into TUI.

User Impact

Installed local TUI users can complete provider /auth, resume the TUI on the unchanged primary model, and immediately complete a local model-backed turn. Config repair and validation-abort recovery remain functional without a Gateway.

Release note: Fixed provider authentication in installed local TUI mode, broken since v2026.4.22, so /auth resolves the current OpenClaw package and resumes local chat successfully.

No CHANGELOG.md delta is included, per contributor policy.

Evidence

Exact source

  • Frozen base: ef11eae39b29ad9c4123ba211ef4fa4ac005221c
  • Signed head: fdb70cd2dffca64dc1b77dd95db1e2c874b0576c
  • Source tree: 5ec3e6673b6c89a87db419abb95f39c65f7d3b7a
  • Punchcard session: ember-workshop-lantern-bs

Coverage and unique assertions

Coverage ID Unique matched assertion
tui.embedded-local-chat TUI PTY real backends drives and steers the real local backend with a mocked model endpoint
tui.config-repair-loop TUI PTY real backends repairs isolated config through the approved built CLI and resumes local chat
tui.gateway-free-recovery TUI PTY real backends renders safe validation-loop abort diagnostics through the real local backend
tui.local-auth-flow TUI PTY real backends authenticates a manifest-discovered provider and resumes the unchanged local model

The proof matrix contains exactly one matched assertion for each ID and four distinct matched assertions. The scenario outer timeout is 720000 ms, leaving startup and teardown margin around the four serial 150000 ms cases.

Validation

  • Node runtime: exact v24.18.0
  • Focused units: TUI core and launcher 86 passed, 0 failed; infra CLI invocation 7 passed, 0 failed; auto-reply command quoting/invocation 2 passed, 0 failed
  • Final review repair: TUI-owned auth children strip inspector flags through the shared TUI child policy while preserving required non-debug runtime flags; generic resolver and auto-reply behavior are unchanged
  • Private-QA build at runtime-proof head: pass, AWS run run_42c28e27c692
  • Exact built tui-local-runtime-recovery-pty scenario at runtime-proof head: 4 passed, 0 failed, 17 skipped, AWS run run_f7b04a8a0838
  • Scenario summary: 1 passed, 0 failed
  • At runtime-proof head, all eight changed-file SHA-256 values match between the clean exact local tree and the remote workspace
  • Evidence bundle: remote-3.2-t05-exact-8e6f16a-node24-20260804
  • Evidence manifest SHA-256: f34eb7a94ef935d25108298869eaa10cd88060fe2983e2b49a734a13ce9dfac1
  • Privacy scan: clean; no runtime auth sentinel, credential value, personal path, username, email, private host, or IP retained
  • Coverage uniqueness JSON: clean
  • Sol-high autoreview: final inspector-argument repair clean with 0.98 confidence

Stable Bun 1.3.14 is supported for install/package-script and launcher compatibility testing, not as an OpenClaw CLI host because it lacks node:sqlite. Its launcher rejection before PR code loads is expected; the required exact-head Bun proof is checks-fast-bun-launcher.

Prerequisite install run run_7da70c42f3d2 completed dependencies and package hooks and printed Done in 46.4s, but pnpm did not return before the hard outer timeout. Exit 124 is diagnostic only. The passing build reused the same exact lease without reinstall or resync.

Production delta

  • src/infra/openclaw-cli-invocation.ts: +93/-0
  • src/auto-reply/reply/commands-openclaw-cli.ts: +3/-73
  • src/tui/tui-exec-argv.ts: +34/-0
  • src/tui/tui-launch.ts: +1/-34
  • src/tui/tui.ts: +20/-53
  • Total production: +151/-160, net -9

The positive infra delta establishes the canonical invocation owner; the TUI leaf helper preserves one child-process policy while duplicate launch logic remains removed.

@vincentkoc vincentkoc self-assigned this Aug 4, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 4, 2026
@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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 5:25 PM ET / 21:25 UTC.

ClawSweeper review

What this changes

The PR centralizes OpenClaw CLI child-process resolution for local TUI authentication and auto-reply, with built-CLI PTY coverage for auth recovery.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open. Current main still contains the installed-TUI relative launcher path; the exact PR head replaces it with a shared package-root resolver, fixes the prior inspector-flag finding, and has no concrete correctness or security finding. Protected maintainer handling and remaining exact-head CI should complete before merge.

Priority: P2
Reviewed head: fdb70cd2dffca64dc1b77dd95db1e2c874b0576c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent shared-owner repair with strong targeted runtime proof and no identified patch defect.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body records exact-head built PTY output for provider auth, persisted credentials, and a resumed local model turn; it also records redaction checks.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body records exact-head built PTY output for provider auth, persisted credentials, and a resumed local model turn; it also records redaction checks.
Evidence reviewed 6 items Current-main defect remains: Current main retains the same TUI and auto-reply launcher blobs as the PR base; the relative wrapper path remains in the local-auth path.
Installed package contract: The package exposes openclaw.mjs at the package root as its CLI binary, which the old TUI-relative wrapper calculation can miss after bundling.
Shared owner at PR head: The resolver derives an OpenClaw package root, preserves only an owned launcher, and returns the canonical child working directory.
Findings None None.
Security None None.

How this fits together

The local TUI starts an OpenClaw child process for provider authentication. That child must resolve the installed package entry and working directory, then return users to their local chat session.

flowchart LR
  A[Installed local TUI] --> B[Provider auth command]
  B --> C[Shared CLI invocation resolver]
  C --> D[Provider auth child]
  D --> E[Credential storage]
  E --> F[Resumed local chat]
Loading

Before merge

  • Resolve merge risk (P1) - The change controls an installed local-auth child process; merge only after the remaining exact-head built-artifact and Node checks confirm the packaged launcher path.
  • Complete next step (P2) - This maintainer-authored, protected PR needs normal exact-head CI completion and maintainer review, not an automated repair lane.
Agent review details

Security

None.

PR surface

Source -9, Tests +278, Other +39. Total +308 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 5 151 160 -9
Tests 4 436 158 +278
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 39 0 +39
Total 10 626 318 +308

Review metrics

Metric Value Why it matters
Production versus test LOC delta production +151/-160; tests and QA +475/-158 The branch is net-negative in production while replacing duplicated launch policy with one shared owner and adding boundary coverage.

Stored data model

Persistent data-model change detected: migration/backfill/repair: qa/scenarios/ui/tui-local-runtime-recovery-pty.yaml, serialized state: src/infra/openclaw-cli-invocation.test.ts, serialized state: src/tui/tui-pty-local.e2e.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Require exact-head built-package proof (recommended)
    Wait for the remaining exact-head build-artifact and Node checks before merging this provider-auth launch-path repair.

Technical review

Best possible solution:

Merge the shared resolver after exact-head CI is green, retaining the built local PTY regression that exercises provider authentication and resumed chat.

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

Yes, from source: current main derives the auth wrapper relative to the compiled TUI module although the packaged CLI lives at the package root. The supplied exact-head built PTY proof exercises the repaired path.

Is this the best way to solve the issue?

Yes. Reusing package-root discovery in one resolver is the narrowest maintainable fix because TUI and auto-reply otherwise retain divergent launcher policies.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8fc44585931d.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body records exact-head built PTY output for provider auth, persisted credentials, and a resumed local model turn; it also records redaction checks.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: The PR repairs a bounded installed local-TUI provider-authentication failure.
  • merge-risk: 🚨 availability: A regression in package or child-process resolution could leave installed local TUI users unable to authenticate.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body records exact-head built PTY output for provider auth, persisted credentials, and a resumed local model turn; it also records redaction checks.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body records exact-head built PTY output for provider auth, persisted credentials, and a resumed local model turn; it also records redaction checks.

Evidence

What I checked:

  • Current-main defect remains: Current main retains the same TUI and auto-reply launcher blobs as the PR base; the relative wrapper path remains in the local-auth path. (src/tui/tui.ts:88, 8fc44585931d)
  • Installed package contract: The package exposes openclaw.mjs at the package root as its CLI binary, which the old TUI-relative wrapper calculation can miss after bundling. (package.json:22, 8fc44585931d)
  • Shared owner at PR head: The resolver derives an OpenClaw package root, preserves only an owned launcher, and returns the canonical child working directory. (src/infra/openclaw-cli-invocation.ts:45, fdb70cd2dffc)
  • Prior review finding resolved: The TUI filters inspector flags before resolving its auth child, with direct regression coverage. (src/tui/tui.ts:148, fdb70cd2dffc)
  • Behavior proof coverage: The built local PTY case drives provider auth, verifies persisted credentials and unchanged model selection, then completes a local turn. (src/tui/tui-pty-local.e2e.test.ts:1280, fdb70cd2dffc)
  • Release context: The latest available release tag predates this unmerged PR head, so the repair is not yet shipped. (package.json:22, 0790d9f593ad)

Likely related people:

  • Peter Steinberger: Current TUI launcher lines blame to the shallow-history boundary snapshot; earlier ownership is unavailable locally. (role: recent current-main source snapshot author; confidence: low; commits: 1cf1af4aed; files: src/tui/tui.ts)

Rank-up moves

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

  • Let the remaining exact-head build and Node checks complete before merge.

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 (4 earlier review cycles)
  • reviewed 2026-08-04T18:20:50.420Z sha 52710220003fbf3405937922f016fd3b27a21b94 :: found issues before merge. :: [P2] Budget the serial PTY cases before the outer deadline
  • reviewed 2026-08-04T19:04:37.355Z sha 869afef :: needs changes before merge. :: [P2] Preserve the built local-auth launcher | [P2] Budget the serial PTY cases before the outer deadline
  • reviewed 2026-08-04T20:10:38.404Z sha 8e6f16a :: needs maintainer review before merge. :: none
  • reviewed 2026-08-04T20:31:13.612Z sha 3622daa :: found issues before merge. :: [P2] Filter debugger flags before spawning local provider auth

@vincentkoc
vincentkoc force-pushed the t05-tui-local-recovery-auth-20260804 branch from 5271022 to 869afef Compare August 4, 2026 18:25
Punchcard-Session: ember-workshop-lantern-bs
Punchcard-Session: ember-workshop-lantern-bs
@vincentkoc vincentkoc changed the title test(tui): cover local recovery and auth flows fix(tui): restore provider auth in installed local mode Aug 4, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 4, 2026 20:03
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@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 4, 2026
Punchcard-Session: ember-workshop-lantern-bs
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@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. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Aug 4, 2026
Punchcard-Session: ember-workshop-lantern-bs
@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 4, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@vincentkoc
vincentkoc merged commit bfcce12 into main Aug 4, 2026
134 of 138 checks passed
@vincentkoc
vincentkoc deleted the t05-tui-local-recovery-auth-20260804 branch August 4, 2026 21:40
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 5, 2026
Punchcard-Session: crisp-lantern-orchard-nv

* origin/main:
  perf(memory): defer session backfill runtime (#119372)
  fix(ci): isolate built TUI PTY fixture (#119339)
  fix(commands): restore tool inventory for dynamic models (#119306)
  fix(media): release rejected BytePlus and Runway video downloads under debug capture (#119257)
  docs: add ChromeOS (Crostini) platform install guide (#107663)
  test(msteams): serve JWKS from in-process server in auth coverage (#119354)
  fix(qa): enable OpenAI for stored audio scenario (#119349)
  test(agents): realpath apply-patch temp dir fixture (#119353)
  test(slack): drop redundant .js-suffixed system-event mock (#119352)
  fix(exec): leave safe builtins unrewritten in enforced mode (#119351)
  fix(sessions): keep gateway responsive while large transcript archives are built (#112424)
  fix(tui): restore provider auth in installed local mode (#119283)
vincentkoc added a commit that referenced this pull request Aug 5, 2026
…time

* origin/main: (75 commits)
  fix(commands): restore tool inventory for dynamic models (#119306)
  fix(media): release rejected BytePlus and Runway video downloads under debug capture (#119257)
  docs: add ChromeOS (Crostini) platform install guide (#107663)
  test(msteams): serve JWKS from in-process server in auth coverage (#119354)
  fix(qa): enable OpenAI for stored audio scenario (#119349)
  test(agents): realpath apply-patch temp dir fixture (#119353)
  test(slack): drop redundant .js-suffixed system-event mock (#119352)
  fix(exec): leave safe builtins unrewritten in enforced mode (#119351)
  fix(sessions): keep gateway responsive while large transcript archives are built (#112424)
  fix(tui): restore provider auth in installed local mode (#119283)
  fix(release): accept legacy empty core artifacts (#119337)
  fix(qa): carry selected runtime into flow scenarios (#119324)
  fix(ci): retry interrupted Windows dashboard release checks (#119095)
  fix(release): filter validation ancestry fetch (#119334)
  fix(release): accept trusted extended-stable validation evidence (#119264)
  fix(sessions): preserve recorder-owned user turns (#119307)
  perf(cli): split plugin registry startup timing (#119318)
  fix(qa): align release scenario setup and compaction proof (#119188)
  fix(ci): avoid duplicate Matrix release QA runs (#119171)
  perf(agents): reuse provider policy manifest registry (#119305)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 5, 2026
)

* test(tui): cover local recovery and auth flows

* fix(tui): restore installed local auth

* test(qa): allow TUI scenario teardown margin

Punchcard-Session: ember-workshop-lantern-bs

* fix(tui): constrain local CLI launcher ownership

Punchcard-Session: ember-workshop-lantern-bs

* fix(tui): satisfy local auth validation gates

Punchcard-Session: ember-workshop-lantern-bs

* fix(tui): strip inspector flags from auth child

Punchcard-Session: ember-workshop-lantern-bs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: qa-lab maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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