@integrity-labs/agt-cli 0.28.1307 → 0.28.1309

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.
Files changed (35) hide show
  1. package/dist/{api-client-HAN3QU6H.js → api-client-OU7NANHC.js} +3 -3
  2. package/dist/bin/agt.js +7 -7
  3. package/dist/{chunk-IA3IT3JM.js → chunk-GODP7VNT.js} +5 -5
  4. package/dist/{chunk-I6HGFJNX.js → chunk-JZOA4A3J.js} +2 -2
  5. package/dist/{chunk-VOYD7FPP.js → chunk-LZZNWEAC.js} +3 -3
  6. package/dist/{chunk-GLX5CD6S.js → chunk-NXTNYNNV.js} +2 -2
  7. package/dist/{chunk-CQQYZUC5.js → chunk-VSJUMNQ5.js} +108 -13
  8. package/dist/chunk-VSJUMNQ5.js.map +1 -0
  9. package/dist/{chunk-4KSUIAI4.js → chunk-WW2CTOEO.js} +9 -73
  10. package/dist/chunk-WW2CTOEO.js.map +1 -0
  11. package/dist/{claude-code-updater-KA4VMUWK.js → claude-code-updater-OU4AEM5Y.js} +3 -3
  12. package/dist/{claude-pair-runtime-AAGIQSUI.js → claude-pair-runtime-H7A7ZOEW.js} +3 -3
  13. package/dist/lib/manager-worker.js +156 -27
  14. package/dist/lib/manager-worker.js.map +1 -1
  15. package/dist/mcp/direct-chat-channel.js +8 -72
  16. package/dist/mcp/index.js +18 -73
  17. package/dist/mcp/origami.js +8 -72
  18. package/dist/mcp/slack-channel.js +111 -180
  19. package/dist/mcp/telegram-channel.js +8 -72
  20. package/dist/{persistent-session-FJ4Y7XIB.js → persistent-session-OUCTECWP.js} +18 -4
  21. package/dist/{responsiveness-probe-2MCC7NOE.js → responsiveness-probe-SC72APRB.js} +4 -4
  22. package/dist/{session-auth-dead-MDZWPSED.js → session-auth-dead-MQR2SLW5.js} +3 -3
  23. package/package.json +1 -1
  24. package/dist/chunk-4KSUIAI4.js.map +0 -1
  25. package/dist/chunk-CQQYZUC5.js.map +0 -1
  26. /package/dist/{api-client-HAN3QU6H.js.map → api-client-OU7NANHC.js.map} +0 -0
  27. /package/dist/{chunk-IA3IT3JM.js.map → chunk-GODP7VNT.js.map} +0 -0
  28. /package/dist/{chunk-I6HGFJNX.js.map → chunk-JZOA4A3J.js.map} +0 -0
  29. /package/dist/{chunk-VOYD7FPP.js.map → chunk-LZZNWEAC.js.map} +0 -0
  30. /package/dist/{chunk-GLX5CD6S.js.map → chunk-NXTNYNNV.js.map} +0 -0
  31. /package/dist/{claude-code-updater-KA4VMUWK.js.map → claude-code-updater-OU4AEM5Y.js.map} +0 -0
  32. /package/dist/{claude-pair-runtime-AAGIQSUI.js.map → claude-pair-runtime-H7A7ZOEW.js.map} +0 -0
  33. /package/dist/{persistent-session-FJ4Y7XIB.js.map → persistent-session-OUCTECWP.js.map} +0 -0
  34. /package/dist/{responsiveness-probe-2MCC7NOE.js.map → responsiveness-probe-SC72APRB.js.map} +0 -0
  35. /package/dist/{session-auth-dead-MDZWPSED.js.map → session-auth-dead-MQR2SLW5.js.map} +0 -0
@@ -13,9 +13,9 @@ import {
13
13
  probeClaudeInstalls,
14
14
  readsAsNativeInstall,
15
15
  shouldRunClaudeCodeUpdater
16
- } from "./chunk-I6HGFJNX.js";
16
+ } from "./chunk-JZOA4A3J.js";
17
17
  import "./chunk-XWVM4KPK.js";
18
- import "./chunk-4KSUIAI4.js";
18
+ import "./chunk-WW2CTOEO.js";
19
19
  import "./chunk-AIUIMEUS.js";
20
20
  import "./chunk-DGUM43GV.js";
21
21
  export {
@@ -34,4 +34,4 @@ export {
34
34
  readsAsNativeInstall,
35
35
  shouldRunClaudeCodeUpdater
36
36
  };
37
- //# sourceMappingURL=claude-code-updater-KA4VMUWK.js.map
37
+ //# sourceMappingURL=claude-code-updater-OU4AEM5Y.js.map
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  redactPaneFrame,
12
12
  sanitizeTerminalFrame
13
- } from "./chunk-4KSUIAI4.js";
13
+ } from "./chunk-WW2CTOEO.js";
14
14
  import {
15
15
  CLAUDE_CONFIG_DIR_ENV,
16
16
  claudeConfigDirFor,
@@ -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-FJ4Y7XIB.js");
326
+ const { resolveClaudeBinary } = await import("./persistent-session-OUCTECWP.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-AAGIQSUI.js.map
841
+ //# sourceMappingURL=claude-pair-runtime-H7A7ZOEW.js.map
@@ -70,7 +70,7 @@ import {
70
70
  tripClass,
71
71
  writeEtcEnvironment,
72
72
  writeProfileDScript
73
- } from "../chunk-IA3IT3JM.js";
73
+ } from "../chunk-GODP7VNT.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-VOYD7FPP.js";
91
+ } from "../chunk-LZZNWEAC.js";
92
92
  import {
93
93
  BLOCKED_ON_PROMPT_DECISION,
94
94
  CHANNEL_SECRET_ENV_KEYS,
@@ -105,6 +105,7 @@ import {
105
105
  creditWatchdogGiveUpCount,
106
106
  creditWatchdogUnclaimedDialogCount,
107
107
  denyWebFetchForToolsContent,
108
+ dockerStartReadinessAsync,
108
109
  effectiveIsolationMode,
109
110
  egressMode,
110
111
  execFilePromiseLong,
@@ -184,7 +185,7 @@ import {
184
185
  webFetchBaselineValue,
185
186
  webFetchRestartNeeded,
186
187
  writeEgressAllowlist
187
- } from "../chunk-CQQYZUC5.js";
188
+ } from "../chunk-VSJUMNQ5.js";
188
189
  import {
189
190
  isAgentIdle,
190
191
  isStaleForToday,
@@ -196,7 +197,7 @@ import {
196
197
  subagentActivityAgeSeconds,
197
198
  subagentTranscriptDir,
198
199
  transcriptActivityAgeSeconds
199
- } from "../chunk-GLX5CD6S.js";
200
+ } from "../chunk-NXTNYNNV.js";
200
201
  import {
201
202
  classifyUnanswerablePane,
202
203
  focusedConfirmDialogBlock,
@@ -222,7 +223,7 @@ import {
222
223
  runSafeCleanup,
223
224
  tightestDiskStat,
224
225
  withPackageCacheLock
225
- } from "../chunk-I6HGFJNX.js";
226
+ } from "../chunk-JZOA4A3J.js";
226
227
  import {
227
228
  parsePsRows,
228
229
  reapOrphanChannelMcps
@@ -351,7 +352,7 @@ import {
351
352
  stabiliseResetInstant,
352
353
  sumTranscriptUsageInWindow,
353
354
  summarizeTranscriptActivity
354
- } from "../chunk-4KSUIAI4.js";
355
+ } from "../chunk-WW2CTOEO.js";
355
356
  import {
356
357
  CLAUDE_CONFIG_DIR_ENV,
357
358
  claudeConfigDirFor,
@@ -13022,7 +13023,7 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
13022
13023
  // ENG-10583: manager-created from a scheduled run, so there is no
13023
13024
  // conversation behind these cards. Without the flag the add path
13024
13025
  // attached each one to whatever inbound thread was fresh.
13025
- add: planItems.map((item) => ({ ...item, no_channel_origin: true }))
13026
+ add: planItemsAddPayload(planItems)
13026
13027
  });
13027
13028
  log(`[claude-scheduler] Plan items posted for '${codeName}' (${planItems.length} items)`);
13028
13029
  }
@@ -13055,6 +13056,12 @@ async function processClaudeTaskResult(codeName, agentId, templateId, rawOutput,
13055
13056
  return { ok: false, error: errMsg };
13056
13057
  }
13057
13058
  }
13059
+ function planItemsAddPayload(items) {
13060
+ return items.map((item) => {
13061
+ const { report_to_nobody: _dropped, ...rest } = item;
13062
+ return { ...rest, no_channel_origin: true };
13063
+ });
13064
+ }
13058
13065
 
13059
13066
  // src/lib/manager/scheduler/execution.ts
13060
13067
  import { createHash as createHash17 } from "crypto";
@@ -16018,7 +16025,7 @@ function createFileMigrationReportIO(codeName, log2) {
16018
16025
  };
16019
16026
  }
16020
16027
  var managerHostPost = async (path, body) => {
16021
- const { api: api2, ApiError: ApiError3 } = await import("../api-client-HAN3QU6H.js");
16028
+ const { api: api2, ApiError: ApiError3 } = await import("../api-client-OU7NANHC.js");
16022
16029
  try {
16023
16030
  const json = await api2.post(path, body);
16024
16031
  return { status: 200, json };
@@ -16660,6 +16667,81 @@ var PersistentSessionStuckTracker = class {
16660
16667
  }
16661
16668
  };
16662
16669
 
16670
+ // src/lib/isolation-fail-closed.ts
16671
+ function isolationSpawnRefusal(mode, readiness) {
16672
+ if (mode !== "docker") return null;
16673
+ const r = readiness();
16674
+ return r.ok ? null : { reason: r.reason };
16675
+ }
16676
+ var ISOLATION_REFUSAL_ALERT_REFRESH_MS = 10 * 6e4;
16677
+ var ISOLATION_REFUSAL_REAPER = "isolation-fail-closed";
16678
+ var IsolationRefusalAlerts = class {
16679
+ lastSent = /* @__PURE__ */ new Map();
16680
+ /**
16681
+ * Which code name each refused agent id has (CodeRabbit on #7695): the realtime
16682
+ * unassign callback knows only the agent id, so without this it cannot find the
16683
+ * window to clear, and a reassignment inside it would stay silent.
16684
+ */
16685
+ codeByAgent = /* @__PURE__ */ new Map();
16686
+ /** Record that `agentId` is refused as `codeName`, so an id-only teardown can clear it. */
16687
+ remember(agentId, codeName) {
16688
+ if (agentId && codeName) this.codeByAgent.set(agentId, codeName);
16689
+ }
16690
+ /** True when the alert for this agent should be sent (first refusal, or a refresh is due). */
16691
+ shouldSend(codeName, nowMs) {
16692
+ const last = this.lastSent.get(codeName);
16693
+ if (last !== void 0 && nowMs - last < ISOLATION_REFUSAL_ALERT_REFRESH_MS) return false;
16694
+ this.lastSent.set(codeName, nowMs);
16695
+ return true;
16696
+ }
16697
+ /**
16698
+ * The send for this window FAILED: forget it, so the next refusal sends again rather
16699
+ * than waiting out a refresh window for an alert that never arrived.
16700
+ */
16701
+ release(codeName) {
16702
+ this.lastSent.delete(codeName);
16703
+ }
16704
+ /** The agent spawned (or left the host): stop re-sending, so the alert can close. */
16705
+ clear(codeName) {
16706
+ this.lastSent.delete(codeName);
16707
+ }
16708
+ /** The agent left the host, known only by its id (the realtime unassign path). */
16709
+ clearAgent(agentId) {
16710
+ const codeName = this.codeByAgent.get(agentId);
16711
+ this.codeByAgent.delete(agentId);
16712
+ if (codeName) this.lastSent.delete(codeName);
16713
+ }
16714
+ /** Test seam. */
16715
+ isOpen(codeName) {
16716
+ return this.lastSent.has(codeName);
16717
+ }
16718
+ };
16719
+ async function sendRefusalAlertIfDue(alerts, codeName, nowMs, send2, agentId) {
16720
+ if (agentId) alerts.remember(agentId, codeName);
16721
+ if (!alerts.shouldSend(codeName, nowMs)) return "skipped";
16722
+ let delivered = false;
16723
+ try {
16724
+ delivered = await send2();
16725
+ } catch {
16726
+ delivered = false;
16727
+ }
16728
+ if (!delivered) alerts.release(codeName);
16729
+ return delivered ? "delivered" : "failed";
16730
+ }
16731
+ function isolationRefusalMessage(codeName, hostName, reason) {
16732
+ return `Refused to start agent '${codeName}' on host '${hostName}': AGT_ISOLATION=docker but the Docker runtime is unusable (reason=${reason}). Agents on an isolated host are never started unisolated (ENG-12183). Fix Docker or the agt-runtime image; the manager re-checks every minute and starts the agent once the runtime is usable. Agents already running in containers are unaffected.`;
16733
+ }
16734
+ function startWithIsolationBackstop(start, onRefused) {
16735
+ try {
16736
+ start();
16737
+ return void 0;
16738
+ } catch (err) {
16739
+ const e = err;
16740
+ if (e && e.name === "IsolationUnavailableError" && typeof e.reason === "string") return onRefused(e.reason);
16741
+ throw err;
16742
+ }
16743
+ }
16744
+
16663
16745
  // src/lib/heartbeat-diagnostics-code-names.ts
16664
16746
  function heartbeatDiagnosticsCodeNames(persistentSessionAgents, spawnOutcomeCodeNames) {
16665
16747
  const out = /* @__PURE__ */ new Set();
@@ -17362,10 +17444,12 @@ async function reportReaperEvent(agentId, reaper, action, reason) {
17362
17444
  action,
17363
17445
  reason
17364
17446
  });
17447
+ return true;
17365
17448
  } catch (err) {
17366
17449
  log(
17367
17450
  `[${reaper}] failed to report reaper-event (ENG-6184): ${err.message} \u2014 local reap still proceeded; the alert may be missed`
17368
17451
  );
17452
+ return false;
17369
17453
  }
17370
17454
  }
17371
17455
  var dangerousRmBackstop = new DangerousRmBackstop();
@@ -18111,7 +18195,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
18111
18195
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
18112
18196
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
18113
18197
  async function channelInboundActivityAgeSecondsFor(codeName) {
18114
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-2MCC7NOE.js");
18198
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-SC72APRB.js");
18115
18199
  const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
18116
18200
  if (newest === null) return null;
18117
18201
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -18508,6 +18592,7 @@ function readSpawnViewMcpConfig(codeName, projectDir) {
18508
18592
  }
18509
18593
  var sessionsSpawnedByThisProcess = /* @__PURE__ */ new Set();
18510
18594
  var spawnCopyFailures = new SpawnCopyFailureTracker();
18595
+ var isolationRefusalAlerts = new IsolationRefusalAlerts();
18511
18596
  function reportSpawnCopyFailure(codeName, f) {
18512
18597
  const agentId = agentState.codeNameToAgentId.get(codeName);
18513
18598
  if (!agentId) return;
@@ -18955,9 +19040,15 @@ function resolveAgentFramework(codeName) {
18955
19040
  const frameworkId = agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK;
18956
19041
  return getFramework(frameworkId);
18957
19042
  }
19043
+ function handleRealtimeUnassign(agentId) {
19044
+ log(`[realtime] Agent ${agentId} unassigned`);
19045
+ clearAgentCaches(agentId, "");
19046
+ }
18958
19047
  function clearAgentCaches(agentId, codeName) {
18959
19048
  const channelCacheMutated = clearAgentState(agentId, codeName);
18960
19049
  agentChannelTokens.delete(codeName);
19050
+ if (codeName) isolationRefusalAlerts.clear(codeName);
19051
+ isolationRefusalAlerts.clearAgent(agentId);
18961
19052
  directChatChainStart.delete(agentId);
18962
19053
  agentStatusLedger.forget(agentId);
18963
19054
  blockedPromptCost.forget(codeName);
@@ -19015,7 +19106,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
19015
19106
  var lastVersionCheckAt = 0;
19016
19107
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
19017
19108
  var lastResponsivenessProbeAt = 0;
19018
- var agtCliVersion = true ? "0.28.1307" : "dev";
19109
+ var agtCliVersion = true ? "0.28.1309" : "dev";
19019
19110
  function resolveBrewPath(execFileSync5) {
19020
19111
  try {
19021
19112
  const out = execFileSync5("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -21151,7 +21242,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
21151
21242
  if (codeNames.length === 0) return;
21152
21243
  void (async () => {
21153
21244
  try {
21154
- const { collectDiagnostics } = await import("../persistent-session-FJ4Y7XIB.js");
21245
+ const { collectDiagnostics } = await import("../persistent-session-OUCTECWP.js");
21155
21246
  await api.post("/host/heartbeat", {
21156
21247
  host_id: hostId,
21157
21248
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -21296,7 +21387,7 @@ async function pollCycleInner() {
21296
21387
  }
21297
21388
  try {
21298
21389
  const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
21299
- const { collectDiagnostics } = await import("../persistent-session-FJ4Y7XIB.js");
21390
+ const { collectDiagnostics } = await import("../persistent-session-OUCTECWP.js");
21300
21391
  const recordedSinceHeartbeat = new Set(spawnOutcomesSinceHeartbeat.drain());
21301
21392
  const diagCodeNames = heartbeatDiagnosticsCodeNames(agentState.persistentSessionAgents, recordedSinceHeartbeat);
21302
21393
  const heartbeatSpawnOutcomeFor = spawnOutcomeIfRecorded(spawnOutcomeForDiagnostics, recordedSinceHeartbeat);
@@ -21597,7 +21688,7 @@ async function pollCycleInner() {
21597
21688
  }
21598
21689
  try {
21599
21690
  const desiredClaudeCodeVersion = hbResp?.desired_claude_code_version?.trim();
21600
- const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-KA4VMUWK.js");
21691
+ const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-OU4AEM5Y.js");
21601
21692
  const securityFloor = currentSecurityFloor();
21602
21693
  claudeUpdaterInFlight = true;
21603
21694
  if (desiredClaudeCodeVersion && (claudePairLoop.busy || claudePairingInProgress())) {
@@ -21632,7 +21723,7 @@ async function pollCycleInner() {
21632
21723
  collectPanelessActivityProbes,
21633
21724
  getResponsivenessIntervalMs,
21634
21725
  occupancyQualificationClassifications
21635
- } = await import("../responsiveness-probe-2MCC7NOE.js");
21726
+ } = await import("../responsiveness-probe-SC72APRB.js");
21636
21727
  const probeIntervalMs = getResponsivenessIntervalMs();
21637
21728
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
21638
21729
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -21749,7 +21840,7 @@ async function pollCycleInner() {
21749
21840
  collectResponsivenessProbes,
21750
21841
  livePendingInboundOldestAgeSeconds,
21751
21842
  parkPendingInbound
21752
- } = await import("../responsiveness-probe-2MCC7NOE.js");
21843
+ } = await import("../responsiveness-probe-SC72APRB.js");
21753
21844
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-5PCBGRNY.js");
21754
21845
  const wedgeNow = /* @__PURE__ */ new Date();
21755
21846
  const liveAgents = agentState.persistentSessionAgents;
@@ -22038,7 +22129,7 @@ async function pollCycleInner() {
22038
22129
  }
22039
22130
  );
22040
22131
  if (!paneFatalTornDown) continue;
22041
- const { parkPendingInbound } = await import("../responsiveness-probe-2MCC7NOE.js");
22132
+ const { parkPendingInbound } = await import("../responsiveness-probe-SC72APRB.js");
22042
22133
  const { parked, deadLettered } = parkPendingInbound(codeName, new Date(fatalNowMs));
22043
22134
  paneFatalStreak.delete(codeName);
22044
22135
  paneFatalRestarts.set(codeName, [...history, fatalNowMs]);
@@ -22069,7 +22160,7 @@ async function pollCycleInner() {
22069
22160
  TRANSCRIPT_MOUNT_ESCALATION_REFRESH_MS,
22070
22161
  bindSourceEscalations
22071
22162
  } = await import("../transcript-mount-health-OHE6IVJV.js");
22072
- const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-FJ4Y7XIB.js");
22163
+ const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-OUCTECWP.js");
22073
22164
  const mountConfig = resolveTranscriptMountConfig();
22074
22165
  const liveAgents = agentState.persistentSessionAgents;
22075
22166
  for (const tracked of [
@@ -22235,7 +22326,7 @@ async function pollCycleInner() {
22235
22326
  }
22236
22327
  try {
22237
22328
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-VR5QGP3J.js");
22238
- const { probeSessionAuth } = await import("../session-auth-dead-MDZWPSED.js");
22329
+ const { probeSessionAuth } = await import("../session-auth-dead-MQR2SLW5.js");
22239
22330
  const observations = [];
22240
22331
  const pendingCacheCommits = [];
22241
22332
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -26845,6 +26936,25 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash21("sha256")
26845
26936
  } catch (err) {
26846
26937
  log(`[persistent-session] Failed to provision PreCompact hook for '${codeName}': ${err.message}`);
26847
26938
  }
26939
+ const isoIntent = isolationMode(codeName);
26940
+ const startReadiness = isoIntent === "docker" ? await dockerStartReadinessAsync() : void 0;
26941
+ const isoRefusal = isolationSpawnRefusal(isoIntent, () => startReadiness ?? { ok: true });
26942
+ if (isoRefusal) {
26943
+ const message = isolationRefusalMessage(codeName, hostname2(), isoRefusal.reason);
26944
+ log(`[persistent-session] Skipping '${codeName}' (ENG-12183) - ${message}`);
26945
+ void sendRefusalAlertIfDue(
26946
+ isolationRefusalAlerts,
26947
+ codeName,
26948
+ Date.now(),
26949
+ () => reportReaperEvent(agent.agent_id, ISOLATION_REFUSAL_REAPER, "blocked", message),
26950
+ agent.agent_id
26951
+ );
26952
+ return {
26953
+ decision: "skipped-isolation-unavailable",
26954
+ spawnAttempted: false,
26955
+ sessionHealthyAfter: isSessionHealthy(codeName)
26956
+ };
26957
+ }
26848
26958
  const sessionRunResult = await startRun({
26849
26959
  agent_id: agent.agent_id,
26850
26960
  source_type: "system",
@@ -26922,9 +27032,10 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash21("sha256")
26922
27032
  }
26923
27033
  });
26924
27034
  if (!spawnCopyFailedNow) spawnCopyFailures.noteSuccess(codeName);
26925
- startPersistentSession({
27035
+ const lateRefusal = startWithIsolationBackstop(() => startPersistentSession({
26926
27036
  codeName,
26927
27037
  agentId: agent.agent_id,
27038
+ isolationReadiness: startReadiness,
26928
27039
  projectDir,
26929
27040
  mcpConfigPath: spawnMcpConfigPath,
26930
27041
  claudeMdPath,
@@ -27004,7 +27115,25 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash21("sha256")
27004
27115
  // so the KEYS/VALUES can't diverge from what would have been persisted.
27005
27116
  channelSpawnSecrets: shouldInjectChannelSecrets(agent.agent_id) ? collectChannelSpawnSecrets(channelConfigs) : void 0,
27006
27117
  log
27118
+ }), (reason) => {
27119
+ closeSessionRunForCode(codeName, "failed", "isolation unavailable at start");
27120
+ const message = isolationRefusalMessage(codeName, hostname2(), reason);
27121
+ log(`[persistent-session] Skipping '${codeName}' (ENG-12183, at start) - ${message}`);
27122
+ void sendRefusalAlertIfDue(
27123
+ isolationRefusalAlerts,
27124
+ codeName,
27125
+ Date.now(),
27126
+ () => reportReaperEvent(agent.agent_id, ISOLATION_REFUSAL_REAPER, "blocked", message),
27127
+ agent.agent_id
27128
+ );
27129
+ return {
27130
+ decision: "skipped-isolation-unavailable",
27131
+ spawnAttempted: false,
27132
+ sessionHealthyAfter: isSessionHealthy(codeName)
27133
+ };
27007
27134
  });
27135
+ if (lateRefusal) return lateRefusal;
27136
+ isolationRefusalAlerts.clear(codeName);
27008
27137
  agentState.persistentSessionAgents.add(codeName);
27009
27138
  claudeAuthTupleBySession.set(codeName, currentAuthTuple);
27010
27139
  recordSessionPolicyBaseline(codeName, currentPolicyModel, currentPolicyId);
@@ -27418,7 +27547,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
27418
27547
  if (!refreshData) return;
27419
27548
  const framework = refreshData.agent?.framework ?? agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK;
27420
27549
  const hostId = await getHostId();
27421
- const parkForRestart = await import("../responsiveness-probe-2MCC7NOE.js").then(
27550
+ const parkForRestart = await import("../responsiveness-probe-SC72APRB.js").then(
27422
27551
  (m) => m.parkPendingInbound,
27423
27552
  (err) => err
27424
27553
  );
@@ -27499,7 +27628,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
27499
27628
  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}`));
27500
27629
  void (async () => {
27501
27630
  try {
27502
- const { collectDiagnostics } = await import("../persistent-session-FJ4Y7XIB.js");
27631
+ const { collectDiagnostics } = await import("../persistent-session-OUCTECWP.js");
27503
27632
  await api.post("/host/heartbeat", {
27504
27633
  host_id: hostId,
27505
27634
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -27552,7 +27681,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
27552
27681
  }
27553
27682
  try {
27554
27683
  const hostId = await getHostId();
27555
- const { collectDiagnostics } = await import("../persistent-session-FJ4Y7XIB.js");
27684
+ const { collectDiagnostics } = await import("../persistent-session-OUCTECWP.js");
27556
27685
  await api.post("/host/heartbeat", {
27557
27686
  host_id: hostId,
27558
27687
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -27599,10 +27728,7 @@ function ensureRealtimeAssignStarted(agentStates) {
27599
27728
  triggerEarlyPoll(`agent ${payload.agent_id} assigned to this host`, payload.agent_id);
27600
27729
  markAgentForFreshMemorySync(payload.agent_id);
27601
27730
  },
27602
- onUnassign: (payload) => {
27603
- log(`[realtime] Agent ${payload.agent_id} unassigned`);
27604
- clearAgentCaches(payload.agent_id, "");
27605
- },
27731
+ onUnassign: (payload) => handleRealtimeUnassign(payload.agent_id),
27606
27732
  log
27607
27733
  });
27608
27734
  realtimeAssignStarted = true;
@@ -28431,7 +28557,7 @@ async function processClaudePairSessions(agents) {
28431
28557
  snapshotPairConfig,
28432
28558
  // ENG-11659: result -> report body + the manager.log line that records it.
28433
28559
  planPairStartReport
28434
- } = await import("../claude-pair-runtime-AAGIQSUI.js");
28560
+ } = await import("../claude-pair-runtime-H7A7ZOEW.js");
28435
28561
  const { resetClaudeSignin, describeSigninResetForLog, describeSigninResetFailure } = await import("../claude-signin-reset-6IJMMVYG.js");
28436
28562
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
28437
28563
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
@@ -29896,6 +30022,7 @@ export {
29896
30022
  claudeManagedSettingsPath,
29897
30023
  claudePairLoopArmed,
29898
30024
  claudePairingInProgress,
30025
+ clearAgentCaches,
29899
30026
  coverageOf,
29900
30027
  createManagedPruneLedger,
29901
30028
  createManagedToolkitReader,
@@ -29912,6 +30039,7 @@ export {
29912
30039
  forgetChannelSyncState,
29913
30040
  forgetRealtimeRebindState,
29914
30041
  gateTierTableWithheld,
30042
+ handleRealtimeUnassign,
29915
30043
  hasRevokedResiduals,
29916
30044
  holdRealtimeRebindInFlight,
29917
30045
  inboundHoldMinutes,
@@ -29919,6 +30047,7 @@ export {
29919
30047
  integrationRenderPending,
29920
30048
  isOlderSemverTuple,
29921
30049
  isPrereleaseVersion,
30050
+ isolationRefusalAlerts,
29922
30051
  jitteredRealtimeRebindBackoffMs,
29923
30052
  managedSettingsOwnership,
29924
30053
  markAgentForFreshMemorySync,