fix: read thinking/verbose/reasoning levels from session entry in status

buildStatusMessage resolved thinkLevel, verboseLevel, and reasoningLevel
without falling back to sessionEntry, unlike elevatedLevel which already
had this fallback. When session_status tool calls buildStatusMessage
without passing resolvedThink/resolvedVerbose/resolvedReasoning, the
levels always fell back to agent defaults or "off", ignoring the
runtime-set session values.

Add sessionEntry fallback for thinkingLevel, verboseLevel, and
reasoningLevel, consistent with how elevatedLevel already works.

Closes #30126

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
YuzuruS
2026-03-01 08:14:00 +09:00
committed by Ayaan Zaidi
parent 54c46b7c8c
commit 310344b6e4
2 changed files with 27 additions and 3 deletions

View File

@@ -90,6 +90,28 @@ describe("buildStatusMessage", () => {
expect(normalized).toContain("Queue: collect");
});
it("falls back to sessionEntry levels when resolved levels are not passed", () => {
const text = buildStatusMessage({
agent: {
model: "anthropic/pi:opus",
},
sessionEntry: {
sessionId: "abc",
updatedAt: 0,
thinkingLevel: "high",
verboseLevel: "full",
reasoningLevel: "on",
},
sessionKey: "agent:main:main",
queue: { mode: "collect", depth: 0 },
});
const normalized = normalizeTestText(text);
expect(normalized).toContain("Think: high");
expect(normalized).toContain("verbose:full");
expect(normalized).toContain("Reasoning: on");
});
it("notes channel model overrides in status output", () => {
const text = buildStatusMessage({
config: {

View File

@@ -506,9 +506,11 @@ export function buildStatusMessage(args: StatusArgs): string {
}
}
const thinkLevel = args.resolvedThink ?? args.agent?.thinkingDefault ?? "off";
const verboseLevel = args.resolvedVerbose ?? args.agent?.verboseDefault ?? "off";
const reasoningLevel = args.resolvedReasoning ?? "off";
const thinkLevel =
args.resolvedThink ?? args.sessionEntry?.thinkingLevel ?? args.agent?.thinkingDefault ?? "off";
const verboseLevel =
args.resolvedVerbose ?? args.sessionEntry?.verboseLevel ?? args.agent?.verboseDefault ?? "off";
const reasoningLevel = args.resolvedReasoning ?? args.sessionEntry?.reasoningLevel ?? "off";
const elevatedLevel =
args.resolvedElevated ??
args.sessionEntry?.elevatedLevel ??