Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: skip host outside-files scan for boxed sessions

ogsamrat8e4b531b2d0a
diff --git a/apps/server/src/context/PARITY.sha256 b/apps/server/src/context/PARITY.sha256
index 62b39974..a5446e18 100644
--- a/apps/server/src/context/PARITY.sha256
+++ b/apps/server/src/context/PARITY.sha256
@@ -5,12 +5,12 @@ b7d4fad94c133cb4303db934a5bb8e84dcb09dcc6720dc9cc7245d7c8205fa11 commands.ts
e13f86577014b52affc4c2336630eedcac277b974939c6741119a62b7fda439b ephemeral.ts
1bd9abb65af931b6f32d0334c97fbfedba7ab70c9a86351dfbc92ef208ec1f33 exec-witness.ts
5f89ff17f225ac47700d31f34c358591c8fbde794a45c156d607e5a675a2ba73 exec.ts
-dabba3712994e5daffe3ccc342e45a2b547bdc9bcb3e40a7592ed234b5556fac index.ts
+72a812ea7d0fbafe0f51738c480c998edfc7728af8bf3b42b4e654eee579d98e index.ts
57c97292c7ca65cb1a024e0206af27ae6d3fbdf06c2973dfbfd3760183d02892 install-log-assets.ts
4a76b51a64d76074af205e34f2b24df214b11f651988cf08cf47ef04c9f72de9 install-log.ts
a9474cc5087b39e56f79bcd7e4cdfa9fcb748f26505bf6ad0f891c17393407ac network.ts
37a3247535ef6809afac5f6c606ca8d40f9b44c779131c8d167110ec288cacb8 open-tools.ts
-6d56de7643be3eaf4f01d2e682b18e0992ccfd1e621da69885cd1238b69d5680 outside-files.ts
+1a87cb893b64bad0d260fd479050425946d40f20b09be1fdcd3b6a82c36f0b9f outside-files.ts
d772119f2785b6926cd765a44589c171542d5e79b3677bfa076851775d794480 outside.ts
8d0d2fb3856b67b5ccbddd76a95f0464069552bd5ab297895fcbffb090f2a00f pm-config.ts
c244d4cba6fbf2333a3da11d60ee184b6007f8017f6005f4d1b420a8b5c84b1c privacy.ts
diff --git a/apps/server/src/context/index.ts b/apps/server/src/context/index.ts
index ba7f9e23..27b3a212 100644
--- a/apps/server/src/context/index.ts
+++ b/apps/server/src/context/index.ts
@@ -590,6 +590,7 @@ export class ContextCapture {
commandFiles: effects.flatMap((effect) => effect.writes),
calls,
sharedWindow,
+ box: this.boxOf(state) !== null,
});
if (event) this.emit(state.id, "context.outside_files", event);
})());
diff --git a/apps/server/src/context/outside-files.ts b/apps/server/src/context/outside-files.ts
index ebcacb42..bc8e5c22 100644
--- a/apps/server/src/context/outside-files.ts
+++ b/apps/server/src/context/outside-files.ts
@@ -76,6 +76,10 @@ export type OutsideFilesEvent = {
content_bytes: number;
/** Another session's turn ran at the same time: a file may be its. */
shared_window: boolean;
+ /** Whether the host's temp, home and system folders were scanned; not for a session in the box. */
+ host_scan: boolean;
+ /** Why they were not: "box" (the session's commands write to the box's own filesystem, not the host's). */
+ host_scan_reason?: "box";
timings_ms: Record<string, number>;
};
@@ -222,6 +226,11 @@ export type OutsideFilesInput = {
commandFiles?: string[];
calls: readonly OutsideCallWindow[];
sharedWindow: boolean;
+ /**
+ * The session's shell runs in the box: only the project (bind-mounted, same path) is the host's, so no
+ * host scan and no command target outside the project (another process's files, not the session's).
+ */
+ box?: boolean;
/** Tests. */
tmpRoots?: string[];
budgetMs?: number;
@@ -235,7 +244,7 @@ export async function outsideFilesOfTurn(input: OutsideFilesInput): Promise<Outs
const commandFolders = [...new Set(input.commandFolders.map((dir) => path.resolve(dir)))]
.filter((dir) => dir !== rootReal && !dir.startsWith(rootReal + path.sep) && !isWithheldPath(dir))
.slice(0, 16);
- const outside = await scanOutside({
+ const outside = input.box ? { entries: [] as OutsideEntry[], truncated: false, scanned: 0 } : await scanOutside({
root: input.root,
since: input.since,
until: input.until,
@@ -257,7 +266,7 @@ export async function outsideFilesOfTurn(input: OutsideFilesInput): Promise<Outs
// The files the commands named as written: found even where a busy folder's scan ran out of budget.
const scanned = new Set(outside.entries.map((entry) => entry.absolute));
const excluded = input.exclude.map((dir) => path.resolve(dir));
- for (const file of [...new Set((input.commandFiles ?? []).map((item) => path.resolve(item)))].slice(0, MAX_FILES)) {
+ for (const file of [...new Set((input.box ? [] : input.commandFiles ?? []).map((item) => path.resolve(item)))].slice(0, MAX_FILES)) {
if (scanned.has(file) || file === rootReal || file.startsWith(rootReal + path.sep) || excluded.some((dir) => file === dir || file.startsWith(dir + path.sep))) continue;
const info = await lstat(file).catch(() => null);
if (!info || (!info.isFile() && !info.isSymbolicLink())) continue;
@@ -317,6 +326,8 @@ export async function outsideFilesOfTurn(input: OutsideFilesInput): Promise<Outs
scanned: outside.scanned + ignored.scanned,
content_bytes: contentBytes,
shared_window: input.sharedWindow,
+ host_scan: !input.box,
+ ...(input.box ? { host_scan_reason: "box" as const } : {}),
timings_ms: timings,
};
}