Skip to content

fix(launcher): surface curl diagnostics and restore the terminal CLI install prompt#448

Merged
ilysenko merged 1 commit into
ilysenko:mainfrom
ryan-mt:fix/launcher-tty-diagnostics
Jun 11, 2026
Merged

fix(launcher): surface curl diagnostics and restore the terminal CLI install prompt#448
ilysenko merged 1 commit into
ilysenko:mainfrom
ryan-mt:fix/launcher-tty-diagnostics

Conversation

@ryan-mt

@ryan-mt ryan-mt commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

What changed

Two launcher bugs in launcher/start.sh.template that hid information from terminal users:

  1. verify_webview_origin never surfaced the captured curl diagnostic. The error file was read back with detail=$(< "$err" 2>/dev/null). In bash, $(< file) only works as the sole element of a command substitution; with the extra redirection it becomes a null command and produces no output, so detail was always empty and every webview-origin failure logged the generic curl exited non-zero with no diagnostic fallback instead of the real cause (connect refused, timeout, HTTP status, ...) that the comment block above documents as the purpose of this code. Now reads with cat.

    Empirical check (bash 5.3):

    $ echo "connection refused" > f
    $ a=$(< f 2>/dev/null); echo "[$a]"
    []
    $ a=$(cat f 2>/dev/null || true); echo "[$a]"
    [connection refused]
    
  2. The interactive Install Codex CLI now? [Y/n] terminal prompt was unreachable. The launcher redirects stdout/stderr into the log early (exec >>"$LOG_FILE" 2>&1), so the later [ -t 1 ] check in is_interactive_terminal was always false. Terminal launches with a missing CLI were routed to the GUI prompt path, or hard-exited when no update manager is installed — the elaborate prompt_install_missing_cli flow could never run (and its printf would have gone into the log file anyway). Interactivity is now captured before the redirect, and the prompt reads/writes via /dev/tty.

Source-of-truth files

  • launcher/start.sh.template (runtime launcher behavior)
  • tests/scripts_smoke.sh (added template assertions)

Validation

  • bash -n on install.sh, scripts/lib/*.sh, launcher/start.sh.template, build scripts — clean
  • bash tests/scripts_smoke.sh on this branch in Ubuntu (WSL): All script smoke tests passed
  • Same suite passes identically on main (baseline)

Notes / limitations

  • Verified on Ubuntu under WSL2; not exercised against a real packaged install.

…install prompt

Two launcher bugs hid information from terminal users:

1. verify_webview_origin captured curl stderr into a file but read it
   back with `detail=$(< "$err" 2>/dev/null)`. With an extra redirection
   this is a null command in bash, so `detail` was always empty and every
   webview origin failure logged the generic "curl exited non-zero with
   no diagnostic" fallback instead of the real curl error this code
   exists to surface. Use `cat` instead.

2. The interactive "Install Codex CLI now? [Y/n]" prompt was
   unreachable: stdout/stderr are redirected into the launcher log early
   via `exec >>"$LOG_FILE" 2>&1`, so the later `[ -t 1 ]` check in
   is_interactive_terminal was always false and terminal launches were
   routed to the GUI prompt (or a hard exit without an update manager).
   Capture interactivity before the redirect and talk to /dev/tty when
   prompting.

@ilysenko ilysenko left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed. No blocking issues found; CI is green and the launcher changes are scoped to the source template.

@ilysenko ilysenko merged commit 6f5cddd into ilysenko:main Jun 11, 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