Skip to content

Commit 8b963a4

Browse files
committed
Revalidate container at launch boundary
1 parent 4c1dc2e commit 8b963a4

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎agents/adapters/supervisor.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ export function startProfileInvocation(profile: ContainerProfile, options: Super
242242
};
243243
try {
244244
createValidatedContainer(profile, remaining(), options.secrets ?? {});
245-
validateContainer(profile.name, profile, remaining());
246245
} catch (error) {
247246
try { disposeValidatedContainer(profile); }
248247
catch (cleanupError) {
@@ -260,6 +259,15 @@ export function startProfileInvocation(profile: ContainerProfile, options: Super
260259
let decodeAbort: AbortController | undefined;
261260
let protocolToken: string | undefined, protocolStarted = false, protocolReady = false;
262261
let protocolBuffer = Buffer.alloc(0);
262+
try { validateContainer(profile.name, profile, remaining()); }
263+
catch (error) {
264+
try { disposeValidatedContainer(profile); }
265+
catch (cleanupError) {
266+
const detail = `Final container validation failed and cleanup remains unsettled: ${String(error)}; ${String(cleanupError)}`;
267+
return retainCleanupOwnership(profile, detail);
268+
}
269+
throw error;
270+
}
263271
const child = spawn('docker', ['start', '--attach', profile.name], {
264272
env: dockerEnvironment(), stdio: ['ignore', 'pipe', 'pipe'],
265273
});

0 commit comments

Comments
 (0)