Skip to content

Hot-swap effort level on Claude session via applyFlagSettings#314295

Merged
TylerLeonhardt merged 1 commit intomainfrom
roblou/claude-effort-hotswap
May 5, 2026
Merged

Hot-swap effort level on Claude session via applyFlagSettings#314295
TylerLeonhardt merged 1 commit intomainfrom
roblou/claude-effort-hotswap

Conversation

@TylerLeonhardt
Copy link
Copy Markdown
Member

Use the SDK's applyFlagSettings({ effortLevel }) to update reasoning effort on an active Claude session, matching the model and permission-mode hot-swap pattern. This avoids the previous workaround of restarting the session whenever the user changed effort level.

Changes

  • claudeCodeAgent.ts: added _setEffort() mirroring _setModel() / _setPermissionMode(), and removed the effort !== _currentEffort restart trigger from _createPromptIterable. Effort is now hot-swapped alongside model and permission mode.
  • mockClaudeCodeSdkService.ts: added applyFlagSettings mock with applyFlagSettingsCallCount / lastAppliedFlagSettings tracking.
  • claudeCodeAgent.spec.ts: updated effort tests to assert hot-swap (no new query, applyFlagSettings invoked) instead of session restart.

Use the SDK's applyFlagSettings({ effortLevel }) to update reasoning
effort on an active Claude session, matching the model and permission-mode
hot-swap pattern. This avoids the previous workaround of restarting the
session whenever the user changed effort level.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 5, 2026 00:23
@microsoft microsoft deleted a comment from github-actions Bot May 5, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Claude chat session implementation so reasoning effort can be changed on an active SDK session via applyFlagSettings, aligning effort changes with the existing hot-swap behavior for model and permission mode instead of forcing a session restart.

Changes:

  • Added _setEffort() in ClaudeCodeSession and wired effort changes into the active-session hot-swap path.
  • Removed effort-level changes from the restart conditions so only non-hot-swappable changes (such as MCP tool changes) restart the session.
  • Extended the Claude SDK mock and updated session tests to assert applyFlagSettings usage instead of creating a new query.
Show a summary per file
File Description
extensions/copilot/src/extension/chatSessions/claude/node/claudeCodeAgent.ts Adds effort hot-swap support on active Claude sessions and updates restart logic/comments.
extensions/copilot/src/extension/chatSessions/claude/node/test/mockClaudeCodeSdkService.ts Extends the test mock to record applyFlagSettings calls and payloads.
extensions/copilot/src/extension/chatSessions/claude/node/test/claudeCodeAgent.spec.ts Updates session tests to verify effort hot-swap behavior instead of restart behavior.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 1

@TylerLeonhardt TylerLeonhardt enabled auto-merge (squash) May 5, 2026 00:30
@TylerLeonhardt TylerLeonhardt merged commit 1435f15 into main May 5, 2026
30 checks passed
@TylerLeonhardt TylerLeonhardt deleted the roblou/claude-effort-hotswap branch May 5, 2026 00:39
@vs-code-engineering vs-code-engineering Bot added this to the 1.120.0 milestone May 5, 2026
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.

3 participants