Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
196e37b
fix(core): resolve Qwen 3.8 reasoning budget conflicts
DragonnZhang Aug 4, 2026
a111a74
fix(core): cover unconfigured Qwen 3.8 conflicts
DragonnZhang Aug 4, 2026
b5cadf7
Merge main into dragon/fix-qwen38-thinking-budget-precedence
DragonnZhang Aug 4, 2026
cbf9685
Merge latest main into dragon/fix-qwen38-thinking-budget-precedence
DragonnZhang Aug 4, 2026
5386e37
chore: preserve latest main formatting
DragonnZhang Aug 4, 2026
acfebe2
fix(core): harden DashScope thinking precedence
DragonnZhang Aug 6, 2026
858147c
Merge main and address DashScope review
DragonnZhang Aug 6, 2026
6957bf7
Merge branch 'main' into dragon/fix-qwen38-thinking-budget-precedence
qwen-code-dev-bot Aug 7, 2026
cbd23e4
fix: honor DashScope thinking knob precedence
DragonnZhang Aug 7, 2026
6515cb1
test(core): assert same-layer thinking knob drop warning for request …
DragonnZhang Aug 7, 2026
0def9da
fix: align effort override reporting with wire resolution
DragonnZhang Aug 7, 2026
c6999e6
fix: resolve thinking knob review findings
DragonnZhang Aug 7, 2026
3f92484
fix: sort Python SDK test imports
DragonnZhang Aug 7, 2026
4e9ebc6
fix(core): ignore null thinking knobs
DragonnZhang Aug 7, 2026
9f27e19
fix(core): register enable_thinking true in thinking knob selection (…
DragonnZhang Aug 7, 2026
d1335e5
fix(core): preserve budget beneath thinking on-switch
DragonnZhang Aug 7, 2026
b214a83
fix(core): canonicalize disabled thinking knobs
DragonnZhang Aug 10, 2026
32c69a6
fix: resolve round-6 thinking knob review findings (#8525)
DragonnZhang Aug 10, 2026
fc7e54e
fix(external-context): read the response body with a reader, not for-…
DragonnZhang Aug 10, 2026
aa30c2d
Merge branch 'main' into dragon/fix-qwen38-thinking-budget-precedence
qwen-code-dev-bot Aug 10, 2026
282079c
Merge branch 'main' into dragon/fix-qwen38-thinking-budget-precedence
qwen-code-dev-bot Aug 10, 2026
a2703eb
Merge remote-tracking branch 'upstream/main' into dragon/fix-qwen38-t…
DragonnZhang Aug 11, 2026
ea91a35
Merge branch 'main' into dragon/fix-qwen38-thinking-budget-precedence
qwen-code-dev-bot Aug 11, 2026
868b25c
fix(sdk-python): expose effort status reason from CLI (#8525)
qwen-code-dev-bot Aug 11, 2026
e176476
Merge branch 'main' into dragon/fix-qwen38-thinking-budget-precedence
qwen-code-dev-bot Aug 11, 2026
3c74544
test(core): add direct unit tests for selectDashScopeThinkingKnob (#8…
qwen-code-dev-bot Aug 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions docs/users/configuration/model-providers.md

Large diffs are not rendered by default.

34 changes: 20 additions & 14 deletions integration-tests/cli/acp-integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -791,20 +791,26 @@ function setupAcpTest(
// Track which permission requests we've seen
const planModeRequests: PermissionRequest[] = [];

const { sendRequest, cleanup, stderr, sessionUpdates, permissionRequests, agent } =
setupAcpTest(rig, {
permissionHandler: (request) => {
// Track all permission requests for later verification
// Auto-approve exit plan mode requests with "proceed_always" to trigger auto-edit mode
if (request.toolCall?.kind === 'switch_mode') {
planModeRequests.push(request);
// Return proceed_always to switch to auto-edit mode
return { optionId: 'proceed_always' };
}
// Auto-approve all other requests
return { optionId: 'proceed_once' };
},
});
const {
sendRequest,
cleanup,
stderr,
sessionUpdates,
permissionRequests,
agent,
} = setupAcpTest(rig, {
permissionHandler: (request) => {
// Track all permission requests for later verification
// Auto-approve exit plan mode requests with "proceed_always" to trigger auto-edit mode
if (request.toolCall?.kind === 'switch_mode') {
planModeRequests.push(request);
// Return proceed_always to switch to auto-edit mode
return { optionId: 'proceed_always' };
}
// Auto-approve all other requests
return { optionId: 'proceed_once' };
},
});

try {
// Initialize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ import type { IControlContext } from '../ControlContext.js';
import type { IPendingRequestRegistry } from './baseController.js';
import { SystemController } from './systemController.js';

const { mockDebugLogger } = vi.hoisted(() => ({
mockDebugLogger: {
debug: vi.fn(),
info: vi.fn(),
warn: vi.fn(),
error: vi.fn(),
},
}));

vi.mock('@qwen-code/qwen-code-core', async (importOriginal) => ({
...(await importOriginal<typeof import('@qwen-code/qwen-code-core')>()),
createDebugLogger: () => mockDebugLogger,
}));

function createContext(
overrides: Partial<IControlContext> = {},
): IControlContext {
Expand All @@ -29,6 +43,7 @@ function createContext(
setModel: vi.fn(),
setReasoningEffort: vi.fn(),
getReasoningEffort: vi.fn().mockReturnValue(undefined),
getReasoningEffortOverride: vi.fn().mockReturnValue(undefined),
getAvailableModels: vi.fn().mockReturnValue([]),
} as unknown as IControlContext['config'],
streamJson: {
Expand Down Expand Up @@ -274,6 +289,7 @@ describe('SystemController', () => {
subtype: 'set_effort',
effort: 'high',
applied: true,
override: null,
});
});

Expand All @@ -297,6 +313,40 @@ describe('SystemController', () => {
subtype: 'set_effort',
effort: 'high',
applied: false,
override: null,
});
});

it('returns the higher-priority wire override', async () => {
const context = createContext();
(
context.config.getReasoningEffort as ReturnType<typeof vi.fn>
).mockReturnValue('high');
(
context.config.getReasoningEffortOverride as ReturnType<typeof vi.fn>
).mockReturnValue({
source: 'samplingParams',
field: 'enable_thinking',
});
const controller = new SystemController(
context,
createRegistry(),
'SystemController',
);

const result = await controller.handleRequest(
{ subtype: 'set_effort', effort: 'high' },
'effort-override',
);

expect(result).toEqual({
subtype: 'set_effort',
effort: 'high',
applied: false,
override: {
source: 'samplingParams',
field: 'enable_thinking',
},
});
});

Expand Down Expand Up @@ -449,9 +499,15 @@ describe('SystemController', () => {
expect(context.config.setReasoningEffort).toHaveBeenCalledWith('high');
expect(result).toHaveProperty('subtype', 'initialize');
expect(result).toHaveProperty('session_id', 'test-session-id');
expect(result).toHaveProperty('effort_status', {
effort: 'high',
applied: true,
override: null,
});
});

it('warns when effort not applied during initialize (thinking disabled)', async () => {
mockDebugLogger.warn.mockClear();
const context = createContext();
(
context.config.getReasoningEffort as ReturnType<typeof vi.fn>
Expand All @@ -470,6 +526,90 @@ describe('SystemController', () => {
expect(context.config.setReasoningEffort).toHaveBeenCalledWith('high');
expect(context.config.getReasoningEffort).toHaveBeenCalled();
expect(result).toHaveProperty('subtype', 'initialize');
expect(result).toHaveProperty('effort_status', {
effort: 'high',
applied: false,
override: null,
reason: 'thinking may be disabled',
});
expect(mockDebugLogger.warn).toHaveBeenCalledWith(
"[SystemController] Effort 'high' was not applied (thinking may be disabled)",
);
});

it('reports the higher-priority override during initialize', async () => {
mockDebugLogger.warn.mockClear();
const context = createContext();
(
context.config.getReasoningEffort as ReturnType<typeof vi.fn>
).mockReturnValue('high');
(
context.config.getReasoningEffortOverride as ReturnType<typeof vi.fn>
).mockReturnValue({
source: 'samplingParams',
field: 'enable_thinking',
});
const controller = new SystemController(
context,
createRegistry(),
'SystemController',
);

const result = await controller.handleRequest(
{ subtype: 'initialize', effort: 'high' },
'init-effort-override',
);

expect(result).toHaveProperty('effort_status', {
effort: 'high',
applied: false,
override: {
source: 'samplingParams',
field: 'enable_thinking',
},
reason: 'samplingParams.enable_thinking takes precedence',
});
expect(mockDebugLogger.warn).toHaveBeenCalledWith(
"[SystemController] Effort 'high' was not applied (samplingParams.enable_thinking takes precedence)",
);
});

it('joins every held cause in the effort_status reason during initialize', async () => {
mockDebugLogger.warn.mockClear();
const context = createContext();
(
context.config.getReasoningEffort as ReturnType<typeof vi.fn>
).mockReturnValue('medium');
(
context.config.getReasoningEffortOverride as ReturnType<typeof vi.fn>
).mockReturnValue({
source: 'extra_body',
field: 'thinking_budget',
});
const controller = new SystemController(
context,
createRegistry(),
'SystemController',
);

const result = await controller.handleRequest(
{ subtype: 'initialize', effort: 'high' },
'init-effort-both-causes',
);

expect(result).toHaveProperty('effort_status', {
effort: 'high',
applied: false,
override: {
source: 'extra_body',
field: 'thinking_budget',
},
reason:
'thinking may be disabled; extra_body.thinking_budget takes precedence',
});
expect(mockDebugLogger.warn).toHaveBeenCalledWith(
"[SystemController] Effort 'high' was not applied (thinking may be disabled; extra_body.thinking_budget takes precedence)",
);
});

it('rejects invalid effort during initialize', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
normalizeReasoningEffort,
loadUsageDashboard,
type MCPOAuthConfig,
type ReasoningEffortOverride,
} from '@qwen-code/qwen-code-core';

const debugLogger = createDebugLogger('SYSTEM_CONTROLLER');
Expand Down Expand Up @@ -162,6 +163,14 @@ export class SystemController extends BaseController {
}

this.context.config.setSdkMode(true);
let effortStatus:
| {
effort: string;
applied: boolean;
override: ReasoningEffortOverride | null;
reason?: string;
}
| undefined;

const canUseToolTimeout = payload.timeout?.canUseTool;
if (
Expand All @@ -177,13 +186,30 @@ export class SystemController extends BaseController {
const normalized = normalizeReasoningEffort(payload.effort);
if (normalized) {
try {
if (applyReasoningEffort(this.context.config, normalized)) {
debugLogger.info(
`[SystemController] Set reasoning effort to: ${normalized}`,
const effortMatches = applyReasoningEffort(
this.context.config,
normalized,
);
const override =
this.context.config.getReasoningEffortOverride?.() ?? null;
const applied = effortMatches && override === null;
const reason = applied
? undefined
: [
...(effortMatches ? [] : ['thinking may be disabled']),
...(override
? [`${override.source}.${override.field} takes precedence`]
: []),
].join('; ');
effortStatus = { effort: normalized, applied, override, reason };

if (!applied) {
debugLogger.warn(
`[SystemController] Effort '${normalized}' was not applied (${reason})`,
);
Comment thread
DragonnZhang marked this conversation as resolved.
Resolved
} else {
debugLogger.warn(
`[SystemController] Effort '${normalized}' was not applied (thinking may be disabled)`,
debugLogger.info(
`[SystemController] Set reasoning effort to: ${normalized}`,
);
}
} catch (error) {
Expand Down Expand Up @@ -310,6 +336,7 @@ export class SystemController extends BaseController {
subtype: 'initialize',
session_id: this.context.config.getSessionId(),
capabilities,
...(effortStatus ? { effort_status: effortStatus } : {}),
Comment thread
DragonnZhang marked this conversation as resolved.
Resolved
};
}

Expand Down Expand Up @@ -532,7 +559,13 @@ export class SystemController extends BaseController {
}

try {
const applied = applyReasoningEffort(this.context.config, normalized);
const effortMatches = applyReasoningEffort(
this.context.config,
normalized,
);
const override =
this.context.config.getReasoningEffortOverride?.() ?? null;
const applied = effortMatches && override === null;

debugLogger.info(
`[SystemController] Reasoning effort set to: ${normalized} (applied: ${applied})`,
Expand All @@ -542,6 +575,7 @@ export class SystemController extends BaseController {
subtype: 'set_effort',
effort: normalized,
applied,
override,
Comment on lines 575 to +578

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Acknowledged. This is a valid diagnostic consistency follow-up, but it does not identify a current correctness, security, or data-loss failure. This PR is beyond five change-producing review rounds, so the repository policy limits further scope to Critical findings. Deferring this item to avoid another diff expansion and leaving the thread unresolved for maintainer prioritization.

};
Comment thread
DragonnZhang marked this conversation as resolved.
Resolved
} catch (error) {
const errorMessage =
Expand Down
46 changes: 46 additions & 0 deletions packages/cli/src/ui/commands/effort-command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe('effortCommand', () => {
config: {
getReasoningEffort,
setReasoningEffort,
getReasoningEffortOverride: vi.fn().mockReturnValue(undefined),
} as unknown as Config,
settings: {
setValue,
Expand Down Expand Up @@ -94,6 +95,51 @@ describe('effortCommand', () => {
);
});

it('reports a static override while thinking is disabled', async () => {
setReasoningEffort.mockImplementation(() => {});
getReasoningEffort.mockReturnValue(undefined);
const getReasoningEffortOverride = vi.fn().mockReturnValue({
source: 'extra_body',
field: 'thinking_budget',
});
(context.services.config as unknown as Record<string, unknown>)[
'getReasoningEffortOverride'
] = getReasoningEffortOverride;

const res = await effortCommand.action!(context, 'high');

expect((res as { content: string }).content).toContain(
'thinking is currently disabled',
);
expect((res as { content: string }).content).toContain(
'will still have higher priority',
);
});

it('reports a higher-priority static thinking knob', async () => {
const getReasoningEffortOverride = vi.fn().mockReturnValue({
source: 'extra_body',
field: 'thinking_budget',
});
(context.services.config as unknown as Record<string, unknown>)[
'getReasoningEffortOverride'
] = getReasoningEffortOverride;

const res = await effortCommand.action!(context, 'max');

expect(setReasoningEffort).toHaveBeenCalledWith('max');
expect(setValue).toHaveBeenCalledWith(
expect.anything(),
'model.reasoningEffort',
'max',
);
expect(res).toMatchObject({ messageType: 'info' });
expect((res as { content: string }).content).toContain('higher priority');
Comment thread
DragonnZhang marked this conversation as resolved.
Resolved
expect((res as { content: string }).content).toContain(
'will remain effective',
);
});

it('normalizes aliases such as x-high', async () => {
await effortCommand.action!(context, 'x-high');
expect(setReasoningEffort).toHaveBeenCalledWith('xhigh');
Expand Down
Loading
Loading