chatroom-cli 1.55.1 → 1.55.2

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/index.js CHANGED
@@ -85690,7 +85690,16 @@ function classifyResumeStormReason(logLines) {
85690
85690
  }
85691
85691
  return "unknown";
85692
85692
  }
85693
- var CLASSIFICATION_RULES;
85693
+ function isPermanentHarnessFailure(logLines) {
85694
+ return PERMANENT_FAILURE_REASONS.has(classifyResumeStormReason(logLines));
85695
+ }
85696
+ function formatPermanentHarnessFailureMessage(logLines) {
85697
+ const reason = classifyResumeStormReason(logLines);
85698
+ const blob = logLines.join(`
85699
+ `).trim();
85700
+ return blob ? `Permanent harness error (${reason}): ${blob.slice(-500)}` : `Permanent harness error (${reason})`;
85701
+ }
85702
+ var CLASSIFICATION_RULES, PERMANENT_FAILURE_REASONS;
85694
85703
  var init_classify_resume_storm_reason = __esm(() => {
85695
85704
  CLASSIFICATION_RULES = [
85696
85705
  {
@@ -85720,6 +85729,10 @@ var init_classify_resume_storm_reason = __esm(() => {
85720
85729
  reason: "config_error",
85721
85730
  patterns: [
85722
85731
  /model not found/i,
85732
+ /model_not_supported/i,
85733
+ /model is not supported/i,
85734
+ /requested model is not supported/i,
85735
+ /unsupported model/i,
85723
85736
  /invalid model/i,
85724
85737
  /missing model/i,
85725
85738
  /config(uration)? error/i,
@@ -85728,6 +85741,10 @@ var init_classify_resume_storm_reason = __esm(() => {
85728
85741
  ]
85729
85742
  }
85730
85743
  ];
85744
+ PERMANENT_FAILURE_REASONS = new Set([
85745
+ "auth_error",
85746
+ "config_error"
85747
+ ]);
85731
85748
  });
85732
85749
 
85733
85750
  // src/domain/agent-lifecycle/policies/abort-resume-storm.ts
@@ -85771,7 +85788,7 @@ async function handleTurnCompleted(deps, input, slot) {
85771
85788
  if (await tryAbortResumeStorm(deps, input, slot)) {
85772
85789
  return { outcome: "storm_aborted" };
85773
85790
  }
85774
- if (input.supportsSessionResume) {
85791
+ if (input.supportsSessionResume && input.wantResume) {
85775
85792
  if (slot) {
85776
85793
  slot.resumeInFlight = true;
85777
85794
  }
@@ -85966,7 +85983,8 @@ class AgentProcessManager {
85966
85983
  chatroomId: opts.chatroomId,
85967
85984
  role: opts.role,
85968
85985
  pid: opts.pid,
85969
- supportsSessionResume
85986
+ supportsSessionResume,
85987
+ wantResume: slot?.wantResume ?? true
85970
85988
  }, slot);
85971
85989
  if (result.outcome === "skipped_duplicate") {
85972
85990
  console.log(`[AgentProcessManager] lifecycle.turn.completed: skipping duplicate resume for ${opts.role} (resume already in flight)`);
@@ -85991,6 +86009,8 @@ class AgentProcessManager {
85991
86009
  const model = slot.model;
85992
86010
  const workingDir = slot.workingDir;
85993
86011
  const harnessSessionId = slot.harnessSessionId;
86012
+ const wantResume = slot.wantResume;
86013
+ const recentLogLines = slot.recentLogLines;
85994
86014
  if (harness && harnessSessionId && getHarnessCapabilities(harness).supportsSessionResume && shouldRetainHarnessSessionForReconnect(stopReason)) {
85995
86015
  const service = this.deps.agentServices.get(harness);
85996
86016
  const harnessMeta = service ? this.readHarnessReconnectMetadata(service, opts.pid) : undefined;
@@ -86038,6 +86058,22 @@ class AgentProcessManager {
86038
86058
  console.log(`[AgentProcessManager] ⚠️ Cannot restart — missing harness or workingDir ` + `(role: ${opts.role}, harness: ${harness ?? "none"}, workingDir: ${workingDir ?? "none"})`);
86039
86059
  return;
86040
86060
  }
86061
+ if (isPermanentHarnessFailure(recentLogLines ?? [])) {
86062
+ const error = formatPermanentHarnessFailureMessage(recentLogLines ?? []);
86063
+ console.log(`[AgentProcessManager] ⛔ Skipping restart — ${error}`);
86064
+ this.deps.crashLoop.clear(opts.chatroomId, opts.role);
86065
+ this.clearLastHarnessSession(key);
86066
+ this.deps.backend.mutation(api.machines.emitAgentStartFailed, {
86067
+ sessionId: this.deps.sessionId,
86068
+ machineId: this.deps.machineId,
86069
+ chatroomId: opts.chatroomId,
86070
+ role: opts.role,
86071
+ error
86072
+ }).catch((emitErr) => {
86073
+ console.log(` ⚠️ Failed to emit startFailed event: ${emitErr.message}`);
86074
+ });
86075
+ return;
86076
+ }
86041
86077
  this.ensureRunning({
86042
86078
  chatroomId: opts.chatroomId,
86043
86079
  role: opts.role,
@@ -86045,7 +86081,7 @@ class AgentProcessManager {
86045
86081
  model,
86046
86082
  workingDir,
86047
86083
  reason: "platform.crash_recovery",
86048
- wantResume: true
86084
+ wantResume: wantResume ?? true
86049
86085
  }).catch((err) => {
86050
86086
  console.log(` ⚠️ Failed to restart agent: ${err.message}`);
86051
86087
  this.deps.backend.mutation(api.machines.emitAgentStartFailed, {
@@ -86443,6 +86479,7 @@ class AgentProcessManager {
86443
86479
  });
86444
86480
  }
86445
86481
  slot.model = opts.model;
86482
+ slot.wantResume = wantResume;
86446
86483
  slot.workingDir = opts.workingDir;
86447
86484
  slot.startedAt = this.deps.clock.now();
86448
86485
  slot.pendingOperation = undefined;
@@ -86600,6 +86637,7 @@ var init_agent_process_manager = __esm(() => {
86600
86637
  init_api3();
86601
86638
  init_orphan_tracker();
86602
86639
  init_agent_lifecycle();
86640
+ init_classify_resume_storm_reason();
86603
86641
  init_handle_turn_completed();
86604
86642
  });
86605
86643
 
@@ -88826,4 +88864,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
88826
88864
  });
88827
88865
  program2.parse();
88828
88866
 
88829
- //# debugId=A9CDF253A2BBC68F64756E2164756E21
88867
+ //# debugId=E81362A1D620F90E64756E2164756E21