Skip to content

feat(shell): include session id in kimi export hint on errors#2034

Open
kermanx wants to merge 7 commits into
MoonshotAI:mainfrom
kermanx:kermanx/export-session-hint
Open

feat(shell): include session id in kimi export hint on errors#2034
kermanx wants to merge 7 commits into
MoonshotAI:mainfrom
kermanx:kermanx/export-session-hint

Conversation

@kermanx

@kermanx kermanx commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

N/A — small UX follow-up.

Description

When the interactive shell surfaces a recoverable chat-provider error or an unexpected exception, the kimi export hint previously printed without any session identifier, forcing the user to look up the ID before running the command. This PR:

  • Reads the current session ID from self.soul.runtime.session.id when the soul is a KimiSoul, and inlines it as kimi export <session_id> inside the hint so the user can copy the whole command as-is.
  • Applies the same treatment to both error branches in run_soul_command: the non-401/402/403 ChatProviderError branch and the catch-all Exception branch.
  • Falls back to the plain kimi export when no KimiSoul runtime is attached.
  • Fixes two adjacent-string-literal spacing issues in the same message introduced earlier (terminal+and, [/link]+for).

Verified locally by temporarily raising APIConnectionError before run_soul and asserting via an expect script that the printed session ID matched the one shown in the welcome banner.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog.
  • I have run make gen-docs to update the user documentation.

Open in Devin Review

Error hints now print the current session ID after `kimi export`
so users can copy-paste the command directly, and surface the
support email `code@moonshot.ai` inline.
Copilot AI review requested due to automatic review settings April 23, 2026 11:35

This comment was marked as resolved.

Matches the other error branch so both paths surface code@moonshot.ai
instead of the vague "send the exported data to support" wording.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Signed-off-by: _Kerman <kermanx@qq.com>
@kermanx

kermanx commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Signed-off-by: _Kerman <kermanx@qq.com>
devin-ai-integration[bot]

This comment was marked as resolved.

kermanx and others added 3 commits April 23, 2026 20:16
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Signed-off-by: _Kerman <kermanx@qq.com>
Added new features and fixes for various components, including core configuration options and improvements to the Shell and Kimi functionalities.

Signed-off-by: _Kerman <kermanx@qq.com>
Signed-off-by: _Kerman <kermanx@qq.com>

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

Copy link
Copy Markdown

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: 1cd9416c6a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

session_id = (
self.soul.runtime.session.id if isinstance(self.soul, KimiSoul) else None
)
export_cmd = f"kimi export {session_id}" if session_id else "kimi export"

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 Insert -- before session ID in export hint

The hint builds kimi export {session_id} directly, which breaks for valid custom session IDs that start with - (for example created via --session=-debug): when users copy-paste it, Typer parses the ID as an option and the export command fails instead of exporting that session. Since session_id is an unconstrained string in session creation/resume paths, render the hint as kimi export -- <id> (with quoting/escaping as needed) in both error branches.

Useful? React with 👍 / 👎.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review


## Unreleased

- Shell: Error hints now include the specific session ID in the `kimi export` command and surface the direct support email address `code@moonshot.ai`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Manual edit of auto-generated English changelog violates docs/AGENTS.md rule

The docs/AGENTS.md file explicitly states: "The English changelog (docs/en/release-notes/changelog.md) is auto-generated from the root CHANGELOG.md. Do not edit it manually." This PR manually edits docs/en/release-notes/changelog.md (adding the new Shell error-hint entry at line 7), which violates that rule. The root CHANGELOG.md already contains the same entry, so the sync script (npm run sync) would produce the correct output — the manual edit should be removed and the sync script relied upon instead.

Prompt for agents
The file docs/en/release-notes/changelog.md should not be manually edited according to docs/AGENTS.md. Instead, only the root CHANGELOG.md should be edited, and then the sync script (npm run sync from the docs/ directory) should be run to auto-generate this file. Revert the manual changes to docs/en/release-notes/changelog.md and rely on the sync script to propagate the entry from CHANGELOG.md.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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