Skip to content

fix(config): open the oauth-url link in the browser and print it unwrapped (SUPPORT-17391) - #726

Draft
ZoraJel wants to merge 2 commits into
mainfrom
SUPPORT-17391-auto-open-oauth-url
Draft

fix(config): open the oauth-url link in the browser and print it unwrapped (SUPPORT-17391)#726
ZoraJel wants to merge 2 commits into
mainfrom
SUPPORT-17391-auto-open-oauth-url

Conversation

@ZoraJel

@ZoraJel ZoraJel commented Sep 1, 2026

Copy link
Copy Markdown

Summary

SUPPORT-17391: config oauth-url prints a ~200-char URL, so it fits no terminal row, and the wrapped copy is what users actually follow. Two layers truncate it — Rich inserted real newlines at the console width, and terminals/chat renderers autodetect URLs per visual row — and both lose the config id in the trailing #/<component>/<config> fragment while keeping token/sapiUrl. The wizard therefore authenticates and then 404s on the configuration, reporting Failed to load config data. Please contact us on support@keboola.com, which reads like a broken OAuth flow.

Nothing printed can fix a renderer we don't control, so the command opens the link itself and keeps the text as a copy fallback:

-formatter.console.print(f"  [link]{result['url']}[/link]")   # style tag, not a hyperlink; hard-wrapped
+formatter.console.print(url, soft_wrap=True, highlight=False, markup=False)
+if _should_open(no_open=no_open, is_terminal=formatter.console.is_terminal) and open_browser(url):
+    ...  # "Opened in your default browser"

_should_open is interactive-only: --json returns before it, a non-terminal stdout (pipe, CI, serve) never opens a window, and --no-open opts out when authorizing on another machine. JSON output is unchanged.

auth.environment.open_browser gains the WSL branch it lacked. webbrowser keys its Windows handling off sys.platform == "win32", which is linux inside WSL, so it either resolved no handler (→ False, no browser) or opened a Linux-side browser with a separate profile that shares none of the logins the flow needs. wslview was already probed here for the login-flow heuristics but never used to open anything:

if _env_flag_set("WSL_INTEROP") and _wslview_is_working():
    return _open_via_wslview(url)   # synchronous: the exit status is the answer

Skill docs: a new references/oauth-workflow.md (generate → consent → verify oauth_api.version bumped) whose reporting rule is the other half of the fix — an agent answering in chat must echo the URL in a fenced code block, never as inline prose, because that is the surface where per-row link detection truncates it. Plus the oauth-url row in commands-reference.md and a gotchas entry recording the symptom.

Unchanged on purpose: the 1 h token TTL (the UI mints 48 h) and the absence of a config preflight before minting.

Release Notes

Justification, description

kbagent config oauth-url handed out a link that terminals and chat renderers truncate at the first visual row, dropping the configuration id and failing in the browser with "Failed to load config data". The command now opens the link in the default browser itself (interactive use only; --no-open to suppress) and prints the complete URL unwrapped. Includes a WSL fix so the Windows-side default browser is used instead of none, and a skill workflow telling agents to echo the URL in a fenced code block.

Plans for Customer Communication

N/A

Impact Analysis

config oauth-url in interactive human mode now opens a browser window as a side effect. --json and non-terminal stdout are unaffected, so scripted, piped and server callers see no change; the response payload is identical.

Deployment Plan

Ships with the next kbagent release.

Rollback Plan

Revert the commits; --no-open reproduces the previous behavior in the meantime.

Post-Release Support Plan

N/A

Link to Devin session: https://app.devin.ai/sessions/e0d8eb25504b4b7cb6b1f9c354d448e3
Open in Devin Desktop: https://app.devin.ai/desktop/session/e0d8eb25504b4b7cb6b1f9c354d448e3?variant=devin
Requested by: @ZoraJel

…apped (SUPPORT-17391)

Co-Authored-By: Zora Jelínková <zora.jelinkova@keboola.com>
@devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

…block (SUPPORT-17391)

Co-Authored-By: Zora Jelínková <zora.jelinkova@keboola.com>
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.

1 participant