fix(settings): highlight changes that apply next turn (#2201)
Permission and thinking changes made during an active turn do not affect that turn. Use setting-specific warnings so the timing is harder to miss.
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import type { AgentProviderNotice } from "./agent-sdk-types.js";
|
||||
|
||||
export const SETTING_APPLIES_NEXT_TURN_NOTICE: AgentProviderNotice = {
|
||||
type: "info",
|
||||
message: "This change applies next turn.",
|
||||
export const MODE_APPLIES_NEXT_TURN_NOTICE: AgentProviderNotice = {
|
||||
type: "warning",
|
||||
message: "Permission mode applies next turn",
|
||||
};
|
||||
|
||||
export const THINKING_APPLIES_NEXT_TURN_NOTICE: AgentProviderNotice = {
|
||||
type: "warning",
|
||||
message: "Thinking level applies next turn",
|
||||
};
|
||||
|
||||
@@ -704,8 +704,8 @@ describe("ClaudeAgentSession features", () => {
|
||||
});
|
||||
|
||||
await expect(session.setThinkingOption?.("ultracode")).resolves.toEqual({
|
||||
type: "info",
|
||||
message: "This change applies next turn.",
|
||||
type: "warning",
|
||||
message: "Thinking level applies next turn",
|
||||
});
|
||||
|
||||
await session.close();
|
||||
|
||||
@@ -50,7 +50,7 @@ import { claudeQuery, type ClaudeOptions, type ClaudeQueryFactory } from "./quer
|
||||
import { realClaudeRewindSdk, revertClaudeConversation, revertClaudeFiles } from "./rewind.js";
|
||||
import { normalizeProviderReplayTimestamp } from "../../provider-history-timestamps.js";
|
||||
import { claudeProjectDirSync } from "./project-dir.js";
|
||||
import { SETTING_APPLIES_NEXT_TURN_NOTICE } from "../../provider-notices.js";
|
||||
import { THINKING_APPLIES_NEXT_TURN_NOTICE } from "../../provider-notices.js";
|
||||
import {
|
||||
isProviderImageMarkdown,
|
||||
materializeProviderImage,
|
||||
@@ -2209,7 +2209,7 @@ class ClaudeAgentSession implements AgentSession {
|
||||
}
|
||||
this.queryRestartNeeded = true;
|
||||
if (this.activeForegroundTurnId || this.autonomousTurn) {
|
||||
return SETTING_APPLIES_NEXT_TURN_NOTICE;
|
||||
return THINKING_APPLIES_NEXT_TURN_NOTICE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -347,12 +347,12 @@ describe("Codex app-server provider", () => {
|
||||
const session = createSession({ modeId: "auto", thinkingOptionId: "medium" });
|
||||
|
||||
await expect(session.setMode("full-access")).resolves.toEqual({
|
||||
type: "info",
|
||||
message: "This change applies next turn.",
|
||||
type: "warning",
|
||||
message: "Permission mode applies next turn",
|
||||
});
|
||||
await expect(session.setThinkingOption?.("high")).resolves.toEqual({
|
||||
type: "info",
|
||||
message: "This change applies next turn.",
|
||||
type: "warning",
|
||||
message: "Thinking level applies next turn",
|
||||
});
|
||||
|
||||
session.activeForegroundTurnId = null;
|
||||
|
||||
@@ -92,7 +92,10 @@ import {
|
||||
resolveBinaryVersion,
|
||||
} from "./diagnostic-utils.js";
|
||||
import { appendOrReplaceGrowingAssistantMessage, runProviderTurn } from "./provider-runner.js";
|
||||
import { SETTING_APPLIES_NEXT_TURN_NOTICE } from "../provider-notices.js";
|
||||
import {
|
||||
MODE_APPLIES_NEXT_TURN_NOTICE,
|
||||
THINKING_APPLIES_NEXT_TURN_NOTICE,
|
||||
} from "../provider-notices.js";
|
||||
import type { WorkspaceGitService } from "../../workspace-git-service.js";
|
||||
|
||||
function assertChildWithPipes(
|
||||
@@ -3943,7 +3946,7 @@ export class CodexAppServerAgentSession implements AgentSession {
|
||||
this.currentMode = modeId;
|
||||
this.cachedRuntimeInfo = null;
|
||||
if (this.activeForegroundTurnId) {
|
||||
return SETTING_APPLIES_NEXT_TURN_NOTICE;
|
||||
return MODE_APPLIES_NEXT_TURN_NOTICE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3961,7 +3964,7 @@ export class CodexAppServerAgentSession implements AgentSession {
|
||||
this.refreshResolvedCollaborationMode();
|
||||
this.cachedRuntimeInfo = null;
|
||||
if (this.activeForegroundTurnId) {
|
||||
return SETTING_APPLIES_NEXT_TURN_NOTICE;
|
||||
return THINKING_APPLIES_NEXT_TURN_NOTICE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -232,7 +232,10 @@ describe("OMP agent client and session", () => {
|
||||
expect.objectContaining({ name: "review", kind: "skill" }),
|
||||
]),
|
||||
);
|
||||
await expect(omp.setMode("ask")).resolves.toEqual(expect.objectContaining({ type: "info" }));
|
||||
await expect(omp.setMode("ask")).resolves.toEqual({
|
||||
type: "warning",
|
||||
message: "Start a new OMP session to change approval mode",
|
||||
});
|
||||
});
|
||||
|
||||
test("rewinds natively, interrupts, and shuts down", async () => {
|
||||
|
||||
@@ -1084,9 +1084,8 @@ export class OmpAgentSession implements AgentSession {
|
||||
throw new Error(`Invalid OMP mode '${modeId}'`);
|
||||
}
|
||||
return {
|
||||
type: "info",
|
||||
message:
|
||||
"OMP approval mode is set when the agent launches. Start a new OMP session to use a different mode.",
|
||||
type: "warning",
|
||||
message: "Start a new OMP session to change approval mode",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user