@indigoai-us/hq-cli 5.345.231 → 5.345.232
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/CHANGELOG.md +31 -0
- package/README.md +3 -2
- package/assets/lanes-reconcile/hq-lanes-reconcile.service +1 -1
- package/assets/scaffold/core/scripts/pipeline-conductor.sh +14 -14
- package/assets/scaffold/core/scripts/pipeline-driver.sh +7 -7
- package/assets/scaffold/core/scripts/session-project.sh +19 -4
- package/dist/command-catalog.generated.d.ts +213 -177
- package/dist/command-catalog.generated.js +263 -212
- package/dist/command-registration-plan.d.ts +6 -24
- package/dist/command-registration-plan.js +4 -8
- package/dist/commands/auth.js +3 -2
- package/dist/commands/core-pipeline-conductor-command.js +1 -1
- package/dist/commands/core-pipeline-conductor-native.js +5 -5
- package/dist/commands/core-pipeline-driver-native.js +5 -5
- package/dist/commands/daemon.js +7 -36
- package/dist/commands/deploy-access.js +6 -13
- package/dist/commands/deploy-comments.js +5 -13
- package/dist/commands/deploy-domains.js +6 -13
- package/dist/commands/deploy-list.js +25 -11
- package/dist/commands/deploy-mutations.d.ts +3 -0
- package/dist/commands/deploy-mutations.js +147 -0
- package/dist/commands/link.js +29 -0
- package/dist/commands/mesh.js +3 -1
- package/dist/commands/report.js +8 -9
- package/dist/data/command-states.json +10 -7
- package/dist/lib/bot/fleet-bots-update-pass.d.ts +8 -0
- package/dist/lib/bot/fleet-bots-update-pass.js +40 -0
- package/dist/lib/bot/fleet-bots-update-task.d.ts +12 -0
- package/dist/lib/bot/fleet-bots-update-task.js +52 -0
- package/dist/lib/bot/fleet-bots-update-worker-v1.d.ts +2 -0
- package/dist/lib/bot/fleet-bots-update-worker-v1.js +5 -0
- package/dist/lib/daemon/catalog.d.ts +8 -5
- package/dist/lib/daemon/catalog.js +15 -8
- package/dist/lib/daemon/lock.js +33 -37
- package/dist/lib/daemon/ops/skill-command.d.ts +99 -0
- package/dist/lib/daemon/ops/skill-command.js +260 -0
- package/dist/lib/daemon/protocol.d.ts +1 -1
- package/dist/lib/daemon/protocol.js +1 -0
- package/dist/lib/daemon/run.js +10 -18
- package/dist/lib/daemon/server.js +7 -0
- package/dist/lib/daemon/supervisor.d.ts +5 -0
- package/dist/lib/daemon/supervisor.js +17 -2
- package/dist/lib/db/app-ref.js +10 -15
- package/dist/lib/deploy-apps.d.ts +29 -0
- package/dist/lib/deploy-apps.js +37 -0
- package/dist/lib/doctor/checks/search-index.d.ts +16 -0
- package/dist/lib/doctor/checks/search-index.js +61 -0
- package/dist/lib/doctor/checks/stranded-lanes.js +1 -1
- package/dist/lib/doctor/registry.js +4 -0
- package/dist/lib/lanes/accounts.js +3 -3
- package/dist/lib/lanes/admission-host.js +1 -1
- package/dist/lib/lanes/admission.js +4 -4
- package/dist/lib/lanes/autopilot.js +2 -2
- package/dist/lib/lanes/blocker-freshness.js +1 -1
- package/dist/lib/lanes/compaction.js +5 -5
- package/dist/lib/lanes/delivery.js +1 -1
- package/dist/lib/lanes/depth-cap.js +1 -1
- package/dist/lib/lanes/disk-guard.js +1 -1
- package/dist/lib/lanes/dropbox.js +1 -1
- package/dist/lib/lanes/hooks-install.js +1 -1
- package/dist/lib/lanes/imported-question.js +1 -1
- package/dist/lib/lanes/keep-alive.d.ts +2 -2
- package/dist/lib/lanes/keep-alive.js +3 -3
- package/dist/lib/lanes/kr-freshness.js +1 -1
- package/dist/lib/lanes/links.js +4 -4
- package/dist/lib/lanes/loop.js +2 -2
- package/dist/lib/lanes/machine-identity.js +3 -3
- package/dist/lib/lanes/models.js +6 -6
- package/dist/lib/lanes/quota.js +1 -1
- package/dist/lib/lanes/reconcile-install.js +3 -3
- package/dist/lib/lanes/reconcile.js +16 -16
- package/dist/lib/lanes/remote-control-lane.js +6 -6
- package/dist/lib/lanes/reviews.js +2 -2
- package/dist/lib/lanes/spawn.js +24 -24
- package/dist/lib/lanes/status-fields.js +4 -4
- package/dist/lib/lanes/wait.js +4 -4
- package/dist/lib/lanes/watch.js +2 -2
- package/dist/lib/lanes/watcher-main.js +1 -1
- package/dist/lib/lanes/watcher.js +38 -38
- package/dist/lib/lanes/worker-process.js +5 -5
- package/dist/lib/mesh/live/daemon/pid-lock.d.ts +2 -4
- package/dist/lib/mesh/live/daemon/pid-lock.js +38 -55
- package/dist/utils/exclusive-lock.d.ts +60 -0
- package/dist/utils/exclusive-lock.js +65 -0
- package/package.json +8 -7
- package/dist/commands/staff/listings.d.ts +0 -41
- package/dist/commands/staff/listings.js +0 -160
- package/dist/commands/staff/reset-test-account.d.ts +0 -121
- package/dist/commands/staff/reset-test-account.js +0 -285
- package/dist/commands/staff/test-account.d.ts +0 -51
- package/dist/commands/staff/test-account.js +0 -196
package/dist/lib/lanes/spawn.js
CHANGED
|
@@ -1043,7 +1043,7 @@ export function readProcStarttimeDetailed(pid) {
|
|
|
1043
1043
|
}
|
|
1044
1044
|
if (code === "ENOENT")
|
|
1045
1045
|
return { starttime: null, error: "ENOENT" };
|
|
1046
|
-
process.stderr.write(`hq
|
|
1046
|
+
process.stderr.write(`hq runners: failed to read starttime for pid ${pid}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1047
1047
|
return {
|
|
1048
1048
|
starttime: null,
|
|
1049
1049
|
error: typeof code === "string" ? code : "unreadable",
|
|
@@ -1083,7 +1083,7 @@ export function readPidRecord(filePath) {
|
|
|
1083
1083
|
const code = err.code;
|
|
1084
1084
|
if (code === "ENOENT")
|
|
1085
1085
|
return null;
|
|
1086
|
-
process.stderr.write(`hq
|
|
1086
|
+
process.stderr.write(`hq runners: failed to read pid file ${filePath}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1087
1087
|
throw err;
|
|
1088
1088
|
}
|
|
1089
1089
|
}
|
|
@@ -1189,7 +1189,7 @@ export function signalProcessGroup(pid, signal, killProcess) {
|
|
|
1189
1189
|
if (code === "ESRCH")
|
|
1190
1190
|
return;
|
|
1191
1191
|
if (code !== "EINVAL" && code !== "EPERM") {
|
|
1192
|
-
process.stderr.write(`hq
|
|
1192
|
+
process.stderr.write(`hq runners: process-group ${signal} for pid ${pid} failed: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1193
1193
|
}
|
|
1194
1194
|
}
|
|
1195
1195
|
try {
|
|
@@ -1199,7 +1199,7 @@ export function signalProcessGroup(pid, signal, killProcess) {
|
|
|
1199
1199
|
const code = err.code;
|
|
1200
1200
|
if (code === "ESRCH")
|
|
1201
1201
|
return;
|
|
1202
|
-
process.stderr.write(`hq
|
|
1202
|
+
process.stderr.write(`hq runners: ${signal} for pid ${pid} failed: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1203
1203
|
throw err;
|
|
1204
1204
|
}
|
|
1205
1205
|
}
|
|
@@ -1264,7 +1264,7 @@ export function defaultProveDetached(pid, deps = {}) {
|
|
|
1264
1264
|
catch (err) {
|
|
1265
1265
|
const code = err.code;
|
|
1266
1266
|
if (code !== "ENOENT") {
|
|
1267
|
-
process.stderr.write(`hq
|
|
1267
|
+
process.stderr.write(`hq runners: failed to read ${proc}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1268
1268
|
throw err;
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
@@ -1277,7 +1277,7 @@ export function defaultProveDetached(pid, deps = {}) {
|
|
|
1277
1277
|
return { detached: false, pid, method: "pid_alive", reason: "pid_not_alive" };
|
|
1278
1278
|
}
|
|
1279
1279
|
if (code !== "EPERM") {
|
|
1280
|
-
process.stderr.write(`hq
|
|
1280
|
+
process.stderr.write(`hq runners: liveness probe for pid ${pid} failed: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1281
1281
|
throw err;
|
|
1282
1282
|
}
|
|
1283
1283
|
}
|
|
@@ -1314,7 +1314,7 @@ function proveDetachedViaPs(pid) {
|
|
|
1314
1314
|
};
|
|
1315
1315
|
}
|
|
1316
1316
|
catch (err) {
|
|
1317
|
-
process.stderr.write(`hq
|
|
1317
|
+
process.stderr.write(`hq runners: ps detach proof failed for pid ${pid}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1318
1318
|
return null;
|
|
1319
1319
|
}
|
|
1320
1320
|
}
|
|
@@ -1446,7 +1446,7 @@ export function readAnsweredQuestionLines(answersPath) {
|
|
|
1446
1446
|
const code = err.code;
|
|
1447
1447
|
if (code === "ENOENT")
|
|
1448
1448
|
return [];
|
|
1449
|
-
process.stderr.write(`hq
|
|
1449
|
+
process.stderr.write(`hq runners: failed to read ${answersPath}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1450
1450
|
throw err;
|
|
1451
1451
|
}
|
|
1452
1452
|
let parsed;
|
|
@@ -1561,7 +1561,7 @@ function recoverRawJsonArrayField(rawText, field) {
|
|
|
1561
1561
|
return Array.isArray(parsed) ? parsed : undefined;
|
|
1562
1562
|
}
|
|
1563
1563
|
catch {
|
|
1564
|
-
process.stderr.write("hq
|
|
1564
|
+
process.stderr.write("hq runners: envelope repair could not recover the supplied JSON array\n");
|
|
1565
1565
|
return undefined;
|
|
1566
1566
|
}
|
|
1567
1567
|
}
|
|
@@ -1628,7 +1628,7 @@ export function envelopeRepairPrompt(input) {
|
|
|
1628
1628
|
originalObject = parsed;
|
|
1629
1629
|
}
|
|
1630
1630
|
catch {
|
|
1631
|
-
process.stderr.write("hq
|
|
1631
|
+
process.stderr.write("hq runners: envelope repair is recovering values from invalid JSON\n");
|
|
1632
1632
|
}
|
|
1633
1633
|
const rawStringField = (field) => {
|
|
1634
1634
|
const token = input.rawText.match(new RegExp(`"${field}"\\s*:\\s*("(?:\\\\.|[^"\\\\])*")`))?.[1];
|
|
@@ -1638,7 +1638,7 @@ export function envelopeRepairPrompt(input) {
|
|
|
1638
1638
|
return JSON.parse(token);
|
|
1639
1639
|
}
|
|
1640
1640
|
catch {
|
|
1641
|
-
process.stderr.write(`hq
|
|
1641
|
+
process.stderr.write(`hq runners: envelope repair could not recover the supplied ${field} string\n`);
|
|
1642
1642
|
return undefined;
|
|
1643
1643
|
}
|
|
1644
1644
|
};
|
|
@@ -1925,7 +1925,7 @@ function installedWorkerPolicyHookSupportsDirectory(hqRoot) {
|
|
|
1925
1925
|
const code = err.code;
|
|
1926
1926
|
if (code === "ENOENT")
|
|
1927
1927
|
return false;
|
|
1928
|
-
process.stderr.write(`hq
|
|
1928
|
+
process.stderr.write(`hq runners: cannot inspect worker-policy hook capability at ${hookPath}: ${err instanceof Error ? err.message : String(err)}; keeping policy prompt delivery\n`);
|
|
1929
1929
|
return false;
|
|
1930
1930
|
}
|
|
1931
1931
|
}
|
|
@@ -1946,7 +1946,7 @@ function fileSizeOrZero(filePath) {
|
|
|
1946
1946
|
const code = err.code;
|
|
1947
1947
|
if (code === "ENOENT")
|
|
1948
1948
|
return 0;
|
|
1949
|
-
process.stderr.write(`hq
|
|
1949
|
+
process.stderr.write(`hq runners: failed to stat ${filePath}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1950
1950
|
throw err;
|
|
1951
1951
|
}
|
|
1952
1952
|
}
|
|
@@ -1972,7 +1972,7 @@ function closeFd(fd, label) {
|
|
|
1972
1972
|
fs.closeSync(fd);
|
|
1973
1973
|
}
|
|
1974
1974
|
catch (err) {
|
|
1975
|
-
process.stderr.write(`hq
|
|
1975
|
+
process.stderr.write(`hq runners: failed to close ${label} fd ${fd}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1976
1976
|
throw err;
|
|
1977
1977
|
}
|
|
1978
1978
|
}
|
|
@@ -1984,7 +1984,7 @@ function killQuietly(kill, pid, label) {
|
|
|
1984
1984
|
const code = err.code;
|
|
1985
1985
|
if (code === "ESRCH")
|
|
1986
1986
|
return;
|
|
1987
|
-
process.stderr.write(`hq
|
|
1987
|
+
process.stderr.write(`hq runners: failed to stop ${label} pid ${pid}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1988
1988
|
throw err;
|
|
1989
1989
|
}
|
|
1990
1990
|
}
|
|
@@ -2262,7 +2262,7 @@ export function readSpawnManifest(runDir) {
|
|
|
2262
2262
|
const code = err.code;
|
|
2263
2263
|
if (code === "ENOENT")
|
|
2264
2264
|
return {};
|
|
2265
|
-
process.stderr.write(`hq
|
|
2265
|
+
process.stderr.write(`hq runners: failed to read ${filePath}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
2266
2266
|
throw err;
|
|
2267
2267
|
}
|
|
2268
2268
|
let parsed;
|
|
@@ -2270,7 +2270,7 @@ export function readSpawnManifest(runDir) {
|
|
|
2270
2270
|
parsed = JSON.parse(text);
|
|
2271
2271
|
}
|
|
2272
2272
|
catch (err) {
|
|
2273
|
-
process.stderr.write(`hq
|
|
2273
|
+
process.stderr.write(`hq runners: ${filePath} is not valid JSON: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
2274
2274
|
return {};
|
|
2275
2275
|
}
|
|
2276
2276
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
@@ -2592,11 +2592,11 @@ export function spawnLaneWorker(hqRoot, lane, deps = {}, launch = {}) {
|
|
|
2592
2592
|
};
|
|
2593
2593
|
});
|
|
2594
2594
|
if (recorded) {
|
|
2595
|
-
process.stderr.write(`hq
|
|
2595
|
+
process.stderr.write(`hq runners: lane ${lane.lane_id} waits: ${err.message}\n`);
|
|
2596
2596
|
}
|
|
2597
2597
|
throw err;
|
|
2598
2598
|
}
|
|
2599
|
-
process.stderr.write(`hq
|
|
2599
|
+
process.stderr.write(`hq runners: account bind failed for ${lane.lane_id}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
2600
2600
|
throw err;
|
|
2601
2601
|
}
|
|
2602
2602
|
const preservedAccountModel = selection.preservedModel;
|
|
@@ -2717,7 +2717,7 @@ export function spawnLaneWorker(hqRoot, lane, deps = {}, launch = {}) {
|
|
|
2717
2717
|
installDrainHook(lane.provider, remoteControlHome ?? resolved.home);
|
|
2718
2718
|
}
|
|
2719
2719
|
catch (err) {
|
|
2720
|
-
process.stderr.write(`hq
|
|
2720
|
+
process.stderr.write(`hq runners: drain hook install failed for ${resolved.home}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
2721
2721
|
throw err;
|
|
2722
2722
|
}
|
|
2723
2723
|
const briefPath = path.join(runDir, "brief.md");
|
|
@@ -2931,7 +2931,7 @@ export function spawnLaneWorker(hqRoot, lane, deps = {}, launch = {}) {
|
|
|
2931
2931
|
catch (err) {
|
|
2932
2932
|
const code = err instanceof LanesError ? err.error : "manager_status_gate_unavailable";
|
|
2933
2933
|
const message = err instanceof Error ? err.message : String(err);
|
|
2934
|
-
process.stderr.write(`hq
|
|
2934
|
+
process.stderr.write(`hq runners: manager status gate disabled for ${lane.lane_id}: ${code}: ${message}\n`);
|
|
2935
2935
|
statusGateHeartbeat = undefined;
|
|
2936
2936
|
}
|
|
2937
2937
|
let claimed = false;
|
|
@@ -3113,10 +3113,10 @@ export function spawnLaneWorker(hqRoot, lane, deps = {}, launch = {}) {
|
|
|
3113
3113
|
fs.rmSync(replayStateTempPath, { force: true });
|
|
3114
3114
|
}
|
|
3115
3115
|
catch (cleanupErr) {
|
|
3116
|
-
process.stderr.write(`hq
|
|
3116
|
+
process.stderr.write(`hq runners: compaction replay state temp cleanup failed for ${lane.lane_id}: ${cleanupErr instanceof Error ? cleanupErr.message : String(cleanupErr)}\n`);
|
|
3117
3117
|
}
|
|
3118
3118
|
delete childEnv.HQ_LANE_TURN_ID;
|
|
3119
|
-
process.stderr.write(`hq
|
|
3119
|
+
process.stderr.write(`hq runners: compaction replay disabled for ${lane.lane_id}; failed to reset turn state: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
3120
3120
|
}
|
|
3121
3121
|
const workerOutPath = path.join(logsDir, "worker.out");
|
|
3122
3122
|
const workerOutOffset = fileSizeOrZero(workerOutPath);
|
|
@@ -3362,7 +3362,7 @@ export function spawnEnvelopeRepair(hqRoot, lane, input, deps = {}) {
|
|
|
3362
3362
|
? { registryWorkerRecord: lane.registry_worker }
|
|
3363
3363
|
: {}),
|
|
3364
3364
|
onUnknownMetaFields: (fields) => {
|
|
3365
|
-
process.stderr.write(`hq
|
|
3365
|
+
process.stderr.write(`hq runners watcher: envelope repair ignored unknown worker profile meta field(s) for ${lane.worker_profile}: ${fields.join(", ")}\n`);
|
|
3366
3366
|
input.onProfileWarning?.(fields);
|
|
3367
3367
|
},
|
|
3368
3368
|
})
|
|
@@ -19,7 +19,7 @@ function readTail(filePath, maxBytes) {
|
|
|
19
19
|
}
|
|
20
20
|
catch (error) {
|
|
21
21
|
if (error.code !== "ENOENT") {
|
|
22
|
-
process.stderr.write(`hq
|
|
22
|
+
process.stderr.write(`hq runners: could not read status tail ${filePath}: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
23
23
|
}
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
@@ -101,7 +101,7 @@ function terminalExit(lane, runDir) {
|
|
|
101
101
|
return parsed.exit_code;
|
|
102
102
|
}
|
|
103
103
|
catch {
|
|
104
|
-
process.stderr.write(`hq
|
|
104
|
+
process.stderr.write(`hq runners: worker exit record is invalid for ${lane.lane_id}\n`);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
const row = lane;
|
|
@@ -125,7 +125,7 @@ function startTimeMs(lane, runDir) {
|
|
|
125
125
|
}
|
|
126
126
|
catch (error) {
|
|
127
127
|
if (error.code !== "ENOENT") {
|
|
128
|
-
process.stderr.write(`hq
|
|
128
|
+
process.stderr.write(`hq runners: could not read worker start time ${runDir}: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
129
129
|
}
|
|
130
130
|
return null;
|
|
131
131
|
}
|
|
@@ -153,7 +153,7 @@ export function readLaneStatusRowFields(hqRoot, lane, nowMs = Date.now(), local
|
|
|
153
153
|
}
|
|
154
154
|
catch (error) {
|
|
155
155
|
if (error.code !== "ENOENT") {
|
|
156
|
-
process.stderr.write(`hq
|
|
156
|
+
process.stderr.write(`hq runners: could not read status envelopes for ${lane.lane_id}: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
const prSources = [
|
package/dist/lib/lanes/wait.js
CHANGED
|
@@ -14,22 +14,22 @@ function invalidInput(message, details = {}) {
|
|
|
14
14
|
function validateInput(laneIds, changeTypes, timeoutMs) {
|
|
15
15
|
const normalizedLaneIds = laneIds.map((laneId) => laneId.trim());
|
|
16
16
|
if (normalizedLaneIds.length === 0 || normalizedLaneIds.some((laneId) => laneId.length === 0)) {
|
|
17
|
-
invalidInput("hq
|
|
17
|
+
invalidInput("hq runners wait requires at least one non-empty lane id", { lane_ids: laneIds });
|
|
18
18
|
}
|
|
19
19
|
if (normalizedLaneIds.some((laneId) => laneId === "." || laneId === ".." || /[\\/]/.test(laneId))) {
|
|
20
20
|
invalidInput("Lane ids must not contain path separators", { lane_ids: laneIds });
|
|
21
21
|
}
|
|
22
22
|
const uniqueLaneIds = [...new Set(normalizedLaneIds)];
|
|
23
23
|
if (uniqueLaneIds.length > LANE_WAIT_MAX_LANES) {
|
|
24
|
-
invalidInput(`hq
|
|
24
|
+
invalidInput(`hq runners wait accepts at most ${LANE_WAIT_MAX_LANES} lane ids`, {
|
|
25
25
|
max: LANE_WAIT_MAX_LANES,
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
if (changeTypes.length === 0 || changeTypes.some((kind) => !LANE_WAIT_CHANGE_TYPES.includes(kind))) {
|
|
29
|
-
invalidInput(`hq
|
|
29
|
+
invalidInput(`hq runners wait requires one or more --for values: ${LANE_WAIT_CHANGE_TYPES.join(", ")}`, { accepted: [...LANE_WAIT_CHANGE_TYPES], values: changeTypes });
|
|
30
30
|
}
|
|
31
31
|
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0 || !Number.isSafeInteger(Math.ceil(timeoutMs))) {
|
|
32
|
-
invalidInput("hq
|
|
32
|
+
invalidInput("hq runners wait requires a positive finite timeout", { timeout_ms: timeoutMs });
|
|
33
33
|
}
|
|
34
34
|
return {
|
|
35
35
|
laneIds: uniqueLaneIds,
|
package/dist/lib/lanes/watch.js
CHANGED
|
@@ -29,10 +29,10 @@ function validateLaneIds(laneIds) {
|
|
|
29
29
|
throw new LanesError("watch_invalid_lane_id", "Lane ids must not be empty");
|
|
30
30
|
}
|
|
31
31
|
if (unique.length === 0) {
|
|
32
|
-
throw new LanesError("watch_no_lanes", "hq
|
|
32
|
+
throw new LanesError("watch_no_lanes", "hq runners watch requires at least one lane id");
|
|
33
33
|
}
|
|
34
34
|
if (unique.length > MAX_WATCHED_LANES) {
|
|
35
|
-
throw new LanesError("watch_too_many_lanes", `hq
|
|
35
|
+
throw new LanesError("watch_too_many_lanes", `hq runners watch accepts at most ${MAX_WATCHED_LANES} lane ids`, { max: MAX_WATCHED_LANES });
|
|
36
36
|
}
|
|
37
37
|
return unique;
|
|
38
38
|
}
|
|
@@ -97,7 +97,7 @@ function main() {
|
|
|
97
97
|
process.exit(1);
|
|
98
98
|
}
|
|
99
99
|
void runWatcherLoop(hqRoot, laneId, watcherMainDeps(hqRoot, laneId, process.env)).catch((err) => {
|
|
100
|
-
process.stderr.write(`hq
|
|
100
|
+
process.stderr.write(`hq runners watcher: ${err instanceof Error ? err.message : String(err)}${err instanceof Error && err.stack ? `\n${err.stack}` : ""}\n`);
|
|
101
101
|
process.exit(1);
|
|
102
102
|
});
|
|
103
103
|
}
|
|
@@ -333,7 +333,7 @@ function maybeHeartbeatLane(hqRoot, laneId, nowMs) {
|
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
335
|
catch (err) {
|
|
336
|
-
process.stderr.write(`hq
|
|
336
|
+
process.stderr.write(`hq runners watcher: heartbeat failed for ${laneId}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
export function stalledReason(silenceMs) {
|
|
@@ -387,7 +387,7 @@ function recordLaneRefusal(hqRoot, lane, classification, quota) {
|
|
|
387
387
|
});
|
|
388
388
|
}
|
|
389
389
|
catch (err) {
|
|
390
|
-
process.stderr.write(`hq
|
|
390
|
+
process.stderr.write(`hq runners watcher: refusal not recorded for ${lane.lane_id}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
export function applyTerminalToLane(hqRoot, laneId, classification, opts = {}) {
|
|
@@ -410,7 +410,7 @@ function applyTerminalToLaneWithResult(hqRoot, laneId, classification, opts = {}
|
|
|
410
410
|
questionRefusalCode = questionRecordRefusalCode(err);
|
|
411
411
|
if (questionRefusalCode === null)
|
|
412
412
|
throw err;
|
|
413
|
-
process.stderr.write(`hq
|
|
413
|
+
process.stderr.write(`hq runners watcher: terminal ask refused for ${laneId}: ${questionRefusalCode}\n`);
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
416
|
const terminalClassification = questionRefusalCode === null
|
|
@@ -608,7 +608,7 @@ function applyTerminalToLaneWithResult(hqRoot, laneId, classification, opts = {}
|
|
|
608
608
|
emitExecutiveLaneFinished(hqRoot, updated);
|
|
609
609
|
}
|
|
610
610
|
catch (error) {
|
|
611
|
-
process.stderr.write(`hq
|
|
611
|
+
process.stderr.write(`hq runners watcher: source report event failed: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
612
612
|
}
|
|
613
613
|
notifySlotFreed({
|
|
614
614
|
hqRoot,
|
|
@@ -635,7 +635,7 @@ export function isPidAlive(pid) {
|
|
|
635
635
|
return false;
|
|
636
636
|
if (code === "EPERM")
|
|
637
637
|
return true;
|
|
638
|
-
process.stderr.write(`hq
|
|
638
|
+
process.stderr.write(`hq runners watcher: liveness probe for pid ${pid} failed: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
639
639
|
throw err;
|
|
640
640
|
}
|
|
641
641
|
}
|
|
@@ -647,7 +647,7 @@ function fileMtimeMs(filePath) {
|
|
|
647
647
|
const code = err.code;
|
|
648
648
|
if (code === "ENOENT")
|
|
649
649
|
return null;
|
|
650
|
-
process.stderr.write(`hq
|
|
650
|
+
process.stderr.write(`hq runners watcher: failed to stat ${filePath}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
651
651
|
throw err;
|
|
652
652
|
}
|
|
653
653
|
}
|
|
@@ -659,7 +659,7 @@ function fileNonEmpty(filePath) {
|
|
|
659
659
|
const code = err.code;
|
|
660
660
|
if (code === "ENOENT")
|
|
661
661
|
return false;
|
|
662
|
-
process.stderr.write(`hq
|
|
662
|
+
process.stderr.write(`hq runners watcher: failed to stat ${filePath}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
663
663
|
throw err;
|
|
664
664
|
}
|
|
665
665
|
}
|
|
@@ -747,7 +747,7 @@ export function readLatestEnvelopeRecord(hqRoot, laneId, minName) {
|
|
|
747
747
|
if (latest === null)
|
|
748
748
|
return null;
|
|
749
749
|
if (latest.envelope === null) {
|
|
750
|
-
process.stderr.write(`hq
|
|
750
|
+
process.stderr.write(`hq runners watcher: envelope ${latest.path} is not a valid hq-lane-envelope.v1: ${latest.error}\n`);
|
|
751
751
|
return null;
|
|
752
752
|
}
|
|
753
753
|
return { envelope: latest.envelope, ref: latest.ref };
|
|
@@ -772,7 +772,7 @@ export function readLatestEnvelopeFile(hqRoot, laneId, minName) {
|
|
|
772
772
|
const code = err.code;
|
|
773
773
|
if (code === "ENOENT")
|
|
774
774
|
return null;
|
|
775
|
-
process.stderr.write(`hq
|
|
775
|
+
process.stderr.write(`hq runners watcher: failed to list envelopes for ${laneId}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
776
776
|
throw err;
|
|
777
777
|
}
|
|
778
778
|
if (names.length === 0)
|
|
@@ -784,7 +784,7 @@ export function readLatestEnvelopeFile(hqRoot, laneId, minName) {
|
|
|
784
784
|
text = fs.readFileSync(filePath, "utf8");
|
|
785
785
|
}
|
|
786
786
|
catch (err) {
|
|
787
|
-
process.stderr.write(`hq
|
|
787
|
+
process.stderr.write(`hq runners watcher: failed to read envelope ${filePath}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
788
788
|
throw err;
|
|
789
789
|
}
|
|
790
790
|
const ref = path.posix.join("envelopes", latest);
|
|
@@ -858,7 +858,7 @@ async function settleManagerStatusGate(hqRoot, lane, manifestTurnId, at, deps, l
|
|
|
858
858
|
target = resolveManagerStatusTarget(hqRoot, lane);
|
|
859
859
|
}
|
|
860
860
|
catch (err) {
|
|
861
|
-
process.stderr.write(`hq
|
|
861
|
+
process.stderr.write(`hq runners watcher: manager status mapping failed for ${lane.lane_id}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
862
862
|
logDecision({ event: "status_gate_mapping_failed", at, error: err instanceof Error ? err.message : String(err) });
|
|
863
863
|
return lane;
|
|
864
864
|
}
|
|
@@ -875,7 +875,7 @@ async function settleManagerStatusGate(hqRoot, lane, manifestTurnId, at, deps, l
|
|
|
875
875
|
written = managerStatusWasWritten(gate, readStatusSnapshot(gate.status_path));
|
|
876
876
|
}
|
|
877
877
|
catch (err) {
|
|
878
|
-
process.stderr.write(`hq
|
|
878
|
+
process.stderr.write(`hq runners watcher: manager status read failed for ${lane.lane_id}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
879
879
|
logDecision({ event: "status_gate_status_read_failed", at, error: err instanceof Error ? err.message : String(err) });
|
|
880
880
|
written = false;
|
|
881
881
|
}
|
|
@@ -918,7 +918,7 @@ async function settleBlockerFreshness(hqRoot, lane, manifestTurnId, at, deps, me
|
|
|
918
918
|
return;
|
|
919
919
|
errorLogged = true;
|
|
920
920
|
const code = error instanceof LanesError ? error.error : "blocker_freshness_unavailable";
|
|
921
|
-
process.stderr.write(`hq
|
|
921
|
+
process.stderr.write(`hq runners watcher: blocker freshness disabled for ${lane.lane_id}: ${code}\n`);
|
|
922
922
|
logDecision({ event: "blocker_freshness_disabled", at, error: code });
|
|
923
923
|
},
|
|
924
924
|
});
|
|
@@ -1090,7 +1090,7 @@ async function settleBlockerFreshness(hqRoot, lane, manifestTurnId, at, deps, me
|
|
|
1090
1090
|
}
|
|
1091
1091
|
catch (error) {
|
|
1092
1092
|
const message = error instanceof Error ? error.message : String(error);
|
|
1093
|
-
process.stderr.write(`hq
|
|
1093
|
+
process.stderr.write(`hq runners watcher: blocker freshness fallback delivery failed for ${lane.lane_id}: ${message}\n`);
|
|
1094
1094
|
logDecision({ event: "blocker_stale_escalation_fallback_failed", at, turn_id: turnId, fingerprint, error: message });
|
|
1095
1095
|
updated = updateLaneFollowup(hqRoot, lane.lane_id, deps, (current) => {
|
|
1096
1096
|
const state = current.blocker_freshness_state;
|
|
@@ -1157,7 +1157,7 @@ async function settleBlockerFreshness(hqRoot, lane, manifestTurnId, at, deps, me
|
|
|
1157
1157
|
}
|
|
1158
1158
|
catch (error) {
|
|
1159
1159
|
const message = error instanceof Error ? error.message : String(error);
|
|
1160
|
-
process.stderr.write(`hq
|
|
1160
|
+
process.stderr.write(`hq runners watcher: blocker freshness escalation delivery failed for ${lane.lane_id}: ${message}\n`);
|
|
1161
1161
|
logDecision({ event: "blocker_stale_escalation_delivery_failed", at, turn_id: turnId, error: message });
|
|
1162
1162
|
updated = updateLaneFollowup(hqRoot, lane.lane_id, deps, (current) => {
|
|
1163
1163
|
const state = current.blocker_freshness_state;
|
|
@@ -1196,7 +1196,7 @@ async function settleKrFreshness(hqRoot, lane, manifestTurnId, at, deps, logDeci
|
|
|
1196
1196
|
return;
|
|
1197
1197
|
errorLogged = true;
|
|
1198
1198
|
const code = error instanceof LanesError ? error.error : "kr_freshness_unavailable";
|
|
1199
|
-
process.stderr.write(`hq
|
|
1199
|
+
process.stderr.write(`hq runners watcher: KR freshness disabled for ${lane.lane_id}: ${code}\n`);
|
|
1200
1200
|
logDecision({ event: "kr_freshness_disabled", at, error: code });
|
|
1201
1201
|
},
|
|
1202
1202
|
});
|
|
@@ -1266,7 +1266,7 @@ async function deliverQuotaNotice(hqRoot, lane, quota, at, deps, logDecision) {
|
|
|
1266
1266
|
}
|
|
1267
1267
|
catch (err) {
|
|
1268
1268
|
const message = err instanceof Error ? err.message : String(err);
|
|
1269
|
-
process.stderr.write(`hq
|
|
1269
|
+
process.stderr.write(`hq runners watcher: quota notice failed for ${lane.lane_id}: ${message}\n`);
|
|
1270
1270
|
logDecision({ event: "quota_notice_failed", at, error: message });
|
|
1271
1271
|
}
|
|
1272
1272
|
}
|
|
@@ -1314,7 +1314,7 @@ export async function emitMeshSoft(event, logDecision, at, fn, timeoutMs = 10_00
|
|
|
1314
1314
|
catch (err) {
|
|
1315
1315
|
const message = err instanceof Error ? err.message : String(err);
|
|
1316
1316
|
logDecision({ event: "mesh_event_failed", at, mesh_event: event, error: message });
|
|
1317
|
-
process.stderr.write(`hq
|
|
1317
|
+
process.stderr.write(`hq runners watcher: mesh_event_failed ${event}: ${message}\n`);
|
|
1318
1318
|
return false;
|
|
1319
1319
|
}
|
|
1320
1320
|
finally {
|
|
@@ -1329,7 +1329,7 @@ function readProgressIntervalMs(hqRoot, lane) {
|
|
|
1329
1329
|
return providerProgressEventMinIntervalMs(config.providers[lane.provider]);
|
|
1330
1330
|
}
|
|
1331
1331
|
catch (err) {
|
|
1332
|
-
process.stderr.write(`hq
|
|
1332
|
+
process.stderr.write(`hq runners watcher: lanes config unreadable, using default progress interval: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1333
1333
|
}
|
|
1334
1334
|
return providerProgressEventMinIntervalMs({ max_running: 1, max_queued: 1, accounts: {} });
|
|
1335
1335
|
}
|
|
@@ -1338,7 +1338,7 @@ function readLaneSoft(hqRoot, laneId) {
|
|
|
1338
1338
|
return readLane(hqRoot, laneId);
|
|
1339
1339
|
}
|
|
1340
1340
|
catch (err) {
|
|
1341
|
-
process.stderr.write(`hq
|
|
1341
|
+
process.stderr.write(`hq runners watcher: lane read failed for ${laneId}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1342
1342
|
return null;
|
|
1343
1343
|
}
|
|
1344
1344
|
}
|
|
@@ -1554,7 +1554,7 @@ export async function runWatcherLoop(hqRoot, laneId, deps = {}) {
|
|
|
1554
1554
|
catch {
|
|
1555
1555
|
// Logging is best effort; stderr below still records the loss.
|
|
1556
1556
|
}
|
|
1557
|
-
process.stderr.write(`hq
|
|
1557
|
+
process.stderr.write(`hq runners watcher: claim lost for ${laneId} to pid ${claimantPid ?? "unknown"}\n`);
|
|
1558
1558
|
return;
|
|
1559
1559
|
}
|
|
1560
1560
|
}
|
|
@@ -1624,7 +1624,7 @@ async function runWatcherLoopOwned(hqRoot, laneId, deps, releaseClaim = () => {
|
|
|
1624
1624
|
err instanceof LanesError && err.error === "story_not_on_board") {
|
|
1625
1625
|
storyStatusSuppressions.add(laneStoryStatusSuppressionKey(company, initialLane.project_id, initialLane.story_id));
|
|
1626
1626
|
}
|
|
1627
|
-
process.stderr.write(`hq
|
|
1627
|
+
process.stderr.write(`hq runners watcher: mesh thread ensure failed for ${laneId}: ${message}\n`);
|
|
1628
1628
|
writeWatcherDecision(outPath, {
|
|
1629
1629
|
event: "mesh_event_failed",
|
|
1630
1630
|
at: new Date(now()).toISOString(),
|
|
@@ -1745,7 +1745,7 @@ async function runWatcherLoopOwned(hqRoot, laneId, deps, releaseClaim = () => {
|
|
|
1745
1745
|
providerRejection = routed.rejection;
|
|
1746
1746
|
}
|
|
1747
1747
|
catch (err) {
|
|
1748
|
-
process.stderr.write(`hq
|
|
1748
|
+
process.stderr.write(`hq runners watcher: quota read failed for ${laneId}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1749
1749
|
}
|
|
1750
1750
|
}
|
|
1751
1751
|
// Spec §4: the process exited and its envelope file does not parse, or
|
|
@@ -1795,7 +1795,7 @@ async function runWatcherLoopOwned(hqRoot, laneId, deps, releaseClaim = () => {
|
|
|
1795
1795
|
}
|
|
1796
1796
|
catch (err) {
|
|
1797
1797
|
const message = err instanceof Error ? err.message : String(err);
|
|
1798
|
-
process.stderr.write(`hq
|
|
1798
|
+
process.stderr.write(`hq runners watcher: invalid ask fallback could not parse ${repairCandidate.path} for ${laneId}: ${message}\n`);
|
|
1799
1799
|
logDecision({
|
|
1800
1800
|
event: "envelope_repair",
|
|
1801
1801
|
at: new Date(now()).toISOString(),
|
|
@@ -1812,7 +1812,7 @@ async function runWatcherLoopOwned(hqRoot, laneId, deps, releaseClaim = () => {
|
|
|
1812
1812
|
latest = { envelope: recovery.envelope, ref: repairCandidate.ref };
|
|
1813
1813
|
envelope = recovery.envelope;
|
|
1814
1814
|
recoveredAsk = true;
|
|
1815
|
-
const message = `hq
|
|
1815
|
+
const message = `hq runners watcher: routing invalid ask envelope for ${laneId} to awaiting_input ` +
|
|
1816
1816
|
`with ${recovery.envelope.questions?.length ?? 0} validated question(s); errors: ${errors.join("; ")}`;
|
|
1817
1817
|
process.stderr.write(`${message}\n`);
|
|
1818
1818
|
logDecision({
|
|
@@ -1830,7 +1830,7 @@ async function runWatcherLoopOwned(hqRoot, laneId, deps, releaseClaim = () => {
|
|
|
1830
1830
|
: [...new Set([...repair.errors, ...recovery.questionErrors])];
|
|
1831
1831
|
invalidEnvelope = { errors };
|
|
1832
1832
|
if (recovery !== null) {
|
|
1833
|
-
const message = `hq
|
|
1833
|
+
const message = `hq runners watcher: invalid ask envelope for ${laneId} remains failed; ` +
|
|
1834
1834
|
`0 of ${recovery.sourceQuestionCount} questions passed validation`;
|
|
1835
1835
|
process.stderr.write(`${message}\n`);
|
|
1836
1836
|
logDecision({
|
|
@@ -1893,7 +1893,7 @@ async function runWatcherLoopOwned(hqRoot, laneId, deps, releaseClaim = () => {
|
|
|
1893
1893
|
markLaneStalled(hqRoot, laneId, tick.emit.at, reason);
|
|
1894
1894
|
}
|
|
1895
1895
|
catch (err) {
|
|
1896
|
-
process.stderr.write(`hq
|
|
1896
|
+
process.stderr.write(`hq runners watcher: stalled write failed for ${laneId}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1897
1897
|
}
|
|
1898
1898
|
}
|
|
1899
1899
|
if (tick.emit.kind === "progress") {
|
|
@@ -1902,7 +1902,7 @@ async function runWatcherLoopOwned(hqRoot, laneId, deps, releaseClaim = () => {
|
|
|
1902
1902
|
clearLaneStalled(hqRoot, laneId);
|
|
1903
1903
|
}
|
|
1904
1904
|
catch (err) {
|
|
1905
|
-
process.stderr.write(`hq
|
|
1905
|
+
process.stderr.write(`hq runners watcher: stalled clear failed for ${laneId}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1906
1906
|
}
|
|
1907
1907
|
// Spec §8 progress row. Only a tick that saw new tool activity or
|
|
1908
1908
|
// new output gets here (tickWatcher emits progress on `progressed`
|
|
@@ -1931,7 +1931,7 @@ async function runWatcherLoopOwned(hqRoot, laneId, deps, releaseClaim = () => {
|
|
|
1931
1931
|
}));
|
|
1932
1932
|
}
|
|
1933
1933
|
catch (err) {
|
|
1934
|
-
process.stderr.write(`hq
|
|
1934
|
+
process.stderr.write(`hq runners watcher: progress timestamp write failed for ${laneId}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1935
1935
|
}
|
|
1936
1936
|
}
|
|
1937
1937
|
}
|
|
@@ -1963,7 +1963,7 @@ async function runWatcherLoopOwned(hqRoot, laneId, deps, releaseClaim = () => {
|
|
|
1963
1963
|
recordAccountQuota(hqRoot, quotaLane.provider, quotaLane.account, quota, new Date(now()));
|
|
1964
1964
|
}
|
|
1965
1965
|
catch (err) {
|
|
1966
|
-
process.stderr.write(`hq
|
|
1966
|
+
process.stderr.write(`hq runners watcher: quota record failed for ${laneId}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1967
1967
|
}
|
|
1968
1968
|
}
|
|
1969
1969
|
// A usage limit fails only this lane: no automatic move to another
|
|
@@ -1986,7 +1986,7 @@ async function runWatcherLoopOwned(hqRoot, laneId, deps, releaseClaim = () => {
|
|
|
1986
1986
|
}
|
|
1987
1987
|
catch (err) {
|
|
1988
1988
|
const message = err instanceof Error ? err.message : String(err);
|
|
1989
|
-
process.stderr.write(`hq
|
|
1989
|
+
process.stderr.write(`hq runners watcher: account failover failed for ${laneId}: ${message}\n`);
|
|
1990
1990
|
logDecision({ event: "account_failover_failed", at: tick.emit.at, reason: accountRetryReason, error: message });
|
|
1991
1991
|
if (readLane(hqRoot, laneId).state !== "running")
|
|
1992
1992
|
return;
|
|
@@ -2083,7 +2083,7 @@ async function runWatcherLoopOwned(hqRoot, laneId, deps, releaseClaim = () => {
|
|
|
2083
2083
|
}
|
|
2084
2084
|
catch (err) {
|
|
2085
2085
|
const message = err instanceof Error ? err.message : String(err);
|
|
2086
|
-
process.stderr.write(`hq
|
|
2086
|
+
process.stderr.write(`hq runners watcher: queued message recovery failed for ${laneId}: ${message}\n`);
|
|
2087
2087
|
logDecision({
|
|
2088
2088
|
event: "message_recovery_failed",
|
|
2089
2089
|
at: tick.emit.at,
|
|
@@ -2134,7 +2134,7 @@ async function runWatcherLoopOwned(hqRoot, laneId, deps, releaseClaim = () => {
|
|
|
2134
2134
|
}
|
|
2135
2135
|
catch (err) {
|
|
2136
2136
|
const message = err instanceof Error ? err.message : String(err);
|
|
2137
|
-
process.stderr.write(`hq
|
|
2137
|
+
process.stderr.write(`hq runners watcher: terminal keep-alive trigger failed for ${laneId}: ${message}\n`);
|
|
2138
2138
|
logDecision({ event: "keep_alive_terminal_trigger_failed", at: tick.emit.at, error: message });
|
|
2139
2139
|
}
|
|
2140
2140
|
}
|
|
@@ -2152,7 +2152,7 @@ async function runWatcherLoopOwned(hqRoot, laneId, deps, releaseClaim = () => {
|
|
|
2152
2152
|
}
|
|
2153
2153
|
catch (err) {
|
|
2154
2154
|
const message = err instanceof Error ? err.message : String(err);
|
|
2155
|
-
process.stderr.write(`hq
|
|
2155
|
+
process.stderr.write(`hq runners watcher: queue admission failed after ${laneId}: ${message}\n`);
|
|
2156
2156
|
logDecision({ event: "queue_admission_failed", at: tick.emit.at, error: message });
|
|
2157
2157
|
}
|
|
2158
2158
|
}
|
|
@@ -2206,7 +2206,7 @@ function recoverRawEnvelopeArtifacts(rawText) {
|
|
|
2206
2206
|
return Array.isArray(parsed) ? parsed : undefined;
|
|
2207
2207
|
}
|
|
2208
2208
|
catch {
|
|
2209
|
-
process.stderr.write("hq
|
|
2209
|
+
process.stderr.write("hq runners watcher: could not recover artifacts from the invalid envelope\n");
|
|
2210
2210
|
return undefined;
|
|
2211
2211
|
}
|
|
2212
2212
|
}
|
|
@@ -2247,7 +2247,7 @@ export function decideEnvelopeRepair(hqRoot, laneId, latest, nowMs, spawnRepair,
|
|
|
2247
2247
|
}));
|
|
2248
2248
|
}
|
|
2249
2249
|
catch (err) {
|
|
2250
|
-
process.stderr.write(`hq
|
|
2250
|
+
process.stderr.write(`hq runners watcher: envelope_repair write failed for ${laneId}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
2251
2251
|
}
|
|
2252
2252
|
logDecision({ event: "envelope_repair", at, outcome: "second_failure", errors });
|
|
2253
2253
|
return { action: "give_up", errors };
|
|
@@ -2300,7 +2300,7 @@ export function decideEnvelopeRepair(hqRoot, laneId, latest, nowMs, spawnRepair,
|
|
|
2300
2300
|
}
|
|
2301
2301
|
catch (err) {
|
|
2302
2302
|
const message = err instanceof Error ? err.message : String(err);
|
|
2303
|
-
process.stderr.write(`hq
|
|
2303
|
+
process.stderr.write(`hq runners watcher: envelope repair spawn failed for ${laneId}: ${message}\n`);
|
|
2304
2304
|
writeRepairRecord(hqRoot, laneId, {
|
|
2305
2305
|
...base,
|
|
2306
2306
|
mode,
|
|
@@ -2327,7 +2327,7 @@ function markRepairSucceeded(hqRoot, laneId, _envelopeRef) {
|
|
|
2327
2327
|
});
|
|
2328
2328
|
}
|
|
2329
2329
|
catch (err) {
|
|
2330
|
-
process.stderr.write(`hq
|
|
2330
|
+
process.stderr.write(`hq runners watcher: envelope_repair success write failed for ${laneId}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
2331
2331
|
}
|
|
2332
2332
|
}
|
|
2333
2333
|
/** Exported so tests can prove the watcher reads the live record, not spawn env. */
|