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
3 changes: 3 additions & 0 deletions src/main/remote/RemoteAccessServer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2787,6 +2787,7 @@ describe("RemoteAccessServer", () => {
config: { model: "gpt-5" },
prompt: "",
presentationMode: "terminal",
userMessageItemId: "user-optimistic",
}),
});

Expand All @@ -2809,6 +2810,7 @@ describe("RemoteAccessServer", () => {
prompt: "",
initialSize: { cols: 120, rows: 30 },
presentationMode: "terminal",
userMessageItemId: "user-optimistic",
...mcpSnapshot,
}),
);
Expand All @@ -2818,6 +2820,7 @@ describe("RemoteAccessServer", () => {
threadId: "thread-remote",
projectId: "project-1",
launchRuntime: false,
userMessageItemId: "user-optimistic",
}),
]);
});
Expand Down
1 change: 1 addition & 0 deletions src/main/remote/server/threadCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ async function startRemoteThread(
...(command.segments ? { segments: command.segments } : {}),
initialSize: DEFAULT_TERMINAL_SIZE,
...(command.presentationMode ? { presentationMode: command.presentationMode } : {}),
...(command.userMessageItemId ? { userMessageItemId: command.userMessageItemId } : {}),
...mcpSnapshot,
});
} catch (error) {
Expand Down
5 changes: 3 additions & 2 deletions src/main/ssh/SshConnectionManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "nod
import { tmpdir } from "node:os";
import { basename, join } from "node:path";
import { afterEach, describe, expect, it, vi } from "vitest";
import { PORACODE_REMOTE_PROTOCOL_VERSION } from "@/shared/remote";
import { sshConnectionConfigSchema, type SshConnectionConfig } from "@/shared/ssh";
import * as sshBootstrap from "@/shared/sshBootstrap";
import { waitForRemoteEndpoint } from "@/shared/sshBootstrap";
Expand Down Expand Up @@ -88,7 +89,7 @@ function createRuntimeFixture(): {

function helperDescriptor(appVersion: string) {
return {
protocolVersion: 1,
protocolVersion: PORACODE_REMOTE_PROTOCOL_VERSION,
hostMode: "helper",
desktopId: "remote-test",
label: "Remote test",
Expand Down Expand Up @@ -367,7 +368,7 @@ describe("SSH tunnel lifecycle", () => {
describe("SSH helper readiness", () => {
function descriptor(hostMode: "desktop" | "helper") {
return {
protocolVersion: 1,
protocolVersion: PORACODE_REMOTE_PROTOCOL_VERSION,
hostMode,
desktopId: "remote-test",
label: "Remote test",
Expand Down
3 changes: 2 additions & 1 deletion src/mobile/mobileSsh.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @vitest-environment jsdom
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { SshBridgePlugin } from "@poracode/ssh-bridge";
import { PORACODE_REMOTE_PROTOCOL_VERSION } from "@/shared/remote";
import type { SshConnectionConfig } from "@/shared/ssh";

const bridge = vi.hoisted(() => ({
Expand Down Expand Up @@ -44,7 +45,7 @@ function response(input: { json?: unknown; bytes?: Uint8Array; ok?: boolean; sta
function helperEnvironmentResponse() {
return response({
json: {
protocolVersion: 1,
protocolVersion: PORACODE_REMOTE_PROTOCOL_VERSION,
hostMode: "helper",
desktopId: "remote-test",
label: "Remote test",
Expand Down
18 changes: 18 additions & 0 deletions src/renderer/actions/threadActions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ describe("threadActions", () => {
pendingActiveThreadId: null,
pendingComposerFocusThreadId: null,
pendingThreadLaunches: {},
provisioningWorktreeThreadIds: {},
runtimeItemIdsByThread: {},
runtimeItemsByIdByThread: {},
runtimeCompletedTurnsByThread: {},
Expand Down Expand Up @@ -607,6 +608,23 @@ describe("threadActions", () => {
expect(useAppStore.getState().threads).toEqual([thread]);
});

it("deletes a provisional remote thread locally before the host row exists", () => {
const thread = makeThread({
remoteServerId: "remote-server",
remoteId: "remote-thread-pending",
});
useAppStore.setState({
threads: [thread],
provisioningWorktreeThreadIds: { [thread.id]: true },
});

deleteThread(thread.id);

expect(useAppStore.getState().threads).toEqual([]);
expect(sendThreadCommand).not.toHaveBeenCalled();
expect(bridge.closeThread).not.toHaveBeenCalled();
});

it("deletes a shared-worktree thread without prompting to remove the worktree", () => {
const worktreePath = "/repo/.worktrees/feature";
const firstThread = makeThread({
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/actions/threadActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,10 @@ export function acknowledgeThread(threadId: string): void {
function deleteThreadOnly(threadId: string): void {
const store = useAppStore.getState();
const thread = store.threads.find((candidate) => candidate.id === threadId);
if (store.provisioningWorktreeThreadIds[threadId] === true) {
store.deleteThread(threadId);
return;
}
if (
thread &&
dispatchRemoteThreadMutation(
Expand Down
Loading