@xdevops/issue-auto-finish 1.0.79 → 1.0.81

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.
@@ -110,4 +110,4 @@ async function startDaemon(configPath) {
110
110
  export {
111
111
  startCommand
112
112
  };
113
- //# sourceMappingURL=chunk-PRGM6ELE.js.map
113
+ //# sourceMappingURL=chunk-7UBPPE3O.js.map
@@ -33,7 +33,7 @@ import {
33
33
  setE2eOverride,
34
34
  setNoteSyncOverride,
35
35
  validatePhaseRegistry
36
- } from "./chunk-UWLXEZSL.js";
36
+ } from "./chunk-S3ULUOTM.js";
37
37
  import {
38
38
  AsyncMutex,
39
39
  BaseTracker,
@@ -8904,4 +8904,4 @@ function migrateKnowledgeDir(srcDir, destDir) {
8904
8904
  export {
8905
8905
  main
8906
8906
  };
8907
- //# sourceMappingURL=chunk-IPPYFU3R.js.map
8907
+ //# sourceMappingURL=chunk-JFTXTWGO.js.map
@@ -3171,45 +3171,8 @@ var PortAllocator = class {
3171
3171
  import { spawn } from "child_process";
3172
3172
  import fs10 from "fs";
3173
3173
  import path11 from "path";
3174
- import https from "https";
3175
- import http from "http";
3176
3174
  var logger12 = logger.child("DevServerManager");
3177
- var DEFAULT_OPTIONS2 = {
3178
- healthCheckTimeoutMs: 12e4,
3179
- healthCheckIntervalMs: 3e3
3180
- };
3181
- function waitForPort(port, useTls, timeoutMs, intervalMs) {
3182
- return new Promise((resolve, reject) => {
3183
- const deadline = Date.now() + timeoutMs;
3184
- const check = () => {
3185
- if (Date.now() > deadline) {
3186
- reject(new Error(`Port ${port} not ready after ${timeoutMs}ms`));
3187
- return;
3188
- }
3189
- const req = useTls ? https.get(
3190
- { hostname: "127.0.0.1", port, path: "/", rejectUnauthorized: false, timeout: 5e3 },
3191
- (res) => {
3192
- res.resume();
3193
- resolve();
3194
- }
3195
- ) : http.get(
3196
- { hostname: "127.0.0.1", port, path: "/", timeout: 5e3 },
3197
- (res) => {
3198
- res.resume();
3199
- resolve();
3200
- }
3201
- );
3202
- req.on("error", () => {
3203
- setTimeout(check, intervalMs);
3204
- });
3205
- req.on("timeout", () => {
3206
- req.destroy();
3207
- setTimeout(check, intervalMs);
3208
- });
3209
- };
3210
- check();
3211
- });
3212
- }
3175
+ var DEFAULT_OPTIONS2 = {};
3213
3176
  var DevServerManager = class {
3214
3177
  servers = /* @__PURE__ */ new Map();
3215
3178
  options;
@@ -3248,8 +3211,9 @@ var DevServerManager = class {
3248
3211
  cwd: wtCtx.workDir,
3249
3212
  env: backendEnv,
3250
3213
  stdio: ["ignore", "pipe", "pipe"],
3251
- detached: false
3214
+ detached: true
3252
3215
  });
3216
+ backend.unref();
3253
3217
  backend.stdout?.on("data", (data) => {
3254
3218
  backendLog.write(tsLine("stdout", data));
3255
3219
  });
@@ -3271,8 +3235,9 @@ var DevServerManager = class {
3271
3235
  cwd: frontendDir,
3272
3236
  env: frontendEnv,
3273
3237
  stdio: ["ignore", "pipe", "pipe"],
3274
- detached: false
3238
+ detached: true
3275
3239
  });
3240
+ frontend.unref();
3276
3241
  frontend.stdout?.on("data", (data) => {
3277
3242
  frontendLog.write(tsLine("stdout", data));
3278
3243
  });
@@ -3292,31 +3257,9 @@ var DevServerManager = class {
3292
3257
  frontendLog
3293
3258
  };
3294
3259
  this.servers.set(wtCtx.issueIid, serverSet);
3295
- logger12.info("Waiting for servers to become healthy", { issueIid: wtCtx.issueIid });
3296
- try {
3297
- await Promise.all([
3298
- waitForPort(
3299
- ports.backendPort,
3300
- false,
3301
- this.options.healthCheckTimeoutMs,
3302
- this.options.healthCheckIntervalMs
3303
- ),
3304
- waitForPort(
3305
- ports.frontendPort,
3306
- true,
3307
- this.options.healthCheckTimeoutMs,
3308
- this.options.healthCheckIntervalMs
3309
- )
3310
- ]);
3311
- logger12.info("Dev servers healthy", { issueIid: wtCtx.issueIid, ...ports });
3312
- } catch (err) {
3313
- logger12.error("Dev servers failed health check, cleaning up", {
3314
- issueIid: wtCtx.issueIid,
3315
- error: err.message
3316
- });
3317
- this.stopServers(wtCtx.issueIid);
3318
- throw err;
3319
- }
3260
+ logger12.info("Dev servers spawned, waiting for startup", { issueIid: wtCtx.issueIid, ...ports });
3261
+ await new Promise((r) => setTimeout(r, 1e4));
3262
+ logger12.info("Dev servers startup grace period done", { issueIid: wtCtx.issueIid });
3320
3263
  }
3321
3264
  stopServers(issueIid) {
3322
3265
  const set = this.servers.get(issueIid);
@@ -3349,11 +3292,21 @@ var DevServerManager = class {
3349
3292
  function killProcess(proc, label) {
3350
3293
  try {
3351
3294
  if (proc.killed || proc.exitCode !== null) return;
3352
- proc.kill("SIGTERM");
3295
+ const pid = proc.pid;
3296
+ if (!pid) return;
3297
+ try {
3298
+ process.kill(-pid, "SIGTERM");
3299
+ } catch {
3300
+ proc.kill("SIGTERM");
3301
+ }
3353
3302
  setTimeout(() => {
3354
3303
  if (!proc.killed && proc.exitCode === null) {
3355
3304
  logger12.warn(`Force killing ${label}`);
3356
- proc.kill("SIGKILL");
3305
+ try {
3306
+ process.kill(-pid, "SIGKILL");
3307
+ } catch {
3308
+ proc.kill("SIGKILL");
3309
+ }
3357
3310
  }
3358
3311
  }, 5e3);
3359
3312
  } catch (err) {
@@ -4727,6 +4680,7 @@ E2E \u6D4B\u8BD5\u5C06\u5C1D\u8BD5\u4F7F\u7528 config.json \u4E2D\u7684\u9ED8\u8
4727
4680
  if (!fsSync.existsSync(wtCtx.workDir)) {
4728
4681
  throw new InvalidStateError(record.state, "Worktree no longer exists");
4729
4682
  }
4683
+ this.stopPreviewServers(issueIid);
4730
4684
  const ports = await this.portAllocator.allocate(issueIid);
4731
4685
  wtCtx.ports = ports;
4732
4686
  try {
@@ -5141,4 +5095,4 @@ export {
5141
5095
  PipelineOrchestrator,
5142
5096
  BrainstormService
5143
5097
  };
5144
- //# sourceMappingURL=chunk-UWLXEZSL.js.map
5098
+ //# sourceMappingURL=chunk-S3ULUOTM.js.map