Skip to content

feat(onboarding): first-run experience for third-party providers - #1864

Merged
kevincodex1 merged 5 commits into
Gitlawb:mainfrom
kevincodex1:ui/third-party-onboarding
Jul 20, 2026
Merged

feat(onboarding): first-run experience for third-party providers#1864
kevincodex1 merged 5 commits into
Gitlawb:mainfrom
kevincodex1:ui/third-party-onboarding

Conversation

@kevincodex1

@kevincodex1 kevincodex1 commented Jul 5, 2026

Copy link
Copy Markdown
Member

Summary

Third-party users — the fork's core audience — previously skipped first-run
onboarding entirely. Two gates in showSetupScreens were keyed on
usesAnthropicAccountFlow():

  • Onboarding (theme + security notes) now runs for all providers. The
    Onboarding component already drops its preflight/OAuth steps when Anthropic
    auth is not enabled, so a third-party first run is: theme → security notes →
    terminal setup — no login screens. Previously these users got no theme
    choice and, worse, never saw the prompt-injection/safety notes.
  • The trust dialog now runs for all providers. Workspace trust is
    orthogonal to the API provider — an untrusted repo is exactly as dangerous
    over a local model as over Anthropic. The block comment above the gate even
    said "Always show the trust dialog"; the inner check contradicted it. The
    trust-state initialization below the dialog is unchanged, so the REPL
    mounts as before.
  • New login-method option: "Use current environment configuration". When
    OPENAI_BASE_URL + OPENAI_MODEL are set, the login screen offers
    adopting them as the first (default) option. Selecting it saves and
    activates a provider profile via addProviderProfile(..., {makeActive: true}), then continues onboarding.

Impact

  • Every new user now sees the safety notes and gets a theme, regardless of
    provider.
  • Env-configured users (Ollama, LM Studio, gateways) go from launch to a
    working session in three keystrokes instead of navigating an
    Anthropic-centric login flow.
  • Fixes a real footgun found during verification: OPENAI_* env vars alone
    never activate the OpenAI route (resolveActiveRouteIdFromEnv requires
    CLAUDE_CODE_USE_OPENAI or a saved profile). Users who set only env vars
    silently ran against Anthropic ("Not logged in"). The new option is the
    paved path out. This gap was previously masked in manual testing by a stray
    legacy .openclaude-profile.json in the cwd.
  • Existing third-party users who never completed onboarding will see it once
    on next launch (theme + security notes, no OAuth), and the trust dialog
    once per project — symmetric with first-party semantics, and they get the
    safety notes they never saw. Flagging for reviewer judgment.

Testing

  • bun test src/__tests__/bugfixes.test.ts src/components/ProviderManager.test.tsx — 65 pass
    (includes 2 new guard tests locking the degated conditions)
  • tsc --noEmit — 0 errors
  • Live TUI verification (tmux, scratch OPENCLAUDE_CONFIG_DIR, mock OpenAI
    server): fresh 3P first run (CLAUDE_CODE_USE_OPENAI=1) walks theme →
    security → trust → REPL with no login screens; env-detected option saves
    "Local OpenAI-compatible", the session completes a real turn against the
    env endpoint, and the profile persists across relaunch; second launch shows
    no onboarding
  • bun run check (full suite) — not run locally

Notes

  • The env option only appears when both OPENAI_BASE_URL and OPENAI_MODEL
    are present, because a provider profile requires baseUrl + model. If
    profile validation fails it falls back to the guided provider setup.
  • Profile naming reuses getLocalOpenAICompatibleProviderLabel, so known
    gateways get their proper labels.

Summary by CodeRabbit

  • New Features
    • Added a “Use current environment configuration” option in the OAuth flow that reuses or creates a provider profile from environment base URL/model, then continues setup.
  • Bug Fixes
    • Updated onboarding and workspace trust dialogs to be driven by setup completion and trust acceptance state, not the API provider type.
    • Prevented raw environment base URL values from being shown in the UI.
  • Tests
    • Added coverage for onboarding/trust dialog wiring and for credential-safe redaction of displayed environment configuration values.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR makes onboarding and trust dialogs provider-independent, adds an environment-configured login path that creates or activates provider profiles, and tests dialog routing plus redaction of environment-derived URLs.

Changes

Third-party provider onboarding/trust and env login

Layer / File(s) Summary
Ungate onboarding and trust dialogs
src/interactiveHelpers.tsx, src/__tests__/bugfixes.test.ts
showSetupScreens derives onboarding and trust-dialog visibility through getRequiredSetupScreens, independent of usesAnthropicSetup; tests verify the routing and reject provider-specific gating patterns.
Derive and redact environment configuration
src/utils/envProviderOption.ts, src/utils/envProviderOption.test.ts
Selects OpenAI-compatible environment variables, requires both base URL and model, preserves the raw URL for activation, and tests redacted display output.
Environment-based login option
src/components/ConsoleOAuthFlow.tsx, src/__tests__/bugfixes.test.ts
Offers environment configuration as a login method, finds or creates and activates a matching provider profile, and falls back to platform_setup when activation fails.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • Gitlawb/openclaude#1711: Introduces the centralized URL redaction helpers used by this environment-provider flow.

Suggested labels: enhancement

Suggested reviewers: jatmn

🚥 Pre-merge checks | ✅ 7
✅ Passed checks (7 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, scoped, and accurately matches the onboarding and third-party provider changes in the diff.
Description check ✅ Passed The description follows the required template with Summary, Impact, Testing, and Notes sections and is substantially complete.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Risk Surface Disclosed ✅ Passed PASS: The PR explicitly calls out auth/provider-routing and secret-disclosure risk, redacts displayed env URLs, and falls back on validation failures; no blocker introduced.
No Hidden Policy Change ✅ Passed Policy-affecting behavior is explicit: onboarding/trust gates use setupScreenGates, env login is documented/tested, and no extra policy shift is buried in cleanup.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/ConsoleOAuthFlow.tsx (1)

391-480: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

No tests added for the new environment-based login path.

This introduces a materially new, stateful behavior (creates and activates a provider profile from env vars, with a fallback to platform_setup on failure), but no changes to ConsoleOAuthFlow.test.tsx are included in this PR — only bugfixes.test.ts covers the unrelated onboarding/trust gating change. As per AGENTS.md, "Add or update tests when behavior changes," this new branch (env option visibility gating, successful save/activate, and the addProviderProfile failure fallback) should have direct coverage.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/ConsoleOAuthFlow.tsx` around lines 391 - 480, The new
environment-based login branch in ConsoleOAuthFlow needs direct test coverage.
Add or update tests in ConsoleOAuthFlow.test.tsx for the env option visibility
gating, the successful environment चयन path that calls addProviderProfile and
sets the active profile, and the failure path that falls back to platform_setup
when addProviderProfile returns a falsy value. Focus on the onChange handler
logic for the environment option and the related envBaseUrl/envModel conditions.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/__tests__/bugfixes.test.ts`:
- Around line 552-579: The new coverage in interactiveHelpers.tsx is asserting
source text shape instead of the runtime behavior of showSetupScreens, so it can
miss regressions in actual dialog rendering for non-Anthropic providers. Add a
behavioral test around showSetupScreens that mocks usesAnthropicAccountFlow() to
false and checkHasTrustDialogAccepted() to false, then verifies the onboarding
and trust dialog paths are actually invoked for third-party providers. Keep the
existing regex checks only as supplemental coverage, not the primary assertion.

In `@src/components/ConsoleOAuthFlow.tsx`:
- Around line 458-480: The environment-backed provider setup in ConsoleOAuthFlow
should avoid creating duplicate persisted profiles when the same OPENAI_BASE_URL
and OPENAI_MODEL are selected again. Update the "environment" branch to check
for an existing matching provider before calling addProviderProfile, and reuse
that profile or skip insertion if it already exists; keep the existing
activation and status flow intact for the addProviderProfile path.

---

Outside diff comments:
In `@src/components/ConsoleOAuthFlow.tsx`:
- Around line 391-480: The new environment-based login branch in
ConsoleOAuthFlow needs direct test coverage. Add or update tests in
ConsoleOAuthFlow.test.tsx for the env option visibility gating, the successful
environment चयन path that calls addProviderProfile and sets the active profile,
and the failure path that falls back to platform_setup when addProviderProfile
returns a falsy value. Focus on the onChange handler logic for the environment
option and the related envBaseUrl/envModel conditions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 45bf0ab5-18b6-4a38-be80-a832cb847146

📥 Commits

Reviewing files that changed from the base of the PR and between 203f055 and 3ca5403.

📒 Files selected for processing (3)
  • src/__tests__/bugfixes.test.ts
  • src/components/ConsoleOAuthFlow.tsx
  • src/interactiveHelpers.tsx
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: smoke-and-tests
  • GitHub Check: typecheck
🧰 Additional context used
📓 Path-based instructions (5)
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.{ts,tsx}: Use TypeScript with strict mode
Use ESM imports in TypeScript source files

Files:

  • src/__tests__/bugfixes.test.ts
  • src/components/ConsoleOAuthFlow.tsx
  • src/interactiveHelpers.tsx
**

⚙️ CodeRabbit configuration file

**: # AGENTS.md - AI Agent Coding Guide

This guide is for AI coding agents working in the OpenClaude repository. Read it before changing code, and also follow CONTRIBUTING.md for contributor policy, PR expectations, review follow-up, and project scope.

Project Snapshot

OpenClaude is a coding-agent CLI for cloud and local model providers. It supports OpenAI-compatible APIs, Anthropic, Gemini, DeepSeek, Ollama, MCP, local backends, slash commands, tools, agents, and a React/Ink terminal UI.

The installed CLI runs on Node.js >=22.0.0. Bun is used for source builds, scripts, dependency management, and tests.

Work Style

  • Keep changes focused on one problem.
  • Prefer existing patterns in the file or nearby module.
  • Avoid unrelated formatting, renames, dependency changes, or broad rewrites.
  • Add or update tests when behavior changes.
  • Update docs when setup, commands, provider behavior, or user-facing behavior changes.
  • For new features, larger refactors, dependencies, or runtime changes, follow the issue-first guidance in CONTRIBUTING.md.

Stack And Conventions

  • TypeScript with strict mode and ESM imports.
  • React + Ink for terminal UI.
  • Bun lockfile and Bun scripts for development workflows.
  • Node runtime for the built CLI.

Common libraries and patterns:

  • chalk for terminal color.
  • commander for CLI argument parsing.
  • execa for child processes.
  • Existing service, provider, settings, permission, and UI patterns over new abstractions.

Repository Map

  • src/commands/ - slash and CLI command implementations.
  • src/components/ - React/Ink UI components.
  • src/services/ - API, MCP, OAuth, wiki, voice, and other service integrations.
  • src/tools/ - tool implementations.
  • src/utils/ - shared utilities.
  • src/integrations/ - provider and model integration metadata.
  • src/entrypoints/ - CLI, MCP, SDK, and generated public types.
  • src/tasks/ - local, remote, workflow, and monitor tas...

Files:

  • src/__tests__/bugfixes.test.ts
  • src/components/ConsoleOAuthFlow.tsx
  • src/interactiveHelpers.tsx
**/*

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/__tests__/bugfixes.test.ts
  • src/components/ConsoleOAuthFlow.tsx
  • src/interactiveHelpers.tsx
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/__tests__/bugfixes.test.ts
src/components/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Build terminal UI using React + Ink components in src/components/

Files:

  • src/components/ConsoleOAuthFlow.tsx
🔇 Additional comments (3)
src/interactiveHelpers.tsx (2)

134-152: LGTM!


106-133: 🎯 Functional Correctness

No issue: Onboarding.tsx already gates the Anthropic-only preflight and OAuth steps on oauthEnabled, so non-Anthropic providers won’t hit those dialogs.

			> Likely an incorrect or invalid review comment.
src/components/ConsoleOAuthFlow.tsx (1)

398-401: 🗄️ Data Integrity & Integration

Keep the OPENAI_API_BASE fallback. This flow already passes the resolved URL into getLocalOpenAICompatibleProviderLabel, and the legacy alias is supported across the OpenAI-compatible paths.

			> Likely an incorrect or invalid review comment.

Comment on lines +552 to +579

// ---------------------------------------------------------------------------
// Fix: onboarding + trust dialog skipped entirely for third-party providers
// ---------------------------------------------------------------------------
describe('Onboarding and trust dialog — third-party providers', () => {
test('the onboarding dialog is NOT gated behind usesAnthropicSetup', async () => {
const content = await file('interactiveHelpers.tsx').text()

// Theme choice and the security notes are universal; Onboarding.tsx drops
// the OAuth/preflight steps itself when Anthropic auth is not enabled.
// Gating the whole dialog on the Anthropic account flow left third-party
// users with no safety notes at all.
expect(content).not.toMatch(
/usesAnthropicSetup\s*&&\s*\(\s*!config\.theme/,
)
})

test('the trust dialog is NOT gated behind usesAnthropicSetup', async () => {
const content = await file('interactiveHelpers.tsx').text()

// Workspace trust is orthogonal to the API provider: an untrusted repo is
// exactly as dangerous over a local model as over Anthropic.
expect(content).not.toMatch(
/usesAnthropicSetup\s*&&\s*!checkHasTrustDialogAccepted/,
)
expect(content).toContain('if (!checkHasTrustDialogAccepted())')
})
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Tests assert source-text shape, not actual runtime behavior.

Both new tests regex-match the raw text of interactiveHelpers.tsx rather than exercising showSetupScreens itself. They'll pass as long as the literal string usesAnthropicSetup && ... isn't present, regardless of whether the dialogs actually render correctly for third-party providers (or regress via an equivalent-but-differently-worded condition). As per path instructions, "Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior" — this change to startup dialog gating for all providers is exactly this kind of risky runtime change.

Consider adding a behavioral test that mocks usesAnthropicAccountFlow() to return false and checkHasTrustDialogAccepted() to return false, then asserts showSetupScreens actually invokes the onboarding/trust dialog imports/renderers for a non-Anthropic provider.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/__tests__/bugfixes.test.ts` around lines 552 - 579, The new coverage in
interactiveHelpers.tsx is asserting source text shape instead of the runtime
behavior of showSetupScreens, so it can miss regressions in actual dialog
rendering for non-Anthropic providers. Add a behavioral test around
showSetupScreens that mocks usesAnthropicAccountFlow() to false and
checkHasTrustDialogAccepted() to false, then verifies the onboarding and trust
dialog paths are actually invoked for third-party providers. Keep the existing
regex checks only as supplemental coverage, not the primary assertion.

Source: Path instructions

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found issues that need to be addressed before this is ready.

Findings

  • [P2] Replace the source-text onboarding tests with runtime coverage
    src/__tests__/bugfixes.test.ts:557
    CodeRabbit's request is still valid: the new tests only read interactiveHelpers.tsx and assert that specific source strings are absent. They would still pass if showSetupScreens stopped rendering Onboarding or TrustDialog for a third-party provider through a differently shaped condition, so they do not protect the user-visible first-run path this PR changes. Please complete that request by adding a behavioral test that exercises showSetupScreens with usesAnthropicAccountFlow() false and an unaccepted trust dialog, then verifies the onboarding/trust dialogs are actually invoked.

  • [P2] Add direct tests for the environment login branch
    src/components/ConsoleOAuthFlow.tsx:458
    CodeRabbit's outside-diff test request is also still valid. This PR adds a new stateful path that shows an environment option, persists an active provider profile through addProviderProfile, and falls back to platform_setup when saving fails, but ConsoleOAuthFlow.test.tsx still only covers the existing picker and third-party provider manager screen. Please add focused coverage for option visibility from OPENAI_BASE_URL/OPENAI_MODEL, the successful save/activate path, and the failed-save fallback so regressions in this first-run route are caught.

  • [P2] Reuse an existing env-backed profile instead of appending duplicates
    src/components/ConsoleOAuthFlow.tsx:459
    CodeRabbit's duplicate-profile request still applies. addProviderProfile always appends a generated-id profile, so selecting "Use current environment configuration" again with the same OPENAI_BASE_URL and OPENAI_MODEL creates another persisted copy instead of reusing the existing setup. This is especially easy to hit if onboarding is restarted or the user backs out and re-enters the login method screen. Please check for an existing matching OpenAI-compatible profile and activate/update it, rather than blindly adding a new one.

kevincodex1 and others added 2 commits July 20, 2026 14:30
Two gates in showSetupScreens were keyed on usesAnthropicAccountFlow(),
so users of any non-Anthropic provider skipped onboarding entirely:

- Onboarding (theme + security notes) now runs for all providers. The
  component already drops its preflight/OAuth steps when Anthropic auth
  is not enabled, so third-party users get theme -> security notes ->
  terminal setup with no login screens.
- The trust dialog now runs for all providers. Workspace trust is
  orthogonal to the API provider — an untrusted repo is exactly as
  dangerous over a local model as over Anthropic. (The block comment
  even said "always show"; the inner gate contradicted it.)

Also: the login-method screen now detects OPENAI_BASE_URL+OPENAI_MODEL
in the environment and offers "Use current environment configuration"
as the first (default) option. Selecting it saves and activates a
provider profile via addProviderProfile — env vars alone do NOT
activate the OpenAI route (resolveActiveRouteIdFromEnv requires
CLAUDE_CODE_USE_OPENAI or a saved profile), a gap previously masked in
manual testing by a stray legacy .openclaude-profile.json in the cwd.

Verified live (tmux, scratch config dir, mock OpenAI server):
fresh 3P first run walks theme -> security -> trust -> REPL; env
option saves "Local OpenAI-compatible", the session completes a real
turn against the env endpoint, and the profile persists across
relaunch. Second launch shows no onboarding.

Co-Authored-By: OpenClaude <openclaude@gitlawb.com>
…dedup

- The first-run screen decisions move into src/utils/setupScreenGates.ts,
  a provider-free importable seam (showSetupScreens' import chain cannot
  be loaded under bun test — the same constraint and pattern as the
  dev-channels registration seam). Behavioral tests cover the gate matrix
  (fresh install, completed install, theme-missing re-show, trust
  independence, claubbit skip); the bugfixes.test.ts checks now assert
  the wiring (both dialogs consult the seam, no provider gate at the
  call sites) instead of only regexing for the removed string.
- The "use current environment configuration" onboarding option dedupes:
  an existing profile matching the env base URL + model is re-activated
  via setActiveProviderProfile (which also re-applies profile env and
  syncs the startup profile file) instead of appending a near-identical
  profile on every pass through the flow.

Co-Authored-By: OpenClaude <openclaude@gitlawb.com>
@kevincodex1
kevincodex1 force-pushed the ui/third-party-onboarding branch from 3ca5403 to 1227275 Compare July 20, 2026 06:34

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
src/__tests__/bugfixes.test.ts (1)

708-731: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Still asserting source-text shape, not runtime behavior — unaddressed from prior review.

Both tests regex/string-match the raw contents of interactiveHelpers.tsx rather than exercising showSetupScreens. They'll pass even if the dialogs stop rendering correctly for third-party providers, as long as the literal strings/patterns checked for aren't present. As per path instructions, "Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior" — this gating change is exactly that kind of risky runtime change, and this concern was already raised on a prior commit without a fix.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/__tests__/bugfixes.test.ts` around lines 708 - 731, Replace the
source-text assertions in the third-party provider tests with focused runtime
tests that invoke showSetupScreens using a non-Anthropic provider and verify
both onboarding and trust dialogs are rendered through the provider-free setup
flow. Preserve coverage that both dialogs appear and are not gated by
usesAnthropicSetup, using the existing test harness and observable UI behavior
rather than implementation details.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/ConsoleOAuthFlow.tsx`:
- Around line 395-421: Update the environment option label in the loginOptions
construction to display OPENAI_API_BASE when envBaseUrl came from that variable,
and OPENAI_BASE_URL otherwise. Keep the existing fallback selection and option
behavior unchanged.
- Around line 462-496: The reuse branch in the environment selection flow must
refresh the existing profile’s apiKey from process.env.OPENAI_API_KEY before
activation, using the existing profile update path rather than only calling
setActiveProviderProfile. Track whether the profile was reused so the completion
message says “Activated ...” for that path and retains “Saved ...” for newly
created profiles.

---

Duplicate comments:
In `@src/__tests__/bugfixes.test.ts`:
- Around line 708-731: Replace the source-text assertions in the third-party
provider tests with focused runtime tests that invoke showSetupScreens using a
non-Anthropic provider and verify both onboarding and trust dialogs are rendered
through the provider-free setup flow. Preserve coverage that both dialogs appear
and are not gated by usesAnthropicSetup, using the existing test harness and
observable UI behavior rather than implementation details.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0f4d6bec-16b0-493d-beee-68968d6c7271

📥 Commits

Reviewing files that changed from the base of the PR and between 3ca5403 and 1227275.

📒 Files selected for processing (3)
  • src/__tests__/bugfixes.test.ts
  • src/components/ConsoleOAuthFlow.tsx
  • src/interactiveHelpers.tsx
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: typecheck
  • GitHub Check: smoke-and-tests (22)
  • GitHub Check: smoke-and-tests (24.11.x)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

TypeScript code in this repository must use strict mode and ESM imports.

**/*.{ts,tsx}: Provider changes must follow the documented integration patterns and avoid inconsistent behavior across provider paths.
When changing provider behavior, avoid breaking third-party providers and test the exact provider/model path changed when possible.
Review AI-generated code for correctness, style consistency, unnecessary changes, and adherence to project architecture before submission.
Run multiple rounds of self-review on AI-generated code; compilation alone is insufficient to establish correctness.

Files:

  • src/__tests__/bugfixes.test.ts
  • src/components/ConsoleOAuthFlow.tsx
  • src/interactiveHelpers.tsx
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*: Keep pull requests focused on one issue or one clearly scoped improvement; avoid unrelated cleanup, fixes, features, or refactors in the same change.
Preserve existing repository patterns unless intentionally refactoring them, and stay within the project's existing language, runtime, dependency, and architectural direction.
Add or update tests when a change affects behavior.
Update documentation when setup, commands, or user-facing behavior changes.
Follow the existing code style in touched files.
Prefer small, readable changes over broad rewrites.
Do not reformat unrelated files merely because they are nearby.
Keep comments useful and concise.
Run the narrowest meaningful validation command for the touched area before opening a pull request, and ensure relevant CI checks pass before merge.
Provider-change pull requests must identify affected providers, state the tested provider/model path, and document limitations or follow-up work.
Do not assign or use provider tags; provider tags are controlled and applied by maintainers.
Security reports must follow the instructions in SECURITY.md.
PR descriptions must explain what changed and why, user or developer impact, exact checks run, and include relevant issue links; UI, terminal presentation, or VS Code extension changes require screenshots.
PR authors must address CodeRabbit findings before maintainer review proceeds.

Files:

  • src/__tests__/bugfixes.test.ts
  • src/components/ConsoleOAuthFlow.tsx
  • src/interactiveHelpers.tsx

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/__tests__/bugfixes.test.ts
  • src/components/ConsoleOAuthFlow.tsx
  • src/interactiveHelpers.tsx
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/__tests__/bugfixes.test.ts
src/components/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Use React + Ink for terminal UI components under src/components/.

Files:

  • src/components/ConsoleOAuthFlow.tsx
🔇 Additional comments (1)
src/interactiveHelpers.tsx (1)

23-23: LGTM!

Also applies to: 118-131, 151-155

Comment thread src/components/ConsoleOAuthFlow.tsx
Comment thread src/components/ConsoleOAuthFlow.tsx
…r label

- The reuse branch now refreshes the stored credential from the
  environment before activating: a rotated OPENAI_API_KEY would otherwise
  leave the flow running on the profile's stale key. Falls back to the
  existing key when the env no longer carries one, so a working
  credential is never blanked. Status text says "Activated" for reuse and
  keeps "Saved" for a newly created profile.
- The environment option's label names the variable the value actually
  came from (OPENAI_BASE_URL vs OPENAI_API_BASE) instead of hardcoding
  the former, so troubleshooting points at a variable that is really set.

Co-Authored-By: OpenClaude <openclaude@gitlawb.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/ConsoleOAuthFlow.tsx`:
- Around line 491-497: Handle the return value from updateProviderProfile before
activating the profile: only call setActiveProviderProfile when the update
succeeds, and preserve the existing failure path when it returns null. Ensure
activation cannot proceed with stale credentials or report success after
validation rejects the environment values.
- Around line 491-496: Update the updateProviderProfile call in the
existing-profile refresh path to spread all fields from existing before
overriding name, baseUrl, model, and apiKey. Preserve configured fields such as
apiFormat, azureStyle, authHeader, authScheme, authHeaderValue, customHeaders,
and maxContextLength when rebuilding the profile.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6e7b3993-2b78-4108-8a0e-f550dc8b4694

📥 Commits

Reviewing files that changed from the base of the PR and between 1227275 and 4096016.

📒 Files selected for processing (1)
  • src/components/ConsoleOAuthFlow.tsx
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: typecheck
  • GitHub Check: smoke-and-tests (24.11.x)
  • GitHub Check: smoke-and-tests (22)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

TypeScript code in this repository must use strict mode and ESM imports.

**/*.{ts,tsx}: Provider changes must follow the documented integration patterns and avoid inconsistent behavior across provider paths.
When changing provider behavior, avoid breaking third-party providers and test the exact provider/model path changed when possible.
Review AI-generated code for correctness, style consistency, unnecessary changes, and adherence to project architecture before submission.
Run multiple rounds of self-review on AI-generated code; compilation alone is insufficient to establish correctness.

Files:

  • src/components/ConsoleOAuthFlow.tsx
src/components/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Use React + Ink for terminal UI components under src/components/.

Files:

  • src/components/ConsoleOAuthFlow.tsx
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*: Keep pull requests focused on one issue or one clearly scoped improvement; avoid unrelated cleanup, fixes, features, or refactors in the same change.
Preserve existing repository patterns unless intentionally refactoring them, and stay within the project's existing language, runtime, dependency, and architectural direction.
Add or update tests when a change affects behavior.
Update documentation when setup, commands, or user-facing behavior changes.
Follow the existing code style in touched files.
Prefer small, readable changes over broad rewrites.
Do not reformat unrelated files merely because they are nearby.
Keep comments useful and concise.
Run the narrowest meaningful validation command for the touched area before opening a pull request, and ensure relevant CI checks pass before merge.
Provider-change pull requests must identify affected providers, state the tested provider/model path, and document limitations or follow-up work.
Do not assign or use provider tags; provider tags are controlled and applied by maintainers.
Security reports must follow the instructions in SECURITY.md.
PR descriptions must explain what changed and why, user or developer impact, exact checks run, and include relevant issue links; UI, terminal presentation, or VS Code extension changes require screenshots.
PR authors must address CodeRabbit findings before maintainer review proceeds.

Files:

  • src/components/ConsoleOAuthFlow.tsx

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/components/ConsoleOAuthFlow.tsx
🔇 Additional comments (2)
src/components/ConsoleOAuthFlow.tsx (2)

15-20: LGTM!


397-431: LGTM!

Comment thread src/components/ConsoleOAuthFlow.tsx Outdated
Comment thread src/components/ConsoleOAuthFlow.tsx Outdated
…fresh

Follow-up on the reuse path added last round:

- updateProviderProfile REPLACES the profile (toProfile builds a fresh
  object rather than merging), so passing only name/baseUrl/model/apiKey
  silently dropped any configured apiFormat, azureStyle, authHeader,
  authScheme, authHeaderValue, customHeaders, or maxContextLength. Spread
  the existing profile and override only the refreshed credential.
- A null return from updateProviderProfile (env values failing profile
  validation) no longer falls through to activation: reporting
  "Activated" while still running on the stale key is worse than routing
  the user to guided setup, which is what the create path already does.

Co-Authored-By: OpenClaude <openclaude@gitlawb.com>
@kevincodex1

Copy link
Copy Markdown
Member Author

hey @coderabbitai please review make sure all good . approve it if its good already

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '=== PR metadata and changed files ==='
gh pr view 1864 --repo Gitlawb/openclaude --json title,baseRefName,headRefName,files --jq '.title, .baseRefName, .headRefName, (.files[] | "\(.path) +\(.additions)/-\(.deletions)")'

echo '=== PR diff ==='
gh pr diff 1864 --repo Gitlawb/openclaude --patch

echo '=== Source outlines ==='
ast-grep outline src/components/ConsoleOAuthFlow.tsx --items all --view expanded || true
ast-grep outline src/interactiveHelpers.tsx --items all --view expanded || true

echo '=== Provider profile helper declarations and calls ==='
rg -n -C 4 --glob '*.{ts,tsx}' \
  '(export\s+(async\s+)?function\s+(addProviderProfile|getProviderProfiles|updateProviderProfile|activateProviderProfile)|\b(addProviderProfile|getProviderProfiles|updateProviderProfile|activateProviderProfile)\s*\()' \
  src || true

echo '=== Environment configuration helper declarations and calls ==='
rg -n -C 4 --glob '*.{ts,tsx}' \
  '(OPENAI_(BASE_URL|API_BASE|MODEL|API_KEY)|get.*OpenAI|OpenAI.*Provider|local.*provider)' \
  src/components/ConsoleOAuthFlow.tsx src || true

Length of output: 181430


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '=== Changed-file patches ==='
gh api repos/Gitlawb/openclaude/pulls/1864/files --paginate \
  --jq '.[] | select(.filename == "src/components/ConsoleOAuthFlow.tsx" or .filename == "src/interactiveHelpers.tsx" or .filename == "src/__tests__/bugfixes.test.ts") | "FILE: \(.filename)\n\(.patch)\n---"' 

echo '=== Relevant ConsoleOAuthFlow implementation ==='
rg -n -C 12 --glob 'ConsoleOAuthFlow.tsx' \
  '(environment|platform_setup|addProviderProfile|updateProviderProfile|activateProviderProfile|getProviderProfiles|OPENAI_API_BASE|OPENAI_BASE_URL)' \
  src/components

echo '=== Setup screen calculation and call site ==='
rg -n -C 12 --glob '*.{ts,tsx}' \
  '(function getRequiredSetupScreens|const getRequiredSetupScreens|function showSetupScreens|const showSetupScreens|usesAnthropicSetup|trustDialog|onboarding)' \
  src/interactiveHelpers.tsx src

echo '=== Locate profile module candidates ==='
fd -t f -E node_modules -E dist -E build 'provider.*profile|profile.*provider' src

echo '=== Profile helper definitions (narrowed) ==='
rg -n -C 15 --glob '*.{ts,tsx}' \
  'export (async )?function (getProviderProfiles|addProviderProfile|updateProviderProfile|activateProviderProfile)|export const (getProviderProfiles|addProviderProfile|updateProviderProfile|activateProviderProfile)' \
  src

Length of output: 147594


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '=== Provider profile input shape and normalization ==='
rg -n -C 18 --glob 'providerProfiles.ts' \
  '(type ProviderProfileInput|interface ProviderProfileInput|function toProfile|const toProfile|function applyProviderProfileToProcessEnv|function setActiveProviderProfile|export function setActiveProviderProfile)' \
  src/utils/providerProfiles.ts

echo '=== Update and activation implementation ==='
sed -n '1200,1315p' src/utils/providerProfiles.ts

echo '=== Environment application and OpenAI credential handling ==='
rg -n -C 12 --glob 'providerProfiles.ts' \
  '(OPENAI_API_BASE|OPENAI_BASE_URL|OPENAI_API_KEY|OPENAI_API_KEYS|applyProviderProfileToProcessEnv|clear.*OpenAI)' \
  src/utils/providerProfiles.ts

echo '=== Existing tests for ConsoleOAuthFlow and environment profile selection ==='
fd -t f -E node_modules -E dist -E build 'ConsoleOAuthFlow*.test.*' src
rg -n -C 8 --glob '*.{test,spec}.{ts,tsx}' \
  '(ConsoleOAuthFlow|tengu_oauth_env_config_selected|Use current environment configuration|environment configuration)' \
  src

Length of output: 31758


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '=== Profile URL validation and sanitization ==='
rg -n -C 15 --glob 'providerProfiles.ts' \
  '(function sanitizeProfile|const sanitizeProfile|baseUrl.*URL|new URL|redactSecretValueForDisplay|sanitizeProviderConfigValue)' \
  src/utils/providerProfiles.ts

echo '=== Redaction helpers and endpoint-display call sites ==='
rg -n -C 10 --glob '*.{ts,tsx}' \
  '(function redactSecretValueForDisplay|const redactSecretValueForDisplay|function sanitizeProviderConfigValue|const sanitizeProviderConfigValue|maskSecretForDisplay)' \
  src/utils

echo '=== Existing poisoned endpoint / credential-in-URL coverage ==='
rg -n -C 8 --glob '*.{test,spec}.{ts,tsx}' \
  '(poisoned.*(endpoint|base|URL)|credential.*(URL|base)|user(name)?[:@]|redact.*(base|endpoint|URL)|OPENAI_BASE_URL.*secret)' \
  src

Length of output: 74406


@kevincodex1 Blocking issue

src/components/ConsoleOAuthFlow.tsx displays the raw environment endpoint on Line 423 and again on Line 530. A credential-bearing OPENAI_BASE_URL / OPENAI_API_BASE—for example https://user:password@host/v1?token=...—will be written to terminal scrollback.

The codebase already treats endpoint display as sensitive and provides redactUrlForDisplay for URL userinfo and token-like query parameters. Please render a redacted display value in both locations, while retaining the original value for profile creation/activation, and add a regression test for a URL containing credentials or a sensitive query parameter.

I can’t approve until that secret-disclosure path is addressed.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

OPENAI_BASE_URL / OPENAI_API_BASE are credential-bearing in the wild
(userinfo like https://user:pass@host/v1, or ?token=/?api_key= query
params), and both the option label and the completion status message
rendered the raw value straight into terminal scrollback.

The derivation moves into src/utils/envProviderOption.ts, which owns the
disclosure boundary explicitly: `displayBaseUrl` is passed through the
codebase's existing redactUrlForDisplay and is the only form the UI may
render, while the raw `baseUrl` is retained for profile creation and
activation so the saved profile still authenticates. Both rendered sites
now use the redacted value.

Regression coverage: envProviderOption.test.ts asserts userinfo and
sensitive query params never reach displayBaseUrl (including via the
non-URL fallback path) while baseUrl stays intact, plus var-name and
availability cases; a wiring guard in bugfixes.test.ts fails if either
rendered site is ever pointed back at the raw endpoint.

Co-Authored-By: OpenClaude <openclaude@gitlawb.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/ConsoleOAuthFlow.tsx (1)

14-22: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add a test for the environment-login path
src/components/ConsoleOAuthFlow.test.tsx only covers the third-party setup branch. Add coverage for selecting environment so the profile is created/reused, activated, and shown with the redacted base URL; src/__tests__/bugfixes.test.ts only checks source text and doesn’t exercise the flow.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/ConsoleOAuthFlow.tsx` around lines 14 - 22, Add tests in
ConsoleOAuthFlow.test.tsx for selecting the environment-login path, verifying
that the environment provider profile is created or reused, activated, and
rendered with the redacted base URL. Exercise the component flow directly rather
than relying on the source-text assertion in bugfixes.test.ts, and cover both
new-profile and existing-profile behavior if applicable.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/components/ConsoleOAuthFlow.tsx`:
- Around line 14-22: Add tests in ConsoleOAuthFlow.test.tsx for selecting the
environment-login path, verifying that the environment provider profile is
created or reused, activated, and rendered with the redacted base URL. Exercise
the component flow directly rather than relying on the source-text assertion in
bugfixes.test.ts, and cover both new-profile and existing-profile behavior if
applicable.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: da6f2b79-85b4-4f18-920c-15e6a56f057a

📥 Commits

Reviewing files that changed from the base of the PR and between 2d23d56 and a00a29e.

📒 Files selected for processing (4)
  • src/__tests__/bugfixes.test.ts
  • src/components/ConsoleOAuthFlow.tsx
  • src/utils/envProviderOption.test.ts
  • src/utils/envProviderOption.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: typecheck
  • GitHub Check: smoke-and-tests (24.11.x)
  • GitHub Check: smoke-and-tests (22)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

TypeScript code in this repository must use strict mode and ESM imports.

**/*.{ts,tsx}: Provider changes must follow the documented integration patterns and avoid inconsistent behavior across provider paths.
When changing provider behavior, avoid breaking third-party providers and test the exact provider/model path changed when possible.
Review AI-generated code for correctness, style consistency, unnecessary changes, and adherence to project architecture before submission.
Run multiple rounds of self-review on AI-generated code; compilation alone is insufficient to establish correctness.

Files:

  • src/utils/envProviderOption.test.ts
  • src/utils/envProviderOption.ts
  • src/components/ConsoleOAuthFlow.tsx
  • src/__tests__/bugfixes.test.ts
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*: Keep pull requests focused on one issue or one clearly scoped improvement; avoid unrelated cleanup, fixes, features, or refactors in the same change.
Preserve existing repository patterns unless intentionally refactoring them, and stay within the project's existing language, runtime, dependency, and architectural direction.
Add or update tests when a change affects behavior.
Update documentation when setup, commands, or user-facing behavior changes.
Follow the existing code style in touched files.
Prefer small, readable changes over broad rewrites.
Do not reformat unrelated files merely because they are nearby.
Keep comments useful and concise.
Run the narrowest meaningful validation command for the touched area before opening a pull request, and ensure relevant CI checks pass before merge.
Provider-change pull requests must identify affected providers, state the tested provider/model path, and document limitations or follow-up work.
Do not assign or use provider tags; provider tags are controlled and applied by maintainers.
Security reports must follow the instructions in SECURITY.md.
PR descriptions must explain what changed and why, user or developer impact, exact checks run, and include relevant issue links; UI, terminal presentation, or VS Code extension changes require screenshots.
PR authors must address CodeRabbit findings before maintainer review proceeds.

Files:

  • src/utils/envProviderOption.test.ts
  • src/utils/envProviderOption.ts
  • src/components/ConsoleOAuthFlow.tsx
  • src/__tests__/bugfixes.test.ts

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/utils/envProviderOption.test.ts
  • src/utils/envProviderOption.ts
  • src/components/ConsoleOAuthFlow.tsx
  • src/__tests__/bugfixes.test.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/utils/envProviderOption.test.ts
  • src/__tests__/bugfixes.test.ts
src/components/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Use React + Ink for terminal UI components under src/components/.

Files:

  • src/components/ConsoleOAuthFlow.tsx
🔇 Additional comments (5)
src/__tests__/bugfixes.test.ts (1)

717-733: LGTM!

src/utils/envProviderOption.ts (1)

1-40: LGTM!

src/utils/envProviderOption.test.ts (1)

1-89: LGTM!

src/components/ConsoleOAuthFlow.tsx (2)

398-535: Environment login flow correctly maintains the redaction boundary and handles profile reuse/creation failures.

The implementation properly:

  • Uses envBaseUrlForDisplay (redacted) in both the option label (line 425) and the success message (line 532).
  • Retains envBaseUrl (raw) only for profile matching, creation, and activation.
  • Spreads existing profile fields before overriding apiKey on the reuse path (line 500), preventing silent field loss.
  • Guards both updateProviderProfile (line 503) and addProviderProfile (line 523) null returns with fallback to platform_setup.
  • Distinguishes "Activated" vs "Saved" in the success message based on whether a profile was reused (line 532).

515-515: No issue here. getLocalOpenAICompatibleProviderLabel already accepts an optional base URL, so envBaseUrl is valid at this call site.

			> Likely an incorrect or invalid review comment.

@kevincodex1

Copy link
Copy Markdown
Member Author

@coderabbitai can you review again and verify if all good. approve if its goo

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '=== Current PR files and patch ==='
gh pr view 1864 --repo Gitlawb/openclaude --json headRefOid,baseRefOid,files \
  --jq '"head: \(.headRefOid)\nbase: \(.baseRefOid)\n" + (.files[] | "\(.path) +\(.additions)/-\(.deletions)")'
gh pr diff 1864 --repo Gitlawb/openclaude --patch -- \
  src/components/ConsoleOAuthFlow.tsx \
  src/utils/envProviderOption.ts \
  src/utils/envProviderOption.test.ts \
  src/interactiveHelpers.tsx \
  src/__tests__/bugfixes.test.ts

echo '=== Changed source outlines ==='
ast-grep outline src/components/ConsoleOAuthFlow.tsx --items all --view expanded
ast-grep outline src/utils/envProviderOption.ts --items all --view expanded
ast-grep outline src/interactiveHelpers.tsx --items all --view expanded

echo '=== Endpoint derivation, display, and profile operations ==='
rg -n -C 10 --glob '*.{ts,tsx}' \
  '(getEnvProviderOption|displayBaseUrl|envBaseUrl|redactUrlForDisplay|addProviderProfile|updateProviderProfile|setActiveProviderProfile)' \
  src/components/ConsoleOAuthFlow.tsx src/utils/envProviderOption.ts src/utils/providerProfiles.ts

echo '=== Redaction helper implementation ==='
rg -n -C 20 --glob '*.{ts,tsx}' \
  '(export (function|const) redactUrlForDisplay|function redactUrlForDisplay|const redactUrlForDisplay)' \
  src

echo '=== Relevant test assertions ==='
rg -n -C 12 --glob '*.{test,spec}.{ts,tsx}' \
  '(getEnvProviderOption|displayBaseUrl|envBaseUrl|redactUrlForDisplay|Use current environment configuration|ConsoleOAuthFlow)' \
  src

Length of output: 2841


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='83d54b0ac8b59056a98d58f80f4b4ad1bfa22969'
head='a00a29e8dc62cf1470feaf4bf7fc28c6755441a0'

echo '=== Complete PR diff ==='
git diff --find-renames --unified=80 "$base" "$head" -- \
  src/components/ConsoleOAuthFlow.tsx \
  src/utils/envProviderOption.ts \
  src/utils/envProviderOption.test.ts \
  src/interactiveHelpers.tsx \
  src/utils/setupScreenGates.ts \
  src/utils/setupScreenGates.test.ts \
  src/__tests__/bugfixes.test.ts

echo '=== Source maps ==='
ast-grep outline src/components/ConsoleOAuthFlow.tsx --items all --view expanded
ast-grep outline src/utils/envProviderOption.ts --items all --view expanded
ast-grep outline src/utils/setupScreenGates.ts --items all --view expanded
ast-grep outline src/interactiveHelpers.tsx --items all --view expanded

echo '=== Display and raw endpoint dataflow ==='
rg -n -C 14 --glob '*.{ts,tsx}' \
  '(getEnvProviderOption|displayBaseUrl|envBaseUrl|redactUrlForDisplay|addProviderProfile|updateProviderProfile|setActiveProviderProfile)' \
  src/components/ConsoleOAuthFlow.tsx src/utils/envProviderOption.ts src/utils/providerProfiles.ts src

echo '=== URL redaction implementation ==='
rg -n -C 24 --glob '*.{ts,tsx}' \
  '(export (function|const) redactUrlForDisplay|function redactUrlForDisplay|const redactUrlForDisplay)' \
  src

echo '=== Changed tests ==='
cat -n src/utils/envProviderOption.test.ts
cat -n src/utils/setupScreenGates.test.ts
sed -n '1,260p' src/__tests__/bugfixes.test.ts

Length of output: 176530


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='83d54b0ac8b59056a98d58f80f4b4ad1bfa22969'
head='a00a29e8dc62cf1470feaf4bf7fc28c6755441a0'

echo '=== Diff summary ==='
git diff --stat "$base" "$head"
git diff --check "$base" "$head"

echo '=== ConsoleOAuthFlow (complete changed flow) ==='
cat -n src/components/ConsoleOAuthFlow.tsx

echo '=== Environment provider option ==='
cat -n src/utils/envProviderOption.ts

echo '=== Setup screen gate ==='
cat -n src/utils/setupScreenGates.ts

echo '=== showSetupScreens implementation and imports ==='
rg -n -C 50 --glob 'interactiveHelpers.tsx' \
  '(getRequiredSetupScreens|showSetupScreens|usesAnthropicSetup|checkHasTrustDialogAccepted|hasCompletedOnboarding)' \
  src/interactiveHelpers.tsx

echo '=== Raw environment endpoint occurrences in ConsoleOAuthFlow ==='
rg -n -C 5 --glob 'ConsoleOAuthFlow.tsx' \
  '(envBaseUrl|baseUrl|displayBaseUrl|OPENAI_(BASE_URL|API_BASE)|Use current environment configuration)' \
  src/components/ConsoleOAuthFlow.tsx

Length of output: 53207


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='83d54b0ac8b59056a98d58f80f4b4ad1bfa22969'
head='a00a29e8dc62cf1470feaf4bf7fc28c6755441a0'

echo '=== Exact onboarding/trust diff ==='
git diff --unified=25 "$base" "$head" -- \
  src/interactiveHelpers.tsx \
  src/utils/setupScreenGates.ts \
  src/utils/setupScreenGates.test.ts

echo '=== Provider-label helper map and implementation ==='
fd -t f -E node_modules -E dist -E build 'providerDiscovery*' src
ast-grep outline src/utils/providerDiscovery.ts --items all --view expanded
rg -n -C 30 --glob 'providerDiscovery.{ts,tsx}' \
  '(getLocalOpenAICompatibleProviderLabel|function .*ProviderLabel|const .*ProviderLabel|new URL|baseUrl)' \
  src/utils

echo '=== Provider-label tests and calls ==='
rg -n -C 12 --glob '*.{test,spec}.{ts,tsx}' \
  '(getLocalOpenAICompatibleProviderLabel|local.*OpenAI.*label|ProviderLabel)' \
  src

Length of output: 49986


@kevincodex1 Re-reviewed the current PR. The endpoint disclosure fix is correctly applied at both UI display points, with raw URLs retained only for profile activation. The provider label path also does not expose URL credentials. The onboarding and workspace-trust changes preserve their existing gating semantics while applying them to third-party providers.

Blocking issues: None found. Approved.

[approve]

@kevincodex1
kevincodex1 merged commit fff83a1 into Gitlawb:main Jul 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants