Skip to content

Commit 60b013e

Browse files
committed
review fixes
1 parent 9c61f65 commit 60b013e

File tree

4 files changed

+30
-17
lines changed

4 files changed

+30
-17
lines changed

apps/twig/src/renderer/features/sessions/service/service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ interface AuthCredentials {
6363
client: ReturnType<typeof useAuthStore.getState>["client"];
6464
}
6565

66-
interface ConnectParams {
66+
export interface ConnectParams {
6767
task: Task;
6868
repoPath: string;
6969
initialPrompt?: ContentBlock[];
@@ -361,7 +361,7 @@ export class SessionService {
361361

362362
// Restore persisted config options to server in parallel
363363
if (persistedConfigOptions) {
364-
await Promise.allSettled(
364+
await Promise.all(
365365
persistedConfigOptions.map((opt) =>
366366
trpcVanilla.agent.setConfigOption
367367
.mutate({

apps/twig/src/renderer/sagas/task/task-creation.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { buildPromptBlocks } from "@features/editor/utils/prompt-builder";
2-
import { getSessionService } from "@features/sessions/service/service";
2+
import {
3+
type ConnectParams,
4+
getSessionService,
5+
} from "@features/sessions/service/service";
36
import { useWorkspaceStore } from "@features/workspace/stores/workspaceStore";
47
import { Saga, type SagaLogger } from "@posthog/shared";
58
import type { PostHogAPIClient } from "@renderer/api/posthogClient";
@@ -198,19 +201,19 @@ export class TaskCreationSaga extends Saga<
198201
// Fire-and-forget for both open and create paths.
199202
// The UI handles "connecting" state with a spinner (TaskLogsPanel),
200203
// so we don't need to block the saga on the full reconnect chain.
201-
getSessionService().connectToTask({
204+
const connectParams: ConnectParams = {
202205
task,
203206
repoPath: agentCwd ?? "",
204-
...(initialPrompt ? { initialPrompt } : {}),
205-
...(input.executionMode
206-
? { executionMode: input.executionMode }
207-
: {}),
208-
...(input.adapter ? { adapter: input.adapter } : {}),
209-
...(input.model ? { model: input.model } : {}),
210-
...(input.reasoningLevel
211-
? { reasoningLevel: input.reasoningLevel }
212-
: {}),
213-
});
207+
};
208+
if (initialPrompt) connectParams.initialPrompt = initialPrompt;
209+
if (input.executionMode)
210+
connectParams.executionMode = input.executionMode;
211+
if (input.adapter) connectParams.adapter = input.adapter;
212+
if (input.model) connectParams.model = input.model;
213+
if (input.reasoningLevel)
214+
connectParams.reasoningLevel = input.reasoningLevel;
215+
216+
getSessionService().connectToTask(connectParams);
214217
return { taskId: task.id };
215218
},
216219
rollback: async ({ taskId }) => {

packages/agent/src/adapters/claude/claude-agent.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,7 @@ export class ClaudeAcpAgent extends BaseAcpAgent {
195195
]);
196196

197197
session.modelId = modelOptions.currentModelId;
198-
199-
// Fire-and-forget — trySetModel already swallows errors
200-
this.trySetModel(q, modelOptions.currentModelId);
198+
await this.trySetModel(q, modelOptions.currentModelId);
201199

202200
this.sendAvailableCommandsUpdate(sessionId, slashCommands);
203201

packages/agent/src/adapters/claude/session/options.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { spawn } from "node:child_process";
22
import * as fs from "node:fs";
3+
import * as os from "node:os";
34
import * as path from "node:path";
45
import type {
56
McpServerConfig,
@@ -235,5 +236,16 @@ export function buildSessionOptions(params: BuildOptionsParams): Options {
235236
options.additionalDirectories = params.additionalDirectories;
236237
}
237238

239+
clearStatsigCache();
238240
return options;
239241
}
242+
243+
function clearStatsigCache(): void {
244+
const statsigPath = path.join(
245+
process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), ".claude"),
246+
"statsig",
247+
);
248+
fs.rm(statsigPath, { recursive: true, force: true }, () => {
249+
// Best-effort, ignore errors
250+
});
251+
}

0 commit comments

Comments
 (0)