Add actionable CLI startup diagnostics - #457
Conversation
# Conflicts: # test/test_ai-code-backends-infra-ghostel-executable.el
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a09492f524
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| (if failure-buffer | ||
| (progn | ||
| (ai-code-backends-infra--handle-session-start-failure |
There was a problem hiding this comment.
Preserve terminal setup errors
When Ghostel is installed but lacks ghostel-exec, ai-code-backends-infra--start-ghostel-process deliberately raises an actionable version error after the Ghostel session buffer has been created. Because failure-buffer is therefore non-nil, this branch suppresses that error and reports a generic CLI startup failure with unknown process status instead, incorrectly directing the user to troubleshoot the CLI rather than upgrade Ghostel. Re-signal terminal configuration errors or safely retain their diagnostic reason.
Useful? React with 👍 / 👎.
| (resolved-program (if (string-prefix-p "~" program) | ||
| (expand-file-name program) | ||
| program)) |
There was a problem hiding this comment.
Resolve tilde paths against the selected session host
When a backend program is configured as ~/bin/codex and a prefix invocation selects a remote working directory, this expands ~ before ai-code-backends-infra--session-working-directory has chosen that directory. The resulting command therefore contains a path resolved for the source buffer—often a local home path or a different TRAMP host—which is then executed in the selected remote session and fails unless both homes happen to match. Defer expansion until the working directory is known or leave remote shell expansion intact.
Useful? React with 👍 / 👎.
Summary
Make failed AI CLI startup diagnostics actionable while keeping sensitive terminal output, credentials, and forged control-character lines out of persistent message logs.
Root cause
backend=unknowneven though the caller already had the prefix.process-commanddescribes the internal/bin/sh -cwrapper rather than the AI CLI launch command, so diagnostics reported the wrong executable and could expose secrets embedded in the wrapper string.--github-token,--api_key, access-key variants, and authorization headers.AWS_SECRET_ACCESS_KEY.name=valuematcher required the value to fit on one line, so credentials containing newlines bypassed redaction.--env=AWS_SECRET_ACCESS_KEY=valuetreated only the outer option as the name and exposed the inner value.*Messages*.message, which could persist credentials or private output in*Messages*.Changes
--header,-H, and compact-H...value forms.--env=and-eenvironment assignments before rendering them.Merge conflict resolution
1367dca.ai-code-backends-infra-startup.elhelper and its side-panel activation coupling.Validation
fefc2a2.