Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
33 changes: 33 additions & 0 deletions src/renderer/state/appStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,39 @@ describe("appStore runtime config sync", () => {
expect(useAppStore.getState().projects).toHaveLength(1);
});

it("does not bump updatedAt when the composer changes config without sending", () => {
// Changing effort/model/mode is not thread activity: bumping `updatedAt`
// reshuffled the sidebar and advanced the relative-time label before the
// user had sent anything.
vi.useFakeTimers();
vi.setSystemTime(new Date("2026-05-10T12:00:00.000Z"));
const project = useAppStore.getState().addProject({
kind: "windows",
path: "C:\repo",
});
const thread = useAppStore.getState().createThread({
projectId: project.id,
agentKind: "codex",
config: { model: "gpt-5.4", effort: "low" },
prompt: "hello",
});
const originalUpdatedAt = thread.updatedAt;

vi.setSystemTime(new Date("2026-05-10T13:00:00.000Z"));
useAppStore.getState().updateThreadConfig(thread.id, {
model: "gpt-5.4",
effort: "high",
});

expect(useAppStore.getState().threads[0]?.config.effort).toBe("high");
expect(useAppStore.getState().threads[0]?.updatedAt).toBe(originalUpdatedAt);

// Sending is what marks the thread as active.
useAppStore.getState().touchThread(thread.id);
expect(useAppStore.getState().threads[0]?.updatedAt).toBe("2026-05-10T13:00:00.000Z");
vi.useRealTimers();
});

it("preserves a user's pending composer change when runtime echoes the prior config", () => {
// Reproduces the bug where a thread-state event from the supervisor (which
// re-sends `session.config` on every status update) clobbered a pending
Expand Down
5 changes: 4 additions & 1 deletion src/renderer/state/slices/threadSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,13 @@ export const createThreadSlice: SliceCreator<ThreadSlice> = (set) => ({
const nextConfig = thread.presentationMode === "gui" ? config : stripPlanMode(config);
if (isThreadConfigEqual(thread.config, nextConfig)) return thread;
changed = true;
// Deliberately no `updatedAt` bump: picking a model/effort/mode in the
// composer is not thread activity, and bumping it would reshuffle the
// sidebar (and the relative-time label) before anything was sent. The
// send path touches the thread on submit instead.
return {
...thread,
config: nextConfig,
updatedAt: new Date().toISOString(),
};
});
return changed ? { threads } : {};
Expand Down