Skip to content

feat: add session thinking effort flag - #2610

Open
codeErrorSleep wants to merge 1 commit into
MoonshotAI:mainfrom
codeErrorSleep:feat/session-thinking-effort
Open

feat: add session thinking effort flag#2610
codeErrorSleep wants to merge 1 commit into
MoonshotAI:mainfrom
codeErrorSleep:feat/session-thinking-effort

Conversation

@codeErrorSleep

Copy link
Copy Markdown

Related Issue

Resolves #2535

Problem

Kimi Code users could not override the thinking effort when starting or resuming a session without changing
config.toml. This made it inconvenient to select different effort levels for interactive use, one-shot prompts,
scripts, and CI workflows.

What changed

  • Added --effort <effort> support to the interactive TUI, --prompt mode, resumed sessions, and the v2 print path.
  • Applied the override when creating a session and when resuming an existing session.
  • Applied --model before --effort so agent-core validates the effort against the target model.
  • Accepted any non-empty effort string at the CLI boundary, leaving model-specific validation and normalization to
    agent-core.
  • Kept the override session-scoped without modifying config.toml.
  • Synchronized the TUI from the resulting session state so normalized effort values are displayed correctly.
  • Added coverage for argument parsing, new and resumed sessions, model/effort ordering, v1 prompt mode, v2 print
    mode, and TUI startup.
  • Updated the English and Chinese CLI documentation and added a patch changeset.

Validation completed:

  • Targeted Vitest suite: 197 tests passed.
  • pnpm --filter @moonshot-ai/kimi-code typecheck
  • pnpm --filter @moonshot-ai/kimi-code build
  • pnpm lint

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1266d3c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@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: f390596f1f

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

const createSessionOptions: MutableCreateSessionOptions = {
workDir,
model: startup.model,
thinking: startup.effort,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the effort override through OAuth login

When a fresh interactive startup reaches auth.login_required, this initial creation is abandoned and AuthFlowController.refreshConfigAfterLogin() later creates the session using thinkingEffortFromConfig(config.thinking) rather than startup.effort. Consequently, kimi --effort low silently loses the requested override whenever the user must log in first; forward the startup effort into the post-login creation path as is already done for the startup model.

Useful? React with 👍 / 👎.

const session = await harness.createSession({
workDir,
model,
thinking: opts.effort,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Strictly validate effort on fresh sessions

For a fresh session, forwarding the value through createSession does not provide the model-specific validation promised by this flag: the v1 create path calls resolveThinkingEffort without strict Kimi-protocol validation, while the fresh v2 binding likewise omits strictThinking, so an unsupported value can be retained for a later upstream failure or silently normalized instead of rejecting the invocation. Resumed sessions do call setThinking and reject the same input, making behavior depend on whether the session already exists; fresh prompt, TUI, and native-v2 creation should use the strict setter/binding semantics too.

Useful? React with 👍 / 👎.

@codeErrorSleep
codeErrorSleep force-pushed the feat/session-thinking-effort branch from f390596 to 1266d3c Compare August 5, 2026 04:29
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.

[Feature] Support passing thinking effort via a CLI flag (e.g. --effort)

1 participant