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
5 changes: 4 additions & 1 deletion docs/remote-bridge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,10 @@ execution.
- Remote bridge deployments use backend-specific BullMQ queues and serialize
the expected backend on every new job, preventing Lambda or HTTP consumers
from accepting attached-worker executions.
- Code API permits one active assignment per worker.
- Code API negotiates a bounded number of active workspace assignments per
worker. The lower API or worker slot ceiling wins, and assignments sharing
the same workspace isolation key remain serialized while independent
conversation worktrees may run concurrently.
- Dynamic workers are fenced to their server-issued tenant before assignment.
- Each assignment has an absolute deadline, generation, and random lease token.
- Settlements with the wrong worker, generation, token, or expired deadline are
Expand Down
30 changes: 18 additions & 12 deletions packages/code/src/native-scratch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,25 @@ export async function restoreScratchTraversal(
if (directoryFd === undefined) continue;
try {
const directory = await opendir(descriptorPath(directoryFd));
for await (const entry of directory) {
entriesInspected += 1;
if (entriesInspected > MAX_SCRATCH_ENTRIES) {
throw new Error('Native sandbox scratch cleanup exceeded its entry limit');
try {
while (true) {
const entry = await directory.read();
if (entry === null) break;
entriesInspected += 1;
if (entriesInspected > MAX_SCRATCH_ENTRIES) {
throw new Error('Native sandbox scratch cleanup exceeded its entry limit');
}
if (!entry.isDirectory()) continue;
if (components.length >= MAX_SCRATCH_DEPTH) {
throw new Error('Native sandbox scratch cleanup exceeded its depth limit');
}
if (pending.length >= MAX_SCRATCH_DIRECTORIES) {
throw new Error('Native sandbox scratch cleanup exceeded its directory limit');
}
pending.push([...components, entry.name]);
}
if (!entry.isDirectory()) continue;
if (components.length >= MAX_SCRATCH_DEPTH) {
throw new Error('Native sandbox scratch cleanup exceeded its depth limit');
}
if (pending.length >= MAX_SCRATCH_DIRECTORIES) {
throw new Error('Native sandbox scratch cleanup exceeded its directory limit');
}
pending.push([...components, entry.name]);
} finally {
await directory.close();
}
} finally {
if (directoryFd !== root.fd) closeDirectory(directoryFd);
Expand Down
Loading