Skip to content

Commit f97e939

Browse files
committed
fix(smoke): keep startup timeouts in isolated controller
1 parent 4ce65d6 commit f97e939

11 files changed

Lines changed: 664 additions & 387 deletions

File tree

‎packages/ipc/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"type": "module",
66
"exports": "./src/index.ts",
77
"scripts": {
8+
"test": "node --import tsx --test src/__tests__/*.test.ts",
89
"lint": "eslint src --ext=ts --max-warnings=0",
910
"check-types": "tsc --noEmit",
1011
"clean": "rimraf .turbo"
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import assert from "node:assert/strict"
2+
import { describe, it } from "node:test"
3+
import { IpcMessageType, IpcOrigin, TaskCommandName, ipcMessageSchema } from "@roo-code/types"
4+
import { IpcServer } from "../ipc-server.js"
5+
6+
function fixture() {
7+
const logs: unknown[][] = []
8+
const commands: unknown[] = []
9+
const server = new IpcServer("/unused-test.sock", (...args) => logs.push(args))
10+
server.on(IpcMessageType.TaskCommand, (clientId, command) => commands.push({ clientId, command }))
11+
return { logs, commands, receive: (data: unknown) => server["onMessage"](data) }
12+
}
13+
const key = "dummy-api-key-not-for-public-logging"
14+
const command = (requestId: string) => ({
15+
type: IpcMessageType.TaskCommand,
16+
origin: IpcOrigin.Client,
17+
clientId: "client-1",
18+
data: {
19+
commandName: TaskCommandName.StartNewTask,
20+
data: { requestId, text: "private prompt", configuration: { apiProvider: "openai", openAiApiKey: key } },
21+
},
22+
})
23+
24+
describe("IPC rejection logging", () => {
25+
it("rejects an invalid request ID without logging its key, prompt or schema issue values", () => {
26+
const f = fixture()
27+
f.receive(command(`invalid request containing ${key}`))
28+
assert.deepEqual(f.commands, [])
29+
assert.equal(f.logs.length, 1)
30+
assert.equal(f.logs[0]?.[0], "[server#onMessage] invalid payload")
31+
assert.ok(!JSON.stringify(f.logs).includes(key))
32+
assert.ok(!JSON.stringify(f.logs).includes("private prompt"))
33+
assert.ok(!JSON.stringify(f.logs).includes("invalid request containing"))
34+
})
35+
it("does not log credential-shaped primitive input or dynamic issue paths", () => {
36+
const f = fixture()
37+
const valid = command("valid-id")
38+
const malformedHeaders = {
39+
...valid,
40+
data: {
41+
...valid.data,
42+
data: {
43+
...valid.data.data,
44+
configuration: { ...valid.data.data.configuration, openAiHeaders: { [key]: null } },
45+
},
46+
},
47+
}
48+
const rejected = ipcMessageSchema.safeParse(malformedHeaders)
49+
assert.ok(!rejected.success)
50+
assert.ok(rejected.error.issues.some((issue) => issue.path.includes(key)))
51+
for (const data of [key, null, { type: key }, malformedHeaders]) {
52+
f.receive(data)
53+
}
54+
assert.equal(f.logs.length, 4)
55+
assert.ok(!JSON.stringify(f.logs).includes(key))
56+
assert.deepEqual(f.commands, [])
57+
})
58+
it("still dispatches a valid correlated command to its client without logging its settings", () => {
59+
const f = fixture()
60+
f.receive(command("valid-id"))
61+
assert.equal(f.commands.length, 1)
62+
assert.deepEqual(f.commands[0], { clientId: "client-1", command: command("valid-id").data })
63+
assert.deepEqual(f.logs, [])
64+
})
65+
})

‎packages/ipc/src/ipc-server.ts‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,15 @@ export class IpcServer extends EventEmitter<IpcServerEvents> implements RooCodeI
7676

7777
private onMessage(data: unknown) {
7878
if (typeof data !== "object") {
79-
this.log(`[server#onMessage] invalid data -> ${JSON.stringify(data)}`)
79+
this.log("[server#onMessage] invalid data")
8080
return
8181
}
8282

8383
const result = ipcMessageSchema.safeParse(data)
8484

8585
if (!result.success) {
86-
this.log(
87-
`[server#onMessage] invalid payload -> ${JSON.stringify(result.error.issues)} -> ${JSON.stringify(data)}`,
88-
)
86+
// Both the input and Zod issue values/paths may contain credentials.
87+
this.log("[server#onMessage] invalid payload", { issueCount: result.error.issues.length })
8988

9089
return
9190
}
@@ -98,7 +97,7 @@ export class IpcServer extends EventEmitter<IpcServerEvents> implements RooCodeI
9897
this.emit(IpcMessageType.TaskCommand, payload.clientId, payload.data)
9998
break
10099
default:
101-
this.log(`[server#onMessage] unhandled payload: ${JSON.stringify(payload)}`)
100+
this.log("[server#onMessage] unhandled payload")
102101
break
103102
}
104103
}

‎scripts/solheim-smoke-workflow.test.mjs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ describe("Project A provider smoke workflow", () => {
5656
it("bounds runtime and serializes the single provider instance", () => {
5757
assert.match(workflow, /cancel-in-progress: false/)
5858
assert.match(workflow, /timeout-minutes: 8/)
59+
assert.match(workflow, /^ {8}timeout-minutes: 25$/m)
5960
})
6061
it("uploads only the verdict and video, never host logs or storage", () => {
6162
const paths = workflow.split("path: |\n")[1]?.split(" if-no-files-found:")[0]

‎scripts/solheim-smoke/README.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@ The provider endpoint and model are fixed: `https://api.solheim.ai/v1`, `qwen3.8
1818
groups; delegation, follow-ups, writes, shell and MCP are disabled. The driver opens an empty temporary
1919
workspace with isolated VS Code storage and an allowlisted host environment. The provider credential is
2020
supplied over IPC, not inherited by the child or passed on its command line. Temporary extension storage
21-
can contain the configured credential while the session runs; it is removed at teardown and never uploaded.
21+
can contain the configured credential while the session runs. It is removed when no child remains alive;
22+
if termination fails, storage cleanup is skipped and `gates.childExited` reports that separately from the
23+
original smoke failure. Storage is never uploaded.
2224
This is process/environment isolation, not a sandbox for malicious extension code—CI runs trusted main only.
2325

2426
Activation and completion each have a 120-second limit; task-start acknowledgment has a 35-second limit,
25-
with 30-second per-stage bounds in the extension. The live CI step has an eight-minute outer timeout.
27+
in the controller. The extension awaits startup and configuration persistence without racing shared-profile
28+
writes against a timer. If the controller times out, it tears down its isolated VS Code process rather than
29+
trying to roll back shared settings or remove a possibly unrelated task. The live CI step has an eight-minute outer timeout.
2630
Teardown escalates through close, terminate, and kill within independent five-second windows. A non-empty
2731
completion and actual output-token usage must belong to the accepted task. Activation alone cannot pass.
2832
The driver never approves dialogs or tool execution; it closes the task during teardown.

‎scripts/solheim-smoke/config.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export function buildChildEnvironment(
6464
XDG_CONFIG_HOME: path.join(isolatedHome, ".config"),
6565
XDG_CACHE_HOME: path.join(isolatedHome, ".cache"),
6666
ROO_CODE_IPC_SOCKET_PATH: socketPath,
67-
ROO_CODE_TASK_START_STAGE_TIMEOUT_MS: "30000",
6867
}
6968
}
7069

0 commit comments

Comments
 (0)