Skip to content

fix(cosh): clarify cosh-switch post-switch guidance#1424

Open
samchu-zsl wants to merge 1 commit into
alibaba:mainfrom
samchu-zsl:fix/cosh/1352-cosh-switch-feedback
Open

fix(cosh): clarify cosh-switch post-switch guidance#1424
samchu-zsl wants to merge 1 commit into
alibaba:mainfrom
samchu-zsl:fix/cosh/1352-cosh-switch-feedback

Conversation

@samchu-zsl

Copy link
Copy Markdown
Collaborator

Description

After /cosh-switch (or cosh-switch in bash) runs a successful yum swap, the only feedback was yum's raw Complete! output, leaving users unsure whether the switch worked — the current session still runs the old mode because a live shell process cannot hot-switch. This adds clear, bilingual (zh/en) post-switch guidance that names the target package and instructs the user to reopen the shell (or reconnect the session) and run cosh to enter the new mode. The message is applied consistently to both the standalone /usr/bin/cosh-switch script and the /cosh-switch slash command, with language selected from $LANG.

Related Issue

closes #1352

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • CI/CD or build changes

Scope

  • cosh (copilot-shell)

Checklist

  • I have read the Contributing Guide
  • My code follows the project's code style
  • I have added tests that prove my fix is effective or that my feature works
  • For cosh: Lint passes, type check passes, and tests pass
  • Lock files are up to date (package-lock.json / Cargo.lock)

Testing

The change is confined to the RPM packaging shell script in copilot-shell.spec.in; there is no TypeScript code path, so vitest cannot cover it. Verified via:

bash -n <extracted switch script>          # both variants pass
# TOML run field: triple-quotes balanced, parses cleanly
# functional check of the $LANG branch:
LANG=zh_CN.UTF-8 -> Chinese guidance
LANG=en_US.UTF-8 / unset -> English guidance

The yum swap step itself requires a live RPM environment and root, so it cannot be exercised in CI/unit tests.

Additional Notes

Issue #1352 is labeled component:cosh but is framed as an enhancement rather than a Bug; implemented per user request. The two switch script definitions in the spec remain duplicated (pre-existing); this PR keeps them in sync rather than refactoring.

After yum swap succeeds, the current session still runs the old mode and
cannot hot-switch, but the raw yum "Complete!" output left users unsure
whether the switch worked. Emit bilingual (zh/en) guidance naming the
target package and instructing the user to reopen the shell and run cosh.
Applied to both /usr/bin/cosh-switch and the /cosh-switch slash command.

Closes alibaba#1352

Assisted-by: Qoder
Signed-off-by: shenglongzhu <samchu.zsl@alibaba-inc.com>
@samchu-zsl

Copy link
Copy Markdown
Collaborator Author

Caution

This PR was generated and submitted by AI.
Please review all changes carefully before merging. Pay special attention to logic correctness, edge cases, and potential side effects.

@github-actions github-actions Bot added the component:cosh src/copilot-shell/ label Jul 10, 2026
@samchu-zsl samchu-zsl marked this pull request as ready for review July 10, 2026 05:52
@samchu-zsl samchu-zsl requested a review from kongche-jbw as a code owner July 10, 2026 05:52
@samchu-zsl

Copy link
Copy Markdown
Collaborator Author

Manually verified:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:cosh src/copilot-shell/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[cosh-ng] 优化 /cosh-switch 成功后的模式切换反馈

1 participant