@integrity-labs/agt-cli 0.28.1315 → 0.28.1317
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-WRBPHC5L.js → api-client-F33REB5P.js} +2 -2
- package/dist/bin/agt.js +5 -5
- package/dist/{chunk-BSZRE4X6.js → chunk-K65L7VWZ.js} +21 -1
- package/dist/chunk-K65L7VWZ.js.map +1 -0
- package/dist/{chunk-G644BWOT.js → chunk-NJOFLFR4.js} +3 -3
- package/dist/{chunk-QWJMDUEU.js → chunk-RNLQGD6H.js} +2 -2
- package/dist/{claude-pair-runtime-QA3AUNBF.js → claude-pair-runtime-RASVBPT3.js} +2 -2
- package/dist/lib/manager-worker.js +130 -44
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/{persistent-session-K5WFQVXD.js → persistent-session-T2BMZYPF.js} +6 -2
- package/dist/{responsiveness-probe-Q5PDMK2L.js → responsiveness-probe-UP33EKKX.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-BSZRE4X6.js.map +0 -1
- /package/dist/{api-client-WRBPHC5L.js.map → api-client-F33REB5P.js.map} +0 -0
- /package/dist/{chunk-G644BWOT.js.map → chunk-NJOFLFR4.js.map} +0 -0
- /package/dist/{chunk-QWJMDUEU.js.map → chunk-RNLQGD6H.js.map} +0 -0
- /package/dist/{claude-pair-runtime-QA3AUNBF.js.map → claude-pair-runtime-RASVBPT3.js.map} +0 -0
- /package/dist/{persistent-session-K5WFQVXD.js.map → persistent-session-T2BMZYPF.js.map} +0 -0
- /package/dist/{responsiveness-probe-Q5PDMK2L.js.map → responsiveness-probe-UP33EKKX.js.map} +0 -0
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
exchangeApiKey,
|
|
3
3
|
getApiKey,
|
|
4
4
|
getHost
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-RNLQGD6H.js";
|
|
6
6
|
import {
|
|
7
7
|
LATE_BOUND_VARS,
|
|
8
8
|
PLATFORM_DENY_PERMISSIONS,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
warnIgnoredIsolationAllowlist,
|
|
27
27
|
withheldRemoteMcpMessage,
|
|
28
28
|
withheldRemoteMcpReasonFor
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-K65L7VWZ.js";
|
|
30
30
|
import {
|
|
31
31
|
readDailySessionPin,
|
|
32
32
|
sessionTranscriptDir
|
|
@@ -13882,4 +13882,4 @@ export {
|
|
|
13882
13882
|
managerInstallSystemUnitCommand,
|
|
13883
13883
|
managerUninstallSystemUnitCommand
|
|
13884
13884
|
};
|
|
13885
|
-
//# sourceMappingURL=chunk-
|
|
13885
|
+
//# sourceMappingURL=chunk-NJOFLFR4.js.map
|
|
@@ -103,7 +103,7 @@ function exchangeFailureKind(err) {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
// src/lib/api-client.ts
|
|
106
|
-
var agtCliVersion = true ? "0.28.
|
|
106
|
+
var agtCliVersion = true ? "0.28.1317" : "dev";
|
|
107
107
|
var lastConfigHash = null;
|
|
108
108
|
function setConfigHash(hash) {
|
|
109
109
|
lastConfigHash = hash && hash.length > 0 ? hash : null;
|
|
@@ -468,4 +468,4 @@ export {
|
|
|
468
468
|
api,
|
|
469
469
|
getHostId
|
|
470
470
|
};
|
|
471
|
-
//# sourceMappingURL=chunk-
|
|
471
|
+
//# sourceMappingURL=chunk-RNLQGD6H.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-T2BMZYPF.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-RASVBPT3.js.map
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
tripClass,
|
|
71
71
|
writeEtcEnvironment,
|
|
72
72
|
writeProfileDScript
|
|
73
|
-
} from "../chunk-
|
|
73
|
+
} from "../chunk-NJOFLFR4.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-RNLQGD6H.js";
|
|
92
92
|
import {
|
|
93
93
|
BLOCKED_ON_PROMPT_DECISION,
|
|
94
94
|
CHANNEL_SECRET_ENV_KEYS,
|
|
@@ -185,7 +185,7 @@ import {
|
|
|
185
185
|
webFetchBaselineValue,
|
|
186
186
|
webFetchRestartNeeded,
|
|
187
187
|
writeEgressAllowlist
|
|
188
|
-
} from "../chunk-
|
|
188
|
+
} from "../chunk-K65L7VWZ.js";
|
|
189
189
|
import {
|
|
190
190
|
isAgentIdle,
|
|
191
191
|
isStaleForToday,
|
|
@@ -1008,7 +1008,7 @@ function hostStragglerGate(codeName, scan, deps) {
|
|
|
1008
1008
|
const unverified = lingering.filter((l) => l.state === "unverified" && !found.pids.includes(l.pid));
|
|
1009
1009
|
for (const u of unverified) {
|
|
1010
1010
|
deps.log(
|
|
1011
|
-
`[persistent-session] HOST_STRAGGLER_UNVERIFIED code_name=${codeName} pid=${u.pid} argv0=${u.argv0} - a host process signalled earlier is not confirmed gone and its identity cannot be confirmed; not signalled, spawn held (ENG-11871)`
|
|
1011
|
+
`[persistent-session] HOST_STRAGGLER_UNVERIFIED code_name=${codeName} pid=${u.pid} argv0=${u.argv0} - a host process signalled (or, during the login refresh hold, seen) earlier is not confirmed gone and its identity cannot be confirmed; not signalled, spawn held (ENG-11871)`
|
|
1012
1012
|
);
|
|
1013
1013
|
}
|
|
1014
1014
|
const roots = [...found.roots, ...verified.map((l) => ({ pid: l.pid, argv0: l.argv0 }))];
|
|
@@ -1259,7 +1259,18 @@ var SignalledHostPids = class {
|
|
|
1259
1259
|
}
|
|
1260
1260
|
if (list.length > 0) this.byAgent.set(codeName, list);
|
|
1261
1261
|
}
|
|
1262
|
-
/**
|
|
1262
|
+
/**
|
|
1263
|
+
* ENG-12290: record targets the gate SAW but did not signal (the Claude login
|
|
1264
|
+
* refresh hold is active, so nothing is signalled). Kept exactly like a
|
|
1265
|
+
* signalled process, so `survivors` still holds a Docker start beside a
|
|
1266
|
+
* descendant whose root exits between two polls. Once the hold releases the
|
|
1267
|
+
* gate treats it like any lingering identity: re-verified, and signalled only
|
|
1268
|
+
* if it is confirmed to be the same process.
|
|
1269
|
+
*/
|
|
1270
|
+
observe(codeName, targets) {
|
|
1271
|
+
this.remember(codeName, targets);
|
|
1272
|
+
}
|
|
1273
|
+
/** Signalled (or, during the hold, observed) processes not confirmed gone; the confirmed-gone ones are forgotten. */
|
|
1263
1274
|
survivors(codeName) {
|
|
1264
1275
|
const list = this.byAgent.get(codeName);
|
|
1265
1276
|
if (!list) return [];
|
|
@@ -5591,6 +5602,8 @@ var AuthRefreshHoldTracker = class {
|
|
|
5591
5602
|
state = { phase: "idle" };
|
|
5592
5603
|
/** The expiry whose single-start phase already ran, so a stale expiry cannot re-open it. */
|
|
5593
5604
|
singleDoneFor = null;
|
|
5605
|
+
/** ENG-12290: a fresh id per grant, so a holder can tell its grant from a later one. */
|
|
5606
|
+
grantSeq = 0;
|
|
5594
5607
|
/**
|
|
5595
5608
|
* The last expiry actually read (null when the read said there is none). An
|
|
5596
5609
|
* expiry is known hours ahead, so the clock alone can say when its window
|
|
@@ -5629,7 +5642,7 @@ var AuthRefreshHoldTracker = class {
|
|
|
5629
5642
|
if (verdict.reason === "past-cap" && this.singleDoneFor !== expiresAtMs) {
|
|
5630
5643
|
const e = expiresAtMs;
|
|
5631
5644
|
if (this.state.phase !== "single" || this.state.for !== e) {
|
|
5632
|
-
this.state = { phase: "single", for: e, since: nowMs, grantedAt: null, grants: 0 };
|
|
5645
|
+
this.state = { phase: "single", for: e, since: nowMs, grantedAt: null, grants: 0, grantId: null };
|
|
5633
5646
|
this.log(
|
|
5634
5647
|
`[auth-hold] host=${this.host} past-cap expires_at=${new Date(e).toISOString()}: the token was not refreshed in the window; allowing ONE session start to refresh it, every other start held (at most ${SINGLE_START_MAX_MS / 6e4}m) [ENG-12287]`
|
|
5635
5648
|
);
|
|
@@ -5638,6 +5651,7 @@ var AuthRefreshHoldTracker = class {
|
|
|
5638
5651
|
if (nowMs > (single.grantedAt ?? single.since) + SINGLE_START_MAX_MS) {
|
|
5639
5652
|
if (single.grantedAt !== null && single.grants < MAX_SINGLE_START_GRANTS) {
|
|
5640
5653
|
single.grantedAt = null;
|
|
5654
|
+
single.grantId = null;
|
|
5641
5655
|
single.since = nowMs;
|
|
5642
5656
|
this.log(
|
|
5643
5657
|
`[auth-hold] host=${this.host} single start ${single.grants} did not refresh; offering another (${single.grants}/${MAX_SINGLE_START_GRANTS}) [ENG-12287]`
|
|
@@ -5651,6 +5665,7 @@ var AuthRefreshHoldTracker = class {
|
|
|
5651
5665
|
if (opts.claimStart && single.grantedAt === null) {
|
|
5652
5666
|
single.grantedAt = nowMs;
|
|
5653
5667
|
single.grants += 1;
|
|
5668
|
+
single.grantId = ++this.grantSeq;
|
|
5654
5669
|
this.log(`[auth-hold] host=${this.host} single start granted (${single.grants}/${MAX_SINGLE_START_GRANTS}) [ENG-12287]`);
|
|
5655
5670
|
return false;
|
|
5656
5671
|
}
|
|
@@ -5694,11 +5709,26 @@ var AuthRefreshHoldTracker = class {
|
|
|
5694
5709
|
returnStart(nowMs) {
|
|
5695
5710
|
if (this.state.phase !== "single" || this.state.grantedAt === null) return;
|
|
5696
5711
|
this.state.grantedAt = null;
|
|
5712
|
+
this.state.grantId = null;
|
|
5697
5713
|
this.state.grants -= 1;
|
|
5698
5714
|
this.log(
|
|
5699
5715
|
`[auth-hold] host=${this.host} single start returned unspent at ${new Date(nowMs).toISOString()} (the granted session's previous process is not confirmed dead); the next claimer may take it [ENG-12287]`
|
|
5700
5716
|
);
|
|
5701
5717
|
}
|
|
5718
|
+
/** ENG-12290: the id of the single-start grant outstanding right now, or null. */
|
|
5719
|
+
get currentGrantId() {
|
|
5720
|
+
return this.state.phase === "single" ? this.state.grantId : null;
|
|
5721
|
+
}
|
|
5722
|
+
/**
|
|
5723
|
+
* ENG-12290 (CodeRabbit on #7796): is `grantId` still the outstanding grant,
|
|
5724
|
+
* judged against the clock now? A holder that took long enough over its awaits
|
|
5725
|
+
* for the grant to time out and pass to another claimer must not start too:
|
|
5726
|
+
* that would be two starts in the one-refresher phase.
|
|
5727
|
+
*/
|
|
5728
|
+
grantIsCurrent(grantId, nowMs) {
|
|
5729
|
+
this.rejudge(nowMs);
|
|
5730
|
+
return grantId !== null && this.currentGrantId === grantId;
|
|
5731
|
+
}
|
|
5702
5732
|
/** Any phase but idle holds restarts, self-updates, one-shots and /restart flags. */
|
|
5703
5733
|
get engaged() {
|
|
5704
5734
|
return this.state.phase !== "idle";
|
|
@@ -5727,18 +5757,22 @@ function createAuthRefreshHold(deps) {
|
|
|
5727
5757
|
let cached = null;
|
|
5728
5758
|
let inflight = null;
|
|
5729
5759
|
const openRouterBacked = /* @__PURE__ */ new Set();
|
|
5760
|
+
const readExpiry = async () => {
|
|
5761
|
+
const t = now();
|
|
5762
|
+
if (!cached || t - cached.at >= READ_CACHE_MS) {
|
|
5763
|
+
if (!inflight) {
|
|
5764
|
+
inflight = deps.readExpiresAtMs().catch(() => "unreadable").finally(() => {
|
|
5765
|
+
inflight = null;
|
|
5766
|
+
});
|
|
5767
|
+
}
|
|
5768
|
+
cached = { at: t, expiresAtMs: await inflight };
|
|
5769
|
+
}
|
|
5770
|
+
return cached.expiresAtMs;
|
|
5771
|
+
};
|
|
5730
5772
|
return {
|
|
5731
5773
|
async isHeld(opts = {}) {
|
|
5732
|
-
const
|
|
5733
|
-
|
|
5734
|
-
if (!inflight) {
|
|
5735
|
-
inflight = deps.readExpiresAtMs().catch(() => "unreadable").finally(() => {
|
|
5736
|
-
inflight = null;
|
|
5737
|
-
});
|
|
5738
|
-
}
|
|
5739
|
-
cached = { at: t, expiresAtMs: await inflight };
|
|
5740
|
-
}
|
|
5741
|
-
return tracker.observe(cached.expiresAtMs, now(), opts);
|
|
5774
|
+
const expiresAtMs = await readExpiry();
|
|
5775
|
+
return tracker.observe(expiresAtMs, now(), opts);
|
|
5742
5776
|
},
|
|
5743
5777
|
wasHeld: () => tracker.rejudge(now()),
|
|
5744
5778
|
wasInWindow: () => {
|
|
@@ -5750,6 +5784,15 @@ function createAuthRefreshHold(deps) {
|
|
|
5750
5784
|
return tracker.windowOpensWithin(now(), leadMs);
|
|
5751
5785
|
},
|
|
5752
5786
|
returnStart: () => tracker.returnStart(now()),
|
|
5787
|
+
async claimSessionStart(healthyBeforeHold) {
|
|
5788
|
+
const expiresAtMs = await readExpiry();
|
|
5789
|
+
const t = now();
|
|
5790
|
+
if (tracker.observe(expiresAtMs, t, { claimStart: !healthyBeforeHold })) return { claim: "held", grantId: null };
|
|
5791
|
+
if (!healthyBeforeHold && tracker.rejudge(t)) return { claim: "granted", grantId: tracker.currentGrantId };
|
|
5792
|
+
return { claim: "free", grantId: null };
|
|
5793
|
+
},
|
|
5794
|
+
currentGrantId: () => tracker.currentGrantId,
|
|
5795
|
+
grantIsCurrent: (grantId) => tracker.grantIsCurrent(grantId, now()),
|
|
5753
5796
|
heldFor: (codeName) => !openRouterBacked.has(codeName) && tracker.rejudge(now()),
|
|
5754
5797
|
noteSubscriptionBacked: (codeName, backed) => {
|
|
5755
5798
|
if (backed) openRouterBacked.delete(codeName);
|
|
@@ -5765,8 +5808,14 @@ function stragglerSignalDeps(holdActive, real) {
|
|
|
5765
5808
|
killHostStragglers: () => [],
|
|
5766
5809
|
// CodeRabbit on PR #7796: survivors signalled BEFORE the hold still block a
|
|
5767
5810
|
// spawn (a fresh scan can miss a descendant whose root exited), so reads go
|
|
5768
|
-
// through
|
|
5769
|
-
|
|
5811
|
+
// through. ENG-12290: what the gate SEES while held is kept as observed (not
|
|
5812
|
+
// signalled), so a new root plus descendant keeps blocking after the root
|
|
5813
|
+
// exits. A tracker without `observe` records nothing, as before.
|
|
5814
|
+
signalledHostPids: tracker === void 0 ? void 0 : {
|
|
5815
|
+
survivors: (c) => tracker.survivors(c),
|
|
5816
|
+
verify: (t) => tracker.verify(t),
|
|
5817
|
+
remember: (c, targets) => tracker.observe?.(c, targets)
|
|
5818
|
+
},
|
|
5770
5819
|
// CodeRabbit on PR #7796: a held check advances no SIGTERM-to-SIGKILL count.
|
|
5771
5820
|
// The count is frozen, not reset: a streak built BEFORE the hold is kept, so
|
|
5772
5821
|
// the first check after release continues it (SIGKILL if it had already
|
|
@@ -5774,6 +5823,12 @@ function stragglerSignalDeps(holdActive, real) {
|
|
|
5774
5823
|
deferStreak: void 0
|
|
5775
5824
|
};
|
|
5776
5825
|
}
|
|
5826
|
+
function staleGrantReason(currentGrantId) {
|
|
5827
|
+
return currentGrantId === null ? "held: this start's single-start grant expired before it spawned (ENG-12290)" : "held: this start's single-start grant expired and passed to another start (ENG-12290)";
|
|
5828
|
+
}
|
|
5829
|
+
function singleStartLaunchAllowed(hold, grantId) {
|
|
5830
|
+
return !(hold.wasHeld() && !hold.grantIsCurrent(grantId));
|
|
5831
|
+
}
|
|
5777
5832
|
|
|
5778
5833
|
// src/lib/manager/host-auth-refresh-hold.ts
|
|
5779
5834
|
async function readHostExpiresAtMs() {
|
|
@@ -16045,7 +16100,7 @@ function createFileMigrationReportIO(codeName, log2) {
|
|
|
16045
16100
|
};
|
|
16046
16101
|
}
|
|
16047
16102
|
var managerHostPost = async (path, body) => {
|
|
16048
|
-
const { api: api2, ApiError: ApiError3 } = await import("../api-client-
|
|
16103
|
+
const { api: api2, ApiError: ApiError3 } = await import("../api-client-F33REB5P.js");
|
|
16049
16104
|
try {
|
|
16050
16105
|
const json = await api2.post(path, body);
|
|
16051
16106
|
return { status: 200, json };
|
|
@@ -18215,7 +18270,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
|
|
|
18215
18270
|
var dayRolloverInboundHold = /* @__PURE__ */ new Map();
|
|
18216
18271
|
var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
|
|
18217
18272
|
async function channelInboundActivityAgeSecondsFor(codeName) {
|
|
18218
|
-
const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-
|
|
18273
|
+
const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-UP33EKKX.js");
|
|
18219
18274
|
const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
|
|
18220
18275
|
if (newest === null) return null;
|
|
18221
18276
|
return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
|
|
@@ -18591,6 +18646,7 @@ function runPendingForcedUpdate() {
|
|
|
18591
18646
|
`[self-update] failed to persist update-request ack; retrying next poll: ${err.message}`
|
|
18592
18647
|
);
|
|
18593
18648
|
}
|
|
18649
|
+
if (outcome === "updated") restartPromptlyAfterUpgrade();
|
|
18594
18650
|
}).catch((err) => {
|
|
18595
18651
|
log(
|
|
18596
18652
|
`[self-update] forced check failed: ${err.message} \u2014 leaving the request pending for retry.`
|
|
@@ -19126,7 +19182,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
19126
19182
|
var lastVersionCheckAt = 0;
|
|
19127
19183
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
19128
19184
|
var lastResponsivenessProbeAt = 0;
|
|
19129
|
-
var agtCliVersion = true ? "0.28.
|
|
19185
|
+
var agtCliVersion = true ? "0.28.1317" : "dev";
|
|
19130
19186
|
function resolveBrewPath(execFileSync5) {
|
|
19131
19187
|
try {
|
|
19132
19188
|
const out = execFileSync5("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -21262,7 +21318,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
|
|
|
21262
21318
|
if (codeNames.length === 0) return;
|
|
21263
21319
|
void (async () => {
|
|
21264
21320
|
try {
|
|
21265
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
21321
|
+
const { collectDiagnostics } = await import("../persistent-session-T2BMZYPF.js");
|
|
21266
21322
|
await api.post("/host/heartbeat", {
|
|
21267
21323
|
host_id: hostId,
|
|
21268
21324
|
agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
|
|
@@ -21380,7 +21436,9 @@ async function pollCycleInner() {
|
|
|
21380
21436
|
log(`[self-update] runPendingForcedUpdate threw: ${err.message}`);
|
|
21381
21437
|
}
|
|
21382
21438
|
if (!forcedUpdateKicked) {
|
|
21383
|
-
checkAndUpdateCli().
|
|
21439
|
+
checkAndUpdateCli().then((outcome) => {
|
|
21440
|
+
if (outcome === "updated") restartPromptlyAfterUpgrade();
|
|
21441
|
+
}).catch((err) => log(`[self-update] Check failed: ${err.message}`));
|
|
21384
21442
|
}
|
|
21385
21443
|
maybeUpgradeClaudeCode().catch((err) => log(`[claude-code-upgrade] Check failed: ${err.message}`));
|
|
21386
21444
|
diskGuardDeps().then((deps) => maybeRunDiskGuard({ ...deps, nowMs: Date.now() })).catch((err) => log(`[disk-guard] check failed: ${err.message}`));
|
|
@@ -21407,7 +21465,7 @@ async function pollCycleInner() {
|
|
|
21407
21465
|
}
|
|
21408
21466
|
try {
|
|
21409
21467
|
const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
|
|
21410
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
21468
|
+
const { collectDiagnostics } = await import("../persistent-session-T2BMZYPF.js");
|
|
21411
21469
|
const recordedSinceHeartbeat = new Set(spawnOutcomesSinceHeartbeat.drain());
|
|
21412
21470
|
const diagCodeNames = heartbeatDiagnosticsCodeNames(agentState.persistentSessionAgents, recordedSinceHeartbeat);
|
|
21413
21471
|
const heartbeatSpawnOutcomeFor = spawnOutcomeIfRecorded(spawnOutcomeForDiagnostics, recordedSinceHeartbeat);
|
|
@@ -21743,7 +21801,7 @@ async function pollCycleInner() {
|
|
|
21743
21801
|
collectPanelessActivityProbes,
|
|
21744
21802
|
getResponsivenessIntervalMs,
|
|
21745
21803
|
occupancyQualificationClassifications
|
|
21746
|
-
} = await import("../responsiveness-probe-
|
|
21804
|
+
} = await import("../responsiveness-probe-UP33EKKX.js");
|
|
21747
21805
|
const probeIntervalMs = getResponsivenessIntervalMs();
|
|
21748
21806
|
if (now - lastResponsivenessProbeAt > probeIntervalMs) {
|
|
21749
21807
|
const probeCodeNames = [...agentState.persistentSessionAgents];
|
|
@@ -21860,7 +21918,7 @@ async function pollCycleInner() {
|
|
|
21860
21918
|
collectResponsivenessProbes,
|
|
21861
21919
|
livePendingInboundOldestAgeSeconds,
|
|
21862
21920
|
parkPendingInbound
|
|
21863
|
-
} = await import("../responsiveness-probe-
|
|
21921
|
+
} = await import("../responsiveness-probe-UP33EKKX.js");
|
|
21864
21922
|
const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-5PCBGRNY.js");
|
|
21865
21923
|
const wedgeNow = /* @__PURE__ */ new Date();
|
|
21866
21924
|
const liveAgents = agentState.persistentSessionAgents;
|
|
@@ -22149,7 +22207,7 @@ async function pollCycleInner() {
|
|
|
22149
22207
|
}
|
|
22150
22208
|
);
|
|
22151
22209
|
if (!paneFatalTornDown) continue;
|
|
22152
|
-
const { parkPendingInbound } = await import("../responsiveness-probe-
|
|
22210
|
+
const { parkPendingInbound } = await import("../responsiveness-probe-UP33EKKX.js");
|
|
22153
22211
|
const { parked, deadLettered } = parkPendingInbound(codeName, new Date(fatalNowMs));
|
|
22154
22212
|
paneFatalStreak.delete(codeName);
|
|
22155
22213
|
paneFatalRestarts.set(codeName, [...history, fatalNowMs]);
|
|
@@ -22180,7 +22238,7 @@ async function pollCycleInner() {
|
|
|
22180
22238
|
TRANSCRIPT_MOUNT_ESCALATION_REFRESH_MS,
|
|
22181
22239
|
bindSourceEscalations
|
|
22182
22240
|
} = await import("../transcript-mount-health-OHE6IVJV.js");
|
|
22183
|
-
const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-
|
|
22241
|
+
const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-T2BMZYPF.js");
|
|
22184
22242
|
const mountConfig = resolveTranscriptMountConfig();
|
|
22185
22243
|
const liveAgents = agentState.persistentSessionAgents;
|
|
22186
22244
|
for (const tracked of [
|
|
@@ -26410,6 +26468,7 @@ async function ensurePersistentSessionUnchecked(agent, tasks, boardItems, refres
|
|
|
26410
26468
|
}
|
|
26411
26469
|
let stragglerGateRan = false;
|
|
26412
26470
|
let grantedSingleStart = false;
|
|
26471
|
+
let singleStartGrantId = null;
|
|
26413
26472
|
let subscriptionBacked = openRouterForAgentFrom(
|
|
26414
26473
|
refreshData.openrouter ?? null
|
|
26415
26474
|
) ? false : null;
|
|
@@ -26590,16 +26649,18 @@ async function ensurePersistentSessionUnchecked(agent, tasks, boardItems, refres
|
|
|
26590
26649
|
}
|
|
26591
26650
|
}
|
|
26592
26651
|
const healthyBeforeHold = isSessionHealthy(codeName);
|
|
26593
|
-
|
|
26652
|
+
const { claim, grantId: claimedGrantId } = await hostAuthRefreshHold.claimSessionStart(healthyBeforeHold);
|
|
26653
|
+
if (claim === "held") {
|
|
26594
26654
|
if (isSessionHealthy(codeName)) refreshLiveEgressAllowlist(agent, refreshData, modelPolicy);
|
|
26595
26655
|
return authRefreshHeldOutcome(isSessionHealthy(codeName));
|
|
26596
26656
|
}
|
|
26597
|
-
grantedSingleStart =
|
|
26657
|
+
grantedSingleStart = claim === "granted";
|
|
26598
26658
|
if (grantedSingleStart && probeSessionProcess(codeName) !== "dead") {
|
|
26599
26659
|
hostAuthRefreshHold.returnStart();
|
|
26600
26660
|
grantedSingleStart = false;
|
|
26601
26661
|
return authRefreshHeldOutcome(isSessionHealthy(codeName));
|
|
26602
26662
|
}
|
|
26663
|
+
singleStartGrantId = grantedSingleStart ? claimedGrantId : null;
|
|
26603
26664
|
} else if (!anthropicApiKey) {
|
|
26604
26665
|
log(`[persistent-session] Skipping '${codeName}' \u2014 api_key mode but no key returned from exchange`);
|
|
26605
26666
|
return {
|
|
@@ -27035,6 +27096,10 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash21("sha256")
|
|
|
27035
27096
|
closeSessionRunForCode(codeName, "cancelled", "held: the host Claude login refresh window opened before the spawn (ENG-12287)");
|
|
27036
27097
|
return authRefreshHeldOutcome(isSessionHealthy(codeName));
|
|
27037
27098
|
}
|
|
27099
|
+
if (grantedSingleStart && !singleStartLaunchAllowed(hostAuthRefreshHold, singleStartGrantId)) {
|
|
27100
|
+
closeSessionRunForCode(codeName, "cancelled", staleGrantReason(hostAuthRefreshHold.currentGrantId()));
|
|
27101
|
+
return authRefreshHeldOutcome(isSessionHealthy(codeName));
|
|
27102
|
+
}
|
|
27038
27103
|
let spawnCopyFailedNow = false;
|
|
27039
27104
|
const spawnMcpConfigPath = prepareSpawnMcpConfig({
|
|
27040
27105
|
codeName,
|
|
@@ -27054,10 +27119,14 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash21("sha256")
|
|
|
27054
27119
|
}
|
|
27055
27120
|
});
|
|
27056
27121
|
if (!spawnCopyFailedNow) spawnCopyFailures.noteSuccess(codeName);
|
|
27122
|
+
const grantForLaunch = singleStartGrantId;
|
|
27123
|
+
const launchStillAllowed = grantedSingleStart ? () => singleStartLaunchAllowed(hostAuthRefreshHold, grantForLaunch) : void 0;
|
|
27057
27124
|
const lateRefusal = startWithIsolationBackstop(() => startPersistentSession({
|
|
27058
27125
|
codeName,
|
|
27059
27126
|
agentId: agent.agent_id,
|
|
27060
27127
|
isolationReadiness: startReadiness,
|
|
27128
|
+
launchStillAllowed,
|
|
27129
|
+
onLaunchFenced: grantedSingleStart ? () => closeSessionRunForCode(codeName, "cancelled", staleGrantReason(hostAuthRefreshHold.currentGrantId())) : void 0,
|
|
27061
27130
|
projectDir,
|
|
27062
27131
|
mcpConfigPath: spawnMcpConfigPath,
|
|
27063
27132
|
claudeMdPath,
|
|
@@ -27569,7 +27638,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
|
|
|
27569
27638
|
if (!refreshData) return;
|
|
27570
27639
|
const framework = refreshData.agent?.framework ?? agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK;
|
|
27571
27640
|
const hostId = await getHostId();
|
|
27572
|
-
const parkForRestart = await import("../responsiveness-probe-
|
|
27641
|
+
const parkForRestart = await import("../responsiveness-probe-UP33EKKX.js").then(
|
|
27573
27642
|
(m) => m.parkPendingInbound,
|
|
27574
27643
|
(err) => err
|
|
27575
27644
|
);
|
|
@@ -27650,7 +27719,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
|
|
|
27650
27719
|
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}`));
|
|
27651
27720
|
void (async () => {
|
|
27652
27721
|
try {
|
|
27653
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
27722
|
+
const { collectDiagnostics } = await import("../persistent-session-T2BMZYPF.js");
|
|
27654
27723
|
await api.post("/host/heartbeat", {
|
|
27655
27724
|
host_id: hostId,
|
|
27656
27725
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
|
|
@@ -27703,7 +27772,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
|
|
|
27703
27772
|
}
|
|
27704
27773
|
try {
|
|
27705
27774
|
const hostId = await getHostId();
|
|
27706
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
27775
|
+
const { collectDiagnostics } = await import("../persistent-session-T2BMZYPF.js");
|
|
27707
27776
|
await api.post("/host/heartbeat", {
|
|
27708
27777
|
host_id: hostId,
|
|
27709
27778
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
|
|
@@ -28579,7 +28648,7 @@ async function processClaudePairSessions(agents) {
|
|
|
28579
28648
|
snapshotPairConfig,
|
|
28580
28649
|
// ENG-11659: result -> report body + the manager.log line that records it.
|
|
28581
28650
|
planPairStartReport
|
|
28582
|
-
} = await import("../claude-pair-runtime-
|
|
28651
|
+
} = await import("../claude-pair-runtime-RASVBPT3.js");
|
|
28583
28652
|
const { resetClaudeSignin, describeSigninResetForLog, describeSigninResetFailure } = await import("../claude-signin-reset-6IJMMVYG.js");
|
|
28584
28653
|
for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
|
|
28585
28654
|
log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
|
|
@@ -29485,18 +29554,34 @@ async function reportSelfUpdateRestarts() {
|
|
|
29485
29554
|
const deadline = new Promise((resolve2) => setTimeout(resolve2, 3e3));
|
|
29486
29555
|
await Promise.race([posts, deadline]);
|
|
29487
29556
|
}
|
|
29557
|
+
function restartManagerForUpgrade() {
|
|
29558
|
+
if (upgradeRestartInitiated) return;
|
|
29559
|
+
upgradeRestartInitiated = true;
|
|
29560
|
+
log(`[self-update] Restarting manager to load upgraded binary (${pendingUpgradeVersion ?? "unknown version"})`);
|
|
29561
|
+
void reportSelfUpdateRestarts().catch((err) => log(`[self-update] restart-event audit failed: ${err.message}`)).finally(() => {
|
|
29562
|
+
void stopPolling({ forcedExitCode: SUPERVISOR_RESTART_EXIT_CODE }).then(() => {
|
|
29563
|
+
process.exit(SUPERVISOR_RESTART_EXIT_CODE);
|
|
29564
|
+
});
|
|
29565
|
+
});
|
|
29566
|
+
}
|
|
29567
|
+
function upgradeRestartTiming(s) {
|
|
29568
|
+
if (!s.restartPending) return "nothing";
|
|
29569
|
+
return s.cycleInFlight ? "after-cycle" : "restart-now";
|
|
29570
|
+
}
|
|
29571
|
+
function restartPromptlyAfterUpgrade() {
|
|
29572
|
+
if (!running) return;
|
|
29573
|
+
const timing = upgradeRestartTiming({ restartPending: restartAfterUpgrade, cycleInFlight: pollCycleGuard.isRunning() });
|
|
29574
|
+
if (timing !== "restart-now") return;
|
|
29575
|
+
if (pollTimer) {
|
|
29576
|
+
clearTimeout(pollTimer);
|
|
29577
|
+
pollTimer = null;
|
|
29578
|
+
}
|
|
29579
|
+
log("[self-update] install complete and no poll cycle running: restarting now, not at the next poll timer [ENG-12290]");
|
|
29580
|
+
restartManagerForUpgrade();
|
|
29581
|
+
}
|
|
29488
29582
|
function scheduleNext() {
|
|
29489
29583
|
if (!running || !config) return;
|
|
29490
|
-
const restartNow =
|
|
29491
|
-
if (upgradeRestartInitiated) return;
|
|
29492
|
-
upgradeRestartInitiated = true;
|
|
29493
|
-
log(`[self-update] Restarting manager to load upgraded binary (${pendingUpgradeVersion ?? "unknown version"})`);
|
|
29494
|
-
void reportSelfUpdateRestarts().catch((err) => log(`[self-update] restart-event audit failed: ${err.message}`)).finally(() => {
|
|
29495
|
-
void stopPolling({ forcedExitCode: SUPERVISOR_RESTART_EXIT_CODE }).then(() => {
|
|
29496
|
-
process.exit(SUPERVISOR_RESTART_EXIT_CODE);
|
|
29497
|
-
});
|
|
29498
|
-
});
|
|
29499
|
-
};
|
|
29584
|
+
const restartNow = restartManagerForUpgrade;
|
|
29500
29585
|
if (restartAfterUpgrade) {
|
|
29501
29586
|
restartNow();
|
|
29502
29587
|
return;
|
|
@@ -30106,6 +30191,7 @@ export {
|
|
|
30106
30191
|
stuckChannelSyncs,
|
|
30107
30192
|
stuckRealtimeRebinds,
|
|
30108
30193
|
supersededRuntimeImageIds,
|
|
30194
|
+
upgradeRestartTiming,
|
|
30109
30195
|
verifiedChannelCredentials,
|
|
30110
30196
|
writeManagedSettings
|
|
30111
30197
|
};
|