fix: replace pid:-1 sentinel with process.pid to prevent false process_lost
The adapter was calling onSpawn({ pid: -1 }) as a sentinel value for
K8s Jobs (which run out-of-process), then the server's orphan reaper
was checking isProcessAlive(-1) which always returns false, causing
legitimate runs to be reaped as 'process_lost'.
Using process.pid (the Paperclip server's own PID) is always alive
while the adapter runs in-process, preventing false reaping.
Fixes FAR-116.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Vendored
+14
-3
@@ -97,13 +97,22 @@ export async function getSelfPodInfo(kubeconfigPath) {
|
||||
// Collect env vars from the pod spec's container definition.
|
||||
// Agent config env (set in buildEnvVars) will override these.
|
||||
const inheritedEnv = {};
|
||||
const inheritedEnvValueFrom = [];
|
||||
for (const envItem of mainContainer.env ?? []) {
|
||||
if (!envItem.name)
|
||||
continue;
|
||||
const value = envItem.value ?? "";
|
||||
if (value)
|
||||
inheritedEnv[envItem.name] = value;
|
||||
if (envItem.valueFrom) {
|
||||
// Preserve valueFrom entries (secretKeyRef, configMapKeyRef, fieldRef, etc.)
|
||||
inheritedEnvValueFrom.push({ name: envItem.name, valueFrom: envItem.valueFrom });
|
||||
}
|
||||
else {
|
||||
const value = envItem.value ?? "";
|
||||
if (value)
|
||||
inheritedEnv[envItem.name] = value;
|
||||
}
|
||||
}
|
||||
// Capture envFrom sources (secretRef, configMapRef) from the container spec
|
||||
const inheritedEnvFrom = mainContainer.envFrom ?? [];
|
||||
cachedSelfPod = {
|
||||
namespace,
|
||||
image: mainContainer.image,
|
||||
@@ -114,6 +123,8 @@ export async function getSelfPodInfo(kubeconfigPath) {
|
||||
pvcClaimName,
|
||||
secretVolumes,
|
||||
inheritedEnv,
|
||||
inheritedEnvValueFrom,
|
||||
inheritedEnvFrom,
|
||||
};
|
||||
return cachedSelfPod;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user