ework-daemon 0.4.19 → 0.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/opencode.ts +11 -0
package/package.json
CHANGED
package/src/opencode.ts
CHANGED
|
@@ -321,6 +321,7 @@ export class Engine {
|
|
|
321
321
|
private groupConfigs = new Map<string, GroupConfig>();
|
|
322
322
|
private cloneUrls = new Map<string, string>();
|
|
323
323
|
private senders = new Map<string, string>();
|
|
324
|
+
private envInitialized = new Set<string>();
|
|
324
325
|
|
|
325
326
|
private static MAX_INLINE_SIZE = 4000;
|
|
326
327
|
private static MAX_NUDGE_ROUNDS = 1;
|
|
@@ -886,6 +887,10 @@ export class Engine {
|
|
|
886
887
|
const workdir = await this.resolveWorkdir(session, issue);
|
|
887
888
|
|
|
888
889
|
const gc = this.groupConfigFor(issue);
|
|
890
|
+
if (gc?.envInitScript && !this.envInitialized.has(workdir)) {
|
|
891
|
+
await runHookScript(gc.envInitScript, workdir, `envInitScript for ${k}`, this.hookEnvFor(issue, session, workdir));
|
|
892
|
+
this.envInitialized.add(workdir);
|
|
893
|
+
}
|
|
889
894
|
if (gc?.initScript) {
|
|
890
895
|
await runHookScript(gc.initScript, workdir, `initScript for ${k}`, this.hookEnvFor(issue, session, workdir));
|
|
891
896
|
}
|
|
@@ -955,6 +960,12 @@ export class Engine {
|
|
|
955
960
|
stdin: "ignore",
|
|
956
961
|
});
|
|
957
962
|
|
|
963
|
+
if (this.generation.get(k) !== gen) {
|
|
964
|
+
log.warn(`engine: spawned pid=${proc.pid} but generation superseded — killing orphan for ${k}`);
|
|
965
|
+
try { this.killProcessTree(proc.pid); } catch { /* already dead */ }
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
|
|
958
969
|
this.processes.set(k, proc);
|
|
959
970
|
this.lastOutputAt.set(k, Date.now());
|
|
960
971
|
if (!this.startedAt.has(k)) {
|