fix: make authentication remediation safe for headless use - #103
Merged
Conversation
Tailor doctor guidance to interactive versus agent, JSON, and non-TTY callers, with stdin-safe commands and environment-variable alternatives for each authentication plane. Render human errors with the documented [ERROR] marker, preserve multiline guidance, and keep configuration failures from appending command examples. Name lakehouse credentials explicitly when queries lack authentication.
Pass DoctorCheckContext directly to skip, run, and remediation callbacks. Remove the unused failure wrapper and error parameter so the lifecycle contract follows the existing command callback convention.
albert20260301
suggested changes
Sep 3, 2026
albert20260301
left a comment
Contributor
There was a problem hiding this comment.
Required before merge: rename this PR with a Conventional Commit prefix (for example, fix(cli): make authentication remediation safe for headless use). The semantic-title check is currently the only failing check; the rest of the CI matrix is green.
albert20260301
approved these changes
Sep 3, 2026
albert20260301
left a comment
Contributor
There was a problem hiding this comment.
Title corrected and required checks are now green; approving.
leonkenneth
approved these changes
Sep 4, 2026
francoischalifour
enabled auto-merge (squash)
September 4, 2026 08:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The CLI’s first-run authentication guidance was optimized for an interactive human terminal, but it was also emitted to agents, JSON consumers, and non-TTY environments.
That created several rough edges:
doctorled headless callers toward browser login or interactive--scopeconfiguration, neither of which can complete safely in automation.\x0a.EXAMPLESsection, which is useful for parser/usage errors but noisy and misleading when configuration is the actual problem.[ERROR]prefix, while the CLI renderedERROR.This PR keeps the existing interactive path for humans while making failure guidance safe and actionable for programmatic callers.
What changed
Context-aware doctor remediation
doctornow carries an explicitinteractiveproperty in its check context. It is true only for a human terminal with TTY stdin and without--jsonor--agent.For an interactive human terminal, doctor preserves the existing login-first guidance:
For
--agent,--json, or non-TTY stdin, doctor instead provides plane-specific, non-interactive remediation.Management authentication:
Lakehouse authentication:
The same mode-aware recommendations are used for failed management and lakehouse API checks, not only missing credentials. This avoids directing agents toward a browser or interactive wizard after a probe failure.
Safe non-interactive login and configure guidance
When
loginis invoked without an interactive terminal, its error now recommends piping an API key through--api-key-stdinor using management environment variables.The non-TTY
profile configureerror similarly replaces the API-key-on-argv example with--api-key-stdin. This avoids suggesting that secrets be exposed in process listings.Clearer lakehouse query failures
The missing credential error raised by the lakehouse query path now says “No lakehouse credentials,” making it clear that the data-plane authentication is missing rather than management authentication.
Human error presentation
Human-readable errors now:
[ERROR]prefix.JSON error envelopes are unchanged.
Tests
Added or updated coverage for:
loginandprofile configureerrors.[ERROR]rendering and multiline sanitization.EXAMPLESfor configuration failures.