Skip to content

fix(provider): show terminal launch feedback immediately#3758

Open
Amiyadesi wants to merge 1 commit into
farion1231:mainfrom
Amiyadesi:codex/immediate-terminal-launch-feedback
Open

fix(provider): show terminal launch feedback immediately#3758
Amiyadesi wants to merge 1 commit into
farion1231:mainfrom
Amiyadesi:codex/immediate-terminal-launch-feedback

Conversation

@Amiyadesi
Copy link
Copy Markdown

@Amiyadesi Amiyadesi commented Jun 5, 2026

Summary

Show feedback as soon as the user picks a directory and cc-switch starts opening a provider terminal.

The first version left an Opening terminal... toast visible when openTerminal failed, so users could see both "Opening terminal..." and "Failed to open terminal" at the same time. This update tracks the toast id: success reuses that toast for Terminal opened, and failure dismisses it before showing the error.

This keeps the useful immediate feedback without changing the failure path into mixed messages.

Related Issue

No linked issue.

Screenshots

Not captured; this is toast behavior only.

Checklist

  • Opening feedback appears right after directory selection
  • Success updates the same toast to terminalOpened
  • Failure dismisses the opening toast before terminalOpenFailed
  • Added i18n strings for the opening state

Verification

  • node .\node_modules\typescript\bin\tsc --noEmit
  • node .\node_modules\prettier\bin\prettier.cjs --check "src/**/*.{js,jsx,ts,tsx,css,json}"
  • git diff --check

@farion1231
Copy link
Copy Markdown
Owner

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de9b538cd0

ℹ️ 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".

Comment thread src/App.tsx Outdated
Comment on lines +782 to +786
toast.info(
t("provider.terminalOpening", {
defaultValue: "正在打开终端...",
}),
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Dismiss opening toast before reporting failures

When providersApi.openTerminal rejects after a directory is selected (for example, no supported terminal is installed or the provider lookup fails), this new info toast remains visible while the catch block also shows terminalOpenFailed. That changes the failure path from a single error message to conflicting “Opening terminal...” plus failure feedback, which is especially confusing because this commit intended to keep failures unchanged. Store the toast id and dismiss/update it before showing the error.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

👍

Opening provider terminals can block until the spawned CLI exits, so waiting for the backend command before showing feedback makes the UI look unresponsive. Show an immediate localized opening toast after directory selection, then replace it with the existing success toast once the backend returns.

The opening toast id is now tracked so failure handling can dismiss it before showing terminalOpenFailed. That keeps the failure path to one clear error message instead of leaving an 'Opening terminal...' toast beside the error.

Constraint: Keep this PR limited to frontend feedback and i18n.

Rejected: Only show terminalOpened after openTerminal resolves | on some terminal launch paths that message appears only after the terminal closes.

Confidence: high

Scope-risk: narrow

Tested: node .\\node_modules\\typescript\\bin\\tsc --noEmit

Tested: node .\\node_modules\\prettier\\bin\\prettier.cjs --check src/**/*.{js,jsx,ts,tsx,css,json}

Tested: git diff --check

Not-tested: Manual terminal launch across OS terminal apps

Co-authored-by: OmX <omx@oh-my-codex.dev>
@Amiyadesi Amiyadesi force-pushed the codex/immediate-terminal-launch-feedback branch from de9b538 to 828b079 Compare June 5, 2026 13:32
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