@integrity-labs/agt-cli 0.28.1267 → 0.28.1268
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/dist/{api-client-NGXHG4YA.js → api-client-MH7MLGTA.js} +2 -2
- package/dist/bin/agt.js +5 -5
- package/dist/{chunk-DCI6M6TF.js → chunk-EHZQAT3Q.js} +2 -2
- package/dist/{chunk-UA2UPXYC.js → chunk-ERO3R3Z7.js} +84 -2
- package/dist/chunk-ERO3R3Z7.js.map +1 -0
- package/dist/{chunk-SR72T5SB.js → chunk-TMZDRXAK.js} +3 -3
- package/dist/{claude-pair-runtime-ASGVKZ5N.js → claude-pair-runtime-3PHBCCUP.js} +2 -2
- package/dist/lib/manager-worker.js +237 -26
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +6 -1
- package/dist/mcp/slack-channel.js +6 -1
- package/dist/mcp/telegram-channel.js +6 -1
- package/dist/{persistent-session-FMY2FZEL.js → persistent-session-BLZPYHBE.js} +16 -2
- package/dist/{responsiveness-probe-26TFNDWB.js → responsiveness-probe-T6O4V2XZ.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-UA2UPXYC.js.map +0 -1
- /package/dist/{api-client-NGXHG4YA.js.map → api-client-MH7MLGTA.js.map} +0 -0
- /package/dist/{chunk-DCI6M6TF.js.map → chunk-EHZQAT3Q.js.map} +0 -0
- /package/dist/{chunk-SR72T5SB.js.map → chunk-TMZDRXAK.js.map} +0 -0
- /package/dist/{claude-pair-runtime-ASGVKZ5N.js.map → claude-pair-runtime-3PHBCCUP.js.map} +0 -0
- /package/dist/{persistent-session-FMY2FZEL.js.map → persistent-session-BLZPYHBE.js.map} +0 -0
- /package/dist/{responsiveness-probe-26TFNDWB.js.map → responsiveness-probe-T6O4V2XZ.js.map} +0 -0
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
exchangeApiKey,
|
|
3
3
|
getApiKey,
|
|
4
4
|
getHost
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EHZQAT3Q.js";
|
|
6
6
|
import {
|
|
7
7
|
LATE_BOUND_VARS,
|
|
8
8
|
PLATFORM_DENY_PERMISSIONS,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
shellQuote,
|
|
26
26
|
withheldRemoteMcpMessage,
|
|
27
27
|
withheldRemoteMcpReasonFor
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-ERO3R3Z7.js";
|
|
29
29
|
import {
|
|
30
30
|
readDailySessionPin,
|
|
31
31
|
sessionTranscriptDir
|
|
@@ -13808,4 +13808,4 @@ export {
|
|
|
13808
13808
|
managerInstallSystemUnitCommand,
|
|
13809
13809
|
managerUninstallSystemUnitCommand
|
|
13810
13810
|
};
|
|
13811
|
-
//# sourceMappingURL=chunk-
|
|
13811
|
+
//# sourceMappingURL=chunk-TMZDRXAK.js.map
|
|
@@ -323,7 +323,7 @@ async function spawnPairSession(session) {
|
|
|
323
323
|
return { ok: true };
|
|
324
324
|
} catch {
|
|
325
325
|
}
|
|
326
|
-
const { resolveClaudeBinary } = await import("./persistent-session-
|
|
326
|
+
const { resolveClaudeBinary } = await import("./persistent-session-BLZPYHBE.js");
|
|
327
327
|
const claudeBin = resolveClaudeBinary();
|
|
328
328
|
const pairEnv = {
|
|
329
329
|
...process.env,
|
|
@@ -838,4 +838,4 @@ export {
|
|
|
838
838
|
startClaudePair,
|
|
839
839
|
submitClaudePairCode
|
|
840
840
|
};
|
|
841
|
-
//# sourceMappingURL=claude-pair-runtime-
|
|
841
|
+
//# sourceMappingURL=claude-pair-runtime-3PHBCCUP.js.map
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
tripClass,
|
|
71
71
|
writeEtcEnvironment,
|
|
72
72
|
writeProfileDScript
|
|
73
|
-
} from "../chunk-
|
|
73
|
+
} from "../chunk-TMZDRXAK.js";
|
|
74
74
|
import {
|
|
75
75
|
ApiError,
|
|
76
76
|
adoptHostKeyInProcess,
|
|
@@ -88,7 +88,7 @@ import {
|
|
|
88
88
|
probeHostKey,
|
|
89
89
|
requireHost,
|
|
90
90
|
setConfigHash
|
|
91
|
-
} from "../chunk-
|
|
91
|
+
} from "../chunk-EHZQAT3Q.js";
|
|
92
92
|
import {
|
|
93
93
|
BLOCKED_ON_PROMPT_DECISION,
|
|
94
94
|
CHANNEL_SECRET_ENV_KEYS,
|
|
@@ -125,6 +125,7 @@ import {
|
|
|
125
125
|
isOpencodeSessionHealthy,
|
|
126
126
|
isSessionHealthy,
|
|
127
127
|
isolationMode,
|
|
128
|
+
killStragglerProcess,
|
|
128
129
|
log,
|
|
129
130
|
mergeOpencodeConfigArtifact,
|
|
130
131
|
modelPolicyAuthComponent,
|
|
@@ -138,6 +139,8 @@ import {
|
|
|
138
139
|
policyResolvedModel,
|
|
139
140
|
prepareForRespawn,
|
|
140
141
|
probeClaudeProcessInTmux,
|
|
142
|
+
probeSessionProcess,
|
|
143
|
+
probeSessionProcessOlderThan,
|
|
141
144
|
probeTmuxSession,
|
|
142
145
|
readChannelServerEnv,
|
|
143
146
|
readDirectChatSessionState,
|
|
@@ -175,7 +178,7 @@ import {
|
|
|
175
178
|
webFetchBaselineValue,
|
|
176
179
|
webFetchRestartNeeded,
|
|
177
180
|
writeEgressAllowlist
|
|
178
|
-
} from "../chunk-
|
|
181
|
+
} from "../chunk-ERO3R3Z7.js";
|
|
179
182
|
import {
|
|
180
183
|
isAgentIdle,
|
|
181
184
|
isStaleForToday,
|
|
@@ -454,15 +457,31 @@ function configReloadConfirmed(input) {
|
|
|
454
457
|
var ConfigReloadLedger = class {
|
|
455
458
|
pending = /* @__PURE__ */ new Map();
|
|
456
459
|
confirmed = /* @__PURE__ */ new Set();
|
|
460
|
+
/**
|
|
461
|
+
* ENG-12052: when the FIRST fresh render for the pending reload landed. A
|
|
462
|
+
* session started at or after it was started from fresh config, so the
|
|
463
|
+
* reload retry must never stop it (stopping it is the kill/respawn loop
|
|
464
|
+
* b4cfce82 hit). Cleared whenever the reload is re-torn-down or acked.
|
|
465
|
+
*/
|
|
466
|
+
freshRenderAt = /* @__PURE__ */ new Map();
|
|
457
467
|
/** What the poll does with this agent's integration-change request. Records a teardown. */
|
|
458
468
|
service(agentId, requested) {
|
|
459
469
|
const action = configReloadAction({ requested, pendingRequested: this.pending.get(agentId) });
|
|
460
470
|
if (action === "teardown") {
|
|
461
471
|
this.pending.set(agentId, requested);
|
|
462
472
|
this.confirmed.delete(agentId);
|
|
473
|
+
this.freshRenderAt.delete(agentId);
|
|
463
474
|
}
|
|
464
475
|
return action;
|
|
465
476
|
}
|
|
477
|
+
/** ENG-12052: a fresh render landed for the pending reload; keeps the earliest. */
|
|
478
|
+
noteFreshRender(agentId, atMs) {
|
|
479
|
+
if (this.pending.has(agentId) && !this.freshRenderAt.has(agentId)) this.freshRenderAt.set(agentId, atMs);
|
|
480
|
+
}
|
|
481
|
+
/** ENG-12052: when the pending reload's first fresh render landed, or null. */
|
|
482
|
+
freshRenderedAt(agentId) {
|
|
483
|
+
return this.freshRenderAt.get(agentId) ?? null;
|
|
484
|
+
}
|
|
466
485
|
isPending(agentId) {
|
|
467
486
|
return this.pending.has(agentId);
|
|
468
487
|
}
|
|
@@ -478,6 +497,7 @@ var ConfigReloadLedger = class {
|
|
|
478
497
|
const requestedAt = this.pending.get(agentId);
|
|
479
498
|
this.confirmed.delete(agentId);
|
|
480
499
|
this.pending.delete(agentId);
|
|
500
|
+
this.freshRenderAt.delete(agentId);
|
|
481
501
|
if (requestedAt) out.push({ agentId, requestedAt });
|
|
482
502
|
}
|
|
483
503
|
return out;
|
|
@@ -486,6 +506,7 @@ var ConfigReloadLedger = class {
|
|
|
486
506
|
forget(agentId) {
|
|
487
507
|
this.pending.delete(agentId);
|
|
488
508
|
this.confirmed.delete(agentId);
|
|
509
|
+
this.freshRenderAt.delete(agentId);
|
|
489
510
|
}
|
|
490
511
|
};
|
|
491
512
|
function stampIsOlder(a, b) {
|
|
@@ -534,33 +555,163 @@ function staleSessionStopConfirmed(sessionState) {
|
|
|
534
555
|
}
|
|
535
556
|
|
|
536
557
|
// src/lib/config-reload-confirm.ts
|
|
558
|
+
var UNKNOWN_ALERT_AFTER_MS = 10 * 6e4;
|
|
537
559
|
function staleReloadTmuxSession(framework, codeName) {
|
|
538
560
|
return framework === "opencode" ? opencodeTmuxSession(codeName) : `agt-${codeName}`;
|
|
539
561
|
}
|
|
562
|
+
var UnknownStreak = class {
|
|
563
|
+
since = /* @__PURE__ */ new Map();
|
|
564
|
+
alertedAt = /* @__PURE__ */ new Map();
|
|
565
|
+
count = /* @__PURE__ */ new Map();
|
|
566
|
+
/** `count` is how many times in a row this key was noted (1 on the first). */
|
|
567
|
+
note(agentId, nowMs) {
|
|
568
|
+
const start = this.since.get(agentId) ?? nowMs;
|
|
569
|
+
this.since.set(agentId, start);
|
|
570
|
+
const count = (this.count.get(agentId) ?? 0) + 1;
|
|
571
|
+
this.count.set(agentId, count);
|
|
572
|
+
const forMs = nowMs - start;
|
|
573
|
+
const last = this.alertedAt.get(agentId);
|
|
574
|
+
const due = forMs >= UNKNOWN_ALERT_AFTER_MS && (last === void 0 || nowMs - last >= UNKNOWN_ALERT_AFTER_MS);
|
|
575
|
+
if (due) this.alertedAt.set(agentId, nowMs);
|
|
576
|
+
return { alert: due, forMs, count };
|
|
577
|
+
}
|
|
578
|
+
clear(agentId) {
|
|
579
|
+
this.since.delete(agentId);
|
|
580
|
+
this.alertedAt.delete(agentId);
|
|
581
|
+
this.count.delete(agentId);
|
|
582
|
+
}
|
|
583
|
+
};
|
|
540
584
|
function confirmConfigReload(input, deps) {
|
|
585
|
+
let held = false;
|
|
586
|
+
const out = confirmConfigReloadOnce(input, deps, () => {
|
|
587
|
+
held = true;
|
|
588
|
+
});
|
|
589
|
+
if (!held && !(out.action === "not_ready" && input.pending)) deps.unknownStreak?.clear(input.agentId);
|
|
590
|
+
return out;
|
|
591
|
+
}
|
|
592
|
+
function confirmConfigReloadOnce(input, deps, onHold) {
|
|
541
593
|
if (!configReloadConfirmed({ pending: input.pending, freshFetch: input.freshFetch, rendered: input.rendered })) {
|
|
542
594
|
return { action: "not_ready" };
|
|
543
595
|
}
|
|
596
|
+
const now = deps.now ?? Date.now;
|
|
597
|
+
const claudeCode = input.framework !== "opencode";
|
|
544
598
|
const session = staleReloadTmuxSession(input.framework, input.codeName);
|
|
599
|
+
const holdUnknown = (what) => {
|
|
600
|
+
onHold();
|
|
601
|
+
const streak = deps.unknownStreak?.note(input.agentId, now());
|
|
602
|
+
if (streak?.alert) {
|
|
603
|
+
deps.alert?.(
|
|
604
|
+
input.agentId,
|
|
605
|
+
`config-change reload for '${input.codeName}' has been unconfirmable for ${Math.round(streak.forMs / 6e4)} min (${what}); it stays pending, and the agent may still be running pre-reload config (ENG-12052)`
|
|
606
|
+
);
|
|
607
|
+
}
|
|
608
|
+
};
|
|
545
609
|
let stopped = false;
|
|
546
610
|
if (deps.probe(session) === "alive") {
|
|
611
|
+
const spawnedAt = claudeCode && deps.sessionSpawnedAt ? deps.sessionSpawnedAt(input.codeName) : void 0;
|
|
612
|
+
const freshAt = input.freshRenderedAt ?? null;
|
|
613
|
+
if (spawnedAt !== void 0 && spawnedAt !== null && freshAt !== null && spawnedAt >= freshAt) {
|
|
614
|
+
const blind = claudeCode && deps.spawnedBlind?.(input.codeName);
|
|
615
|
+
const olderState = blind && deps.probeProcessOlderThan ? deps.probeProcessOlderThan(input.codeName, (now() - spawnedAt) / 1e3 + BLIND_SPAWN_AGE_MARGIN_S) : "unknown";
|
|
616
|
+
if (blind && olderState === "dead") {
|
|
617
|
+
deps.clearBlind?.(input.codeName);
|
|
618
|
+
deps.log(
|
|
619
|
+
`[restart] RELOAD_FRESH_SESSION_VERIFIED agent='${input.codeName}': no session process predates the blind spawn, so no pre-reload straggler survived it (ENG-12052)`
|
|
620
|
+
);
|
|
621
|
+
} else if (blind) {
|
|
622
|
+
deps.log(
|
|
623
|
+
`[restart] RELOAD_FRESH_SESSION_UNVERIFIED agent='${input.codeName}': the running session was started from the fresh render, but while it could not be told whether a pre-reload process was still running, so the reload stays pending (ENG-12052)`
|
|
624
|
+
);
|
|
625
|
+
holdUnknown(
|
|
626
|
+
olderState === "alive" ? "a session process older than the current session is still running beside it (a pre-reload straggler)" : "the session was started while the previous session process could not be probed"
|
|
627
|
+
);
|
|
628
|
+
return { action: "process_unconfirmed", processState: olderState === "alive" ? "alive" : "unknown", stopped: false };
|
|
629
|
+
}
|
|
630
|
+
deps.unknownStreak?.clear(input.agentId);
|
|
631
|
+
deps.confirm(input.agentId);
|
|
632
|
+
deps.log(
|
|
633
|
+
`[restart] config-change reload for '${input.codeName}': the running session was started from the fresh render - acking without a restart (ENG-12052)`
|
|
634
|
+
);
|
|
635
|
+
return { action: "acked", stopped: false, fresh: true };
|
|
636
|
+
}
|
|
637
|
+
if (spawnedAt !== void 0 && (spawnedAt === null || freshAt === null)) {
|
|
638
|
+
deps.log(
|
|
639
|
+
`[restart] RELOAD_GENERATION_UNKNOWN agent='${input.codeName}' spawned_at=${spawnedAt ?? "unknown"} fresh_render_at=${freshAt ?? "unknown"}: cannot tell whether the running session predates the fresh render, so it is not stopped and the reload stays pending (ENG-12052)`
|
|
640
|
+
);
|
|
641
|
+
holdUnknown("the running session's start time or the fresh render time is unknown");
|
|
642
|
+
return { action: "generation_unknown" };
|
|
643
|
+
}
|
|
547
644
|
deps.log(
|
|
548
645
|
`[restart] '${input.codeName}' is running config from before the reload's fresh render - restarting it (ENG-11912)`
|
|
549
646
|
);
|
|
550
|
-
if (
|
|
551
|
-
else deps.
|
|
647
|
+
if (claudeCode) deps.stopClaudeCode(input.codeName);
|
|
648
|
+
else deps.stopOpencode(input.codeName);
|
|
552
649
|
stopped = true;
|
|
553
650
|
}
|
|
554
651
|
const sessionState = deps.probe(session);
|
|
555
|
-
if (staleSessionStopConfirmed(sessionState)) {
|
|
556
|
-
deps.
|
|
557
|
-
|
|
558
|
-
|
|
652
|
+
if (!staleSessionStopConfirmed(sessionState)) {
|
|
653
|
+
deps.log(
|
|
654
|
+
`[restart] STALE_SESSION_STOP_FAILED agent='${input.codeName}' session_state=${sessionState}: the session spawned from pre-reload config is still running or could not be probed, so the config-change reload stays pending and the stop is retried next poll (ENG-11912)`
|
|
655
|
+
);
|
|
656
|
+
if (sessionState === "unknown") holdUnknown("the tmux probe cannot answer");
|
|
657
|
+
return { action: "stop_unconfirmed", sessionState, stopped };
|
|
658
|
+
}
|
|
659
|
+
if (claudeCode && deps.probeProcess) {
|
|
660
|
+
const processState = deps.probeProcess(input.codeName);
|
|
661
|
+
if (processState !== "dead") {
|
|
662
|
+
deps.log(
|
|
663
|
+
`[restart] STALE_SESSION_PROCESS_ALIVE agent='${input.codeName}' process_state=${processState}: tmux is gone but a session process ${processState === "alive" ? "is still running" : "could not be probed"} with pre-reload config, so the reload stays pending; the spawn gate stops a live straggler before any respawn (ENG-12052)`
|
|
664
|
+
);
|
|
665
|
+
if (processState === "unknown") holdUnknown("the session process probe cannot answer");
|
|
666
|
+
return { action: "process_unconfirmed", processState, stopped };
|
|
667
|
+
}
|
|
559
668
|
}
|
|
669
|
+
deps.unknownStreak?.clear(input.agentId);
|
|
670
|
+
deps.confirm(input.agentId);
|
|
671
|
+
deps.log(`[restart] config-change reload for '${input.codeName}' rendered from fresh integrations - acking (ENG-11912)`);
|
|
672
|
+
return { action: "acked", stopped };
|
|
673
|
+
}
|
|
674
|
+
var BLIND_SPAWN_AGE_MARGIN_S = 5;
|
|
675
|
+
var STRAGGLER_TERM_ATTEMPTS = 2;
|
|
676
|
+
function stragglerSpawnGate(codeName, deps) {
|
|
677
|
+
const tmux = deps.probeTmux?.(codeName) ?? "dead";
|
|
678
|
+
if (tmux !== "dead") {
|
|
679
|
+
deps.deferStreak?.clear(codeName);
|
|
680
|
+
deps.log(
|
|
681
|
+
`[persistent-session] '${codeName}': STRAGGLER_GATE_TMUX_${tmux.toUpperCase()} - tmux does not confirm the session is gone, so a claude process for it may be the current session; nothing signalled (ENG-12052)`
|
|
682
|
+
);
|
|
683
|
+
return "spawn-unknown";
|
|
684
|
+
}
|
|
685
|
+
const state10 = deps.probeProcess(codeName);
|
|
686
|
+
if (state10 !== "alive") deps.deferStreak?.clear(codeName);
|
|
687
|
+
if (state10 === "dead") return "spawn";
|
|
688
|
+
if (state10 === "unknown") {
|
|
689
|
+
deps.log(
|
|
690
|
+
`[persistent-session] '${codeName}': STRAGGLER_PROBE_UNKNOWN - cannot tell whether a previous session process is still running; spawning anyway so the agent is not held offline (ENG-12052)`
|
|
691
|
+
);
|
|
692
|
+
return "spawn-unknown";
|
|
693
|
+
}
|
|
694
|
+
if (deps.isDocker(codeName)) {
|
|
695
|
+
deps.deferStreak?.clear(codeName);
|
|
696
|
+
deps.log(
|
|
697
|
+
`[persistent-session] '${codeName}': a previous session's container is still running; the spawn's docker rm -f removes it before the new one starts (ENG-12052)`
|
|
698
|
+
);
|
|
699
|
+
return "spawn-docker-replaces";
|
|
700
|
+
}
|
|
701
|
+
const streak = deps.deferStreak?.note(codeName, (deps.now ?? Date.now)());
|
|
702
|
+
const attempt = streak?.count ?? 1;
|
|
703
|
+
const signal = attempt > STRAGGLER_TERM_ATTEMPTS ? "KILL" : "TERM";
|
|
704
|
+
const signalled = deps.killStraggler(codeName, signal);
|
|
560
705
|
deps.log(
|
|
561
|
-
`[
|
|
706
|
+
`[persistent-session] '${codeName}': deferring spawn - STRAGGLER_ALIVE (attempt ${attempt}): a previous claude process outlived its tmux session and still runs pre-reload config; ${signalled ? `sent it SIG${signal}` : `SIG${signal} matched nothing or failed`}. Not counted as a restart; the next poll re-probes before spawning (ENG-12052)`
|
|
562
707
|
);
|
|
563
|
-
|
|
708
|
+
if (streak?.alert) {
|
|
709
|
+
deps.alert?.(
|
|
710
|
+
codeName,
|
|
711
|
+
`agent '${codeName}' has been held offline for ${Math.round(streak.forMs / 6e4)} min by a previous claude process that survives ${signal === "KILL" ? "SIGTERM and SIGKILL" : "SIGTERM (SIGKILL follows from the next attempt)"} (${attempt} attempts); it is not respawned beside it because it runs pre-reload config. Kill it by hand if it persists (ENG-12052)`
|
|
712
|
+
);
|
|
713
|
+
}
|
|
714
|
+
return "defer";
|
|
564
715
|
}
|
|
565
716
|
|
|
566
717
|
// src/lib/manager-worker.ts
|
|
@@ -14636,7 +14787,7 @@ function createFileMigrationReportIO(codeName, log2) {
|
|
|
14636
14787
|
};
|
|
14637
14788
|
}
|
|
14638
14789
|
var managerHostPost = async (path, body) => {
|
|
14639
|
-
const { api: api2, ApiError: ApiError3 } = await import("../api-client-
|
|
14790
|
+
const { api: api2, ApiError: ApiError3 } = await import("../api-client-MH7MLGTA.js");
|
|
14640
14791
|
try {
|
|
14641
14792
|
const json = await api2.post(path, body);
|
|
14642
14793
|
return { status: 200, json };
|
|
@@ -15922,6 +16073,15 @@ function recordConfigChurnEvent(agentId, codeName, channel, signature) {
|
|
|
15922
16073
|
);
|
|
15923
16074
|
});
|
|
15924
16075
|
}
|
|
16076
|
+
var reloadUnknownStreak = new UnknownStreak();
|
|
16077
|
+
var reloadBlindSpawns = /* @__PURE__ */ new Set();
|
|
16078
|
+
var stragglerDeferStreak = new UnknownStreak();
|
|
16079
|
+
function reloadSessionSpawnedAt(codeName) {
|
|
16080
|
+
const s = getSessionState(codeName);
|
|
16081
|
+
if (!s || s.startedAt === null) return null;
|
|
16082
|
+
if (s.estimatedStartedAt != null && s.estimatedStartedAt === s.startedAt) return null;
|
|
16083
|
+
return s.startedAt;
|
|
16084
|
+
}
|
|
15925
16085
|
async function reportReaperEvent(agentId, reaper, action, reason) {
|
|
15926
16086
|
try {
|
|
15927
16087
|
await api.post("/host/reaper-event", {
|
|
@@ -16675,7 +16835,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
|
|
|
16675
16835
|
var dayRolloverInboundHold = /* @__PURE__ */ new Map();
|
|
16676
16836
|
var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
|
|
16677
16837
|
async function channelInboundActivityAgeSecondsFor(codeName) {
|
|
16678
|
-
const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-
|
|
16838
|
+
const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-T6O4V2XZ.js");
|
|
16679
16839
|
const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
|
|
16680
16840
|
if (newest === null) return null;
|
|
16681
16841
|
return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
|
|
@@ -17556,7 +17716,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
17556
17716
|
var lastVersionCheckAt = 0;
|
|
17557
17717
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
17558
17718
|
var lastResponsivenessProbeAt = 0;
|
|
17559
|
-
var agtCliVersion = true ? "0.28.
|
|
17719
|
+
var agtCliVersion = true ? "0.28.1268" : "dev";
|
|
17560
17720
|
function resolveBrewPath(execFileSync4) {
|
|
17561
17721
|
try {
|
|
17562
17722
|
const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -19565,7 +19725,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
|
|
|
19565
19725
|
if (codeNames.length === 0) return;
|
|
19566
19726
|
void (async () => {
|
|
19567
19727
|
try {
|
|
19568
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
19728
|
+
const { collectDiagnostics } = await import("../persistent-session-BLZPYHBE.js");
|
|
19569
19729
|
await api.post("/host/heartbeat", {
|
|
19570
19730
|
host_id: hostId,
|
|
19571
19731
|
agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
|
|
@@ -19708,7 +19868,7 @@ async function pollCycleInner() {
|
|
|
19708
19868
|
}
|
|
19709
19869
|
try {
|
|
19710
19870
|
const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
|
|
19711
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
19871
|
+
const { collectDiagnostics } = await import("../persistent-session-BLZPYHBE.js");
|
|
19712
19872
|
const diagCodeNames = [...agentState.persistentSessionAgents];
|
|
19713
19873
|
const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor) : void 0;
|
|
19714
19874
|
let tailscaleHostname;
|
|
@@ -20014,7 +20174,7 @@ async function pollCycleInner() {
|
|
|
20014
20174
|
collectPanelessActivityProbes,
|
|
20015
20175
|
getResponsivenessIntervalMs,
|
|
20016
20176
|
occupancyQualificationClassifications
|
|
20017
|
-
} = await import("../responsiveness-probe-
|
|
20177
|
+
} = await import("../responsiveness-probe-T6O4V2XZ.js");
|
|
20018
20178
|
const probeIntervalMs = getResponsivenessIntervalMs();
|
|
20019
20179
|
if (now - lastResponsivenessProbeAt > probeIntervalMs) {
|
|
20020
20180
|
const probeCodeNames = [...agentState.persistentSessionAgents];
|
|
@@ -20131,7 +20291,7 @@ async function pollCycleInner() {
|
|
|
20131
20291
|
collectResponsivenessProbes,
|
|
20132
20292
|
livePendingInboundOldestAgeSeconds,
|
|
20133
20293
|
parkPendingInbound
|
|
20134
|
-
} = await import("../responsiveness-probe-
|
|
20294
|
+
} = await import("../responsiveness-probe-T6O4V2XZ.js");
|
|
20135
20295
|
const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-5PCBGRNY.js");
|
|
20136
20296
|
const wedgeNow = /* @__PURE__ */ new Date();
|
|
20137
20297
|
const liveAgents = agentState.persistentSessionAgents;
|
|
@@ -20417,7 +20577,7 @@ async function pollCycleInner() {
|
|
|
20417
20577
|
}
|
|
20418
20578
|
}
|
|
20419
20579
|
);
|
|
20420
|
-
const { parkPendingInbound } = await import("../responsiveness-probe-
|
|
20580
|
+
const { parkPendingInbound } = await import("../responsiveness-probe-T6O4V2XZ.js");
|
|
20421
20581
|
const { parked, deadLettered } = parkPendingInbound(codeName, new Date(fatalNowMs));
|
|
20422
20582
|
paneFatalStreak.delete(codeName);
|
|
20423
20583
|
paneFatalRestarts.set(codeName, [...history, fatalNowMs]);
|
|
@@ -20448,7 +20608,7 @@ async function pollCycleInner() {
|
|
|
20448
20608
|
TRANSCRIPT_MOUNT_ESCALATION_REFRESH_MS,
|
|
20449
20609
|
bindSourceEscalations
|
|
20450
20610
|
} = await import("../transcript-mount-health-OHE6IVJV.js");
|
|
20451
|
-
const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-
|
|
20611
|
+
const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-BLZPYHBE.js");
|
|
20452
20612
|
const mountConfig = resolveTranscriptMountConfig();
|
|
20453
20613
|
const liveAgents = agentState.persistentSessionAgents;
|
|
20454
20614
|
for (const tracked of [
|
|
@@ -23208,6 +23368,10 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
23208
23368
|
if (markMcpRepairPending(agentState.knownIntegrationHashes, agent.agent_id, orphanPruneFailed || mcpWriteFailed || !rotationHandled)) {
|
|
23209
23369
|
log(`[hot-reload] '${agent.code_name}': MCP config writes did not all land this poll; the next poll re-renders to repair them (ENG-11912)`);
|
|
23210
23370
|
}
|
|
23371
|
+
const reloadRendered = rotationHandled && !orphanPruneFailed && !mcpWriteFailed;
|
|
23372
|
+
if (configReloads.isPending(agent.agent_id) && integrationsFresh && reloadRendered) {
|
|
23373
|
+
configReloads.noteFreshRender(agent.agent_id, Date.now());
|
|
23374
|
+
}
|
|
23211
23375
|
confirmConfigReload(
|
|
23212
23376
|
{
|
|
23213
23377
|
agentId: agent.agent_id,
|
|
@@ -23215,7 +23379,8 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
23215
23379
|
framework: agentFrameworkCache.get(agent.code_name) ?? DEFAULT_FRAMEWORK,
|
|
23216
23380
|
pending: configReloads.isPending(agent.agent_id),
|
|
23217
23381
|
freshFetch: integrationsFresh,
|
|
23218
|
-
rendered:
|
|
23382
|
+
rendered: reloadRendered,
|
|
23383
|
+
freshRenderedAt: configReloads.freshRenderedAt(agent.agent_id)
|
|
23219
23384
|
},
|
|
23220
23385
|
{
|
|
23221
23386
|
// CodeRabbit on ba9356f4: the tri-state probe, not the boolean health
|
|
@@ -23231,7 +23396,15 @@ async function processAgent(agent, agentStates, managedToolkits) {
|
|
|
23231
23396
|
stopPersistentSessionAndForgetMcpBaseline(code, "integration-change");
|
|
23232
23397
|
},
|
|
23233
23398
|
confirm: (agentId) => configReloads.confirm(agentId),
|
|
23234
|
-
log
|
|
23399
|
+
log,
|
|
23400
|
+
// ENG-12052: the session process, not just its tmux session.
|
|
23401
|
+
probeProcess: probeSessionProcess,
|
|
23402
|
+
sessionSpawnedAt: reloadSessionSpawnedAt,
|
|
23403
|
+
spawnedBlind: (code) => reloadBlindSpawns.has(code),
|
|
23404
|
+
probeProcessOlderThan: probeSessionProcessOlderThan,
|
|
23405
|
+
clearBlind: (code) => void reloadBlindSpawns.delete(code),
|
|
23406
|
+
unknownStreak: reloadUnknownStreak,
|
|
23407
|
+
alert: (agentId, reason) => void reportReaperEvent(agentId, "reload-confirm", "alert", reason)
|
|
23235
23408
|
}
|
|
23236
23409
|
);
|
|
23237
23410
|
if (capSurfaceHash !== prevCapSurfaceHash && rotationHandled) {
|
|
@@ -24590,6 +24763,37 @@ async function ensurePersistentSessionUnchecked(agent, tasks, boardItems, refres
|
|
|
24590
24763
|
};
|
|
24591
24764
|
}
|
|
24592
24765
|
}
|
|
24766
|
+
let stragglerGateRan = false;
|
|
24767
|
+
const runStragglerGate = () => {
|
|
24768
|
+
stragglerGateRan = true;
|
|
24769
|
+
const gate = stragglerSpawnGate(codeName, {
|
|
24770
|
+
probeProcess: probeSessionProcess,
|
|
24771
|
+
probeTmux: (c) => probeTmuxSession(`agt-${c}`),
|
|
24772
|
+
isDocker: (c) => effectiveIsolationMode(c) === "docker",
|
|
24773
|
+
killStraggler: killStragglerProcess,
|
|
24774
|
+
log,
|
|
24775
|
+
deferStreak: stragglerDeferStreak,
|
|
24776
|
+
// Obi Wan 417cd9e6ce9a: under 'reload-confirm', which /host/reaper-event
|
|
24777
|
+
// accepts (REAPER_EVENT_ALLOWLIST); an unlisted reaper name is a 400 and
|
|
24778
|
+
// the alert would never open.
|
|
24779
|
+
alert: (_code, reason) => void reportReaperEvent(agent.agent_id, "reload-confirm", "alert", reason)
|
|
24780
|
+
});
|
|
24781
|
+
if (gate === "spawn-unknown" && effectiveIsolationMode(codeName) !== "docker") reloadBlindSpawns.add(codeName);
|
|
24782
|
+
else if (gate !== "defer") reloadBlindSpawns.delete(codeName);
|
|
24783
|
+
if (gate === "defer") {
|
|
24784
|
+
return {
|
|
24785
|
+
decision: "skipped-straggler-alive",
|
|
24786
|
+
spawnAttempted: false,
|
|
24787
|
+
sessionHealthyAfter: false,
|
|
24788
|
+
detail: "a previous claude process for this agent is still running (sent SIGTERM)"
|
|
24789
|
+
};
|
|
24790
|
+
}
|
|
24791
|
+
return null;
|
|
24792
|
+
};
|
|
24793
|
+
if ((agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK) === "claude-code" && !isSessionHealthy(codeName)) {
|
|
24794
|
+
const deferred = runStragglerGate();
|
|
24795
|
+
if (deferred) return deferred;
|
|
24796
|
+
}
|
|
24593
24797
|
const teamSettingsForTz = refreshData.team?.settings;
|
|
24594
24798
|
const agentTimezone = (() => {
|
|
24595
24799
|
const ownTzRaw = refreshData.agent?.timezone;
|
|
@@ -25074,6 +25278,13 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash21("sha256")
|
|
|
25074
25278
|
`[persistent-session] '${codeName}' (host_kind=${hostKind ?? "dedicated"}): injecting per-agent org-scoped key (ADR-0042 pt3b)`
|
|
25075
25279
|
);
|
|
25076
25280
|
}
|
|
25281
|
+
if (!stragglerGateRan && (agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK) === "claude-code" && !isSessionHealthy(codeName)) {
|
|
25282
|
+
const deferred = runStragglerGate();
|
|
25283
|
+
if (deferred) {
|
|
25284
|
+
closeSessionRunForCode(codeName, "failed", "a previous claude process is still running");
|
|
25285
|
+
return deferred;
|
|
25286
|
+
}
|
|
25287
|
+
}
|
|
25077
25288
|
let spawnCopyFailedNow = false;
|
|
25078
25289
|
const spawnMcpConfigPath = prepareSpawnMcpConfig({
|
|
25079
25290
|
codeName,
|
|
@@ -25602,7 +25813,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
|
|
|
25602
25813
|
if (!refreshData) return;
|
|
25603
25814
|
const framework = refreshData.agent?.framework ?? agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK;
|
|
25604
25815
|
const hostId = await getHostId();
|
|
25605
|
-
const parkForRestart = await import("../responsiveness-probe-
|
|
25816
|
+
const parkForRestart = await import("../responsiveness-probe-T6O4V2XZ.js").then(
|
|
25606
25817
|
(m) => m.parkPendingInbound,
|
|
25607
25818
|
(err) => err
|
|
25608
25819
|
);
|
|
@@ -25679,7 +25890,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
|
|
|
25679
25890
|
void api.post("/host/restart-ack", { host_id: hostId, agent_id: agentId, restart_requested_at: requestedAt }).catch((err) => log(`[restart-lane] ack failed for '${codeName}': ${err.message}`));
|
|
25680
25891
|
void (async () => {
|
|
25681
25892
|
try {
|
|
25682
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
25893
|
+
const { collectDiagnostics } = await import("../persistent-session-BLZPYHBE.js");
|
|
25683
25894
|
await api.post("/host/heartbeat", {
|
|
25684
25895
|
host_id: hostId,
|
|
25685
25896
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
|
|
@@ -25732,7 +25943,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
|
|
|
25732
25943
|
}
|
|
25733
25944
|
try {
|
|
25734
25945
|
const hostId = await getHostId();
|
|
25735
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
25946
|
+
const { collectDiagnostics } = await import("../persistent-session-BLZPYHBE.js");
|
|
25736
25947
|
await api.post("/host/heartbeat", {
|
|
25737
25948
|
host_id: hostId,
|
|
25738
25949
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
|
|
@@ -26434,7 +26645,7 @@ async function processClaudePairSessions(agents) {
|
|
|
26434
26645
|
snapshotPairConfig,
|
|
26435
26646
|
// ENG-11659: result -> report body + the manager.log line that records it.
|
|
26436
26647
|
planPairStartReport
|
|
26437
|
-
} = await import("../claude-pair-runtime-
|
|
26648
|
+
} = await import("../claude-pair-runtime-3PHBCCUP.js");
|
|
26438
26649
|
const { resetClaudeSignin, describeSigninResetForLog, describeSigninResetFailure } = await import("../claude-signin-reset-6IJMMVYG.js");
|
|
26439
26650
|
for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
|
|
26440
26651
|
log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
|