chatroom-cli 1.55.1 → 1.55.3
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 +63 -6
- package/dist/index.js.map +9 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -76248,6 +76248,9 @@ To reconnect, run:`);
|
|
|
76248
76248
|
case "superseded":
|
|
76249
76249
|
this.handleSuperseded();
|
|
76250
76250
|
return;
|
|
76251
|
+
case "connection_closed":
|
|
76252
|
+
await this.handleConnectionClosed(response);
|
|
76253
|
+
return;
|
|
76251
76254
|
case "grace_period":
|
|
76252
76255
|
this.handleGracePeriod(response);
|
|
76253
76256
|
return;
|
|
@@ -76265,6 +76268,18 @@ To reconnect, run:`);
|
|
|
76265
76268
|
handleSuperseded() {
|
|
76266
76269
|
this.logAndExit(0, "superseded", "Another get-next-task process started for this role.", `Impact: This process is being replaced by the newer connection.
|
|
76267
76270
|
` + "Action: This is expected if you started a new get-next-task session.");
|
|
76271
|
+
}
|
|
76272
|
+
async handleConnectionClosed(response) {
|
|
76273
|
+
try {
|
|
76274
|
+
await this.client.mutation(api.connections.confirmConnectionClosed, {
|
|
76275
|
+
sessionId: this.sessionId,
|
|
76276
|
+
chatroomId: this.chatroomId,
|
|
76277
|
+
role: this.role,
|
|
76278
|
+
connectionId: this.connectionId
|
|
76279
|
+
});
|
|
76280
|
+
} catch {}
|
|
76281
|
+
this.logAndExit(0, "connection_closed", `This get-next-task connection was closed by request (${response.reason}).`, `Impact: This connection has been terminated (superseded or explicitly closed).
|
|
76282
|
+
` + "Action: This is expected. Reconnect only if you intend to resume listening for tasks.");
|
|
76268
76283
|
}
|
|
76269
76284
|
handleGracePeriod(response) {
|
|
76270
76285
|
const remainingSec = Math.ceil(response.remainingMs / 1000);
|
|
@@ -76427,6 +76442,7 @@ async function getNextTask(chatroomId, options) {
|
|
|
76427
76442
|
process.exit(1);
|
|
76428
76443
|
}
|
|
76429
76444
|
const connectionId = `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
76445
|
+
const machineId = await getMachineId() ?? undefined;
|
|
76430
76446
|
let participantAgentType;
|
|
76431
76447
|
try {
|
|
76432
76448
|
const teamConfigs = await client4.query(api.machines.getTeamAgentConfigs, {
|
|
@@ -76442,6 +76458,7 @@ async function getNextTask(chatroomId, options) {
|
|
|
76442
76458
|
role,
|
|
76443
76459
|
action: "get-next-task:connecting",
|
|
76444
76460
|
connectionId,
|
|
76461
|
+
machineId,
|
|
76445
76462
|
agentType: participantAgentType
|
|
76446
76463
|
});
|
|
76447
76464
|
const connectionTime = new Date().toISOString().replace("T", " ").substring(0, 19);
|
|
@@ -76500,6 +76517,7 @@ var init_get_next_task = __esm(() => {
|
|
|
76500
76517
|
init_api3();
|
|
76501
76518
|
init_storage();
|
|
76502
76519
|
init_client2();
|
|
76520
|
+
init_machine();
|
|
76503
76521
|
init_error_formatting();
|
|
76504
76522
|
init_session();
|
|
76505
76523
|
});
|
|
@@ -79890,11 +79908,12 @@ var init_featureFlags = __esm(() => {
|
|
|
79890
79908
|
});
|
|
79891
79909
|
|
|
79892
79910
|
// ../../services/backend/config/reliability.ts
|
|
79893
|
-
var DAEMON_HEARTBEAT_INTERVAL_MS = 30000, AGENT_REQUEST_DEADLINE_MS = 120000, OBSERVATION_TTL_MS = 60000, OBSERVED_FULL_PUSH_INTERVAL_MS, OBSERVED_SAFETY_POLL_MS = 30000, WORKSPACE_RECENCY_WINDOW_MS, WORKSPACE_LIST_RECONCILE_MS;
|
|
79911
|
+
var DAEMON_HEARTBEAT_INTERVAL_MS = 30000, AGENT_REQUEST_DEADLINE_MS = 120000, OBSERVATION_TTL_MS = 60000, OBSERVED_FULL_PUSH_INTERVAL_MS, OBSERVED_SAFETY_POLL_MS = 30000, WORKSPACE_RECENCY_WINDOW_MS, WORKSPACE_LIST_RECONCILE_MS, CONNECTION_CLOSE_REQUEST_TTL_MS;
|
|
79894
79912
|
var init_reliability = __esm(() => {
|
|
79895
79913
|
OBSERVED_FULL_PUSH_INTERVAL_MS = 5 * 60000;
|
|
79896
79914
|
WORKSPACE_RECENCY_WINDOW_MS = 7 * 24 * 60 * 60 * 1000;
|
|
79897
79915
|
WORKSPACE_LIST_RECONCILE_MS = 60 * 60 * 1000;
|
|
79916
|
+
CONNECTION_CLOSE_REQUEST_TTL_MS = 10 * 60000;
|
|
79898
79917
|
});
|
|
79899
79918
|
|
|
79900
79919
|
// src/events/daemon/agent/on-request-start-agent.ts
|
|
@@ -85690,7 +85709,16 @@ function classifyResumeStormReason(logLines) {
|
|
|
85690
85709
|
}
|
|
85691
85710
|
return "unknown";
|
|
85692
85711
|
}
|
|
85693
|
-
|
|
85712
|
+
function isPermanentHarnessFailure(logLines) {
|
|
85713
|
+
return PERMANENT_FAILURE_REASONS.has(classifyResumeStormReason(logLines));
|
|
85714
|
+
}
|
|
85715
|
+
function formatPermanentHarnessFailureMessage(logLines) {
|
|
85716
|
+
const reason = classifyResumeStormReason(logLines);
|
|
85717
|
+
const blob = logLines.join(`
|
|
85718
|
+
`).trim();
|
|
85719
|
+
return blob ? `Permanent harness error (${reason}): ${blob.slice(-500)}` : `Permanent harness error (${reason})`;
|
|
85720
|
+
}
|
|
85721
|
+
var CLASSIFICATION_RULES, PERMANENT_FAILURE_REASONS;
|
|
85694
85722
|
var init_classify_resume_storm_reason = __esm(() => {
|
|
85695
85723
|
CLASSIFICATION_RULES = [
|
|
85696
85724
|
{
|
|
@@ -85720,6 +85748,10 @@ var init_classify_resume_storm_reason = __esm(() => {
|
|
|
85720
85748
|
reason: "config_error",
|
|
85721
85749
|
patterns: [
|
|
85722
85750
|
/model not found/i,
|
|
85751
|
+
/model_not_supported/i,
|
|
85752
|
+
/model is not supported/i,
|
|
85753
|
+
/requested model is not supported/i,
|
|
85754
|
+
/unsupported model/i,
|
|
85723
85755
|
/invalid model/i,
|
|
85724
85756
|
/missing model/i,
|
|
85725
85757
|
/config(uration)? error/i,
|
|
@@ -85728,6 +85760,10 @@ var init_classify_resume_storm_reason = __esm(() => {
|
|
|
85728
85760
|
]
|
|
85729
85761
|
}
|
|
85730
85762
|
];
|
|
85763
|
+
PERMANENT_FAILURE_REASONS = new Set([
|
|
85764
|
+
"auth_error",
|
|
85765
|
+
"config_error"
|
|
85766
|
+
]);
|
|
85731
85767
|
});
|
|
85732
85768
|
|
|
85733
85769
|
// src/domain/agent-lifecycle/policies/abort-resume-storm.ts
|
|
@@ -85771,7 +85807,7 @@ async function handleTurnCompleted(deps, input, slot) {
|
|
|
85771
85807
|
if (await tryAbortResumeStorm(deps, input, slot)) {
|
|
85772
85808
|
return { outcome: "storm_aborted" };
|
|
85773
85809
|
}
|
|
85774
|
-
if (input.supportsSessionResume) {
|
|
85810
|
+
if (input.supportsSessionResume && input.wantResume) {
|
|
85775
85811
|
if (slot) {
|
|
85776
85812
|
slot.resumeInFlight = true;
|
|
85777
85813
|
}
|
|
@@ -85966,7 +86002,8 @@ class AgentProcessManager {
|
|
|
85966
86002
|
chatroomId: opts.chatroomId,
|
|
85967
86003
|
role: opts.role,
|
|
85968
86004
|
pid: opts.pid,
|
|
85969
|
-
supportsSessionResume
|
|
86005
|
+
supportsSessionResume,
|
|
86006
|
+
wantResume: slot?.wantResume ?? true
|
|
85970
86007
|
}, slot);
|
|
85971
86008
|
if (result.outcome === "skipped_duplicate") {
|
|
85972
86009
|
console.log(`[AgentProcessManager] lifecycle.turn.completed: skipping duplicate resume for ${opts.role} (resume already in flight)`);
|
|
@@ -85991,6 +86028,8 @@ class AgentProcessManager {
|
|
|
85991
86028
|
const model = slot.model;
|
|
85992
86029
|
const workingDir = slot.workingDir;
|
|
85993
86030
|
const harnessSessionId = slot.harnessSessionId;
|
|
86031
|
+
const wantResume = slot.wantResume;
|
|
86032
|
+
const recentLogLines = slot.recentLogLines;
|
|
85994
86033
|
if (harness && harnessSessionId && getHarnessCapabilities(harness).supportsSessionResume && shouldRetainHarnessSessionForReconnect(stopReason)) {
|
|
85995
86034
|
const service = this.deps.agentServices.get(harness);
|
|
85996
86035
|
const harnessMeta = service ? this.readHarnessReconnectMetadata(service, opts.pid) : undefined;
|
|
@@ -86038,6 +86077,22 @@ class AgentProcessManager {
|
|
|
86038
86077
|
console.log(`[AgentProcessManager] ⚠️ Cannot restart — missing harness or workingDir ` + `(role: ${opts.role}, harness: ${harness ?? "none"}, workingDir: ${workingDir ?? "none"})`);
|
|
86039
86078
|
return;
|
|
86040
86079
|
}
|
|
86080
|
+
if (isPermanentHarnessFailure(recentLogLines ?? [])) {
|
|
86081
|
+
const error = formatPermanentHarnessFailureMessage(recentLogLines ?? []);
|
|
86082
|
+
console.log(`[AgentProcessManager] ⛔ Skipping restart — ${error}`);
|
|
86083
|
+
this.deps.crashLoop.clear(opts.chatroomId, opts.role);
|
|
86084
|
+
this.clearLastHarnessSession(key);
|
|
86085
|
+
this.deps.backend.mutation(api.machines.emitAgentStartFailed, {
|
|
86086
|
+
sessionId: this.deps.sessionId,
|
|
86087
|
+
machineId: this.deps.machineId,
|
|
86088
|
+
chatroomId: opts.chatroomId,
|
|
86089
|
+
role: opts.role,
|
|
86090
|
+
error
|
|
86091
|
+
}).catch((emitErr) => {
|
|
86092
|
+
console.log(` ⚠️ Failed to emit startFailed event: ${emitErr.message}`);
|
|
86093
|
+
});
|
|
86094
|
+
return;
|
|
86095
|
+
}
|
|
86041
86096
|
this.ensureRunning({
|
|
86042
86097
|
chatroomId: opts.chatroomId,
|
|
86043
86098
|
role: opts.role,
|
|
@@ -86045,7 +86100,7 @@ class AgentProcessManager {
|
|
|
86045
86100
|
model,
|
|
86046
86101
|
workingDir,
|
|
86047
86102
|
reason: "platform.crash_recovery",
|
|
86048
|
-
wantResume: true
|
|
86103
|
+
wantResume: wantResume ?? true
|
|
86049
86104
|
}).catch((err) => {
|
|
86050
86105
|
console.log(` ⚠️ Failed to restart agent: ${err.message}`);
|
|
86051
86106
|
this.deps.backend.mutation(api.machines.emitAgentStartFailed, {
|
|
@@ -86443,6 +86498,7 @@ class AgentProcessManager {
|
|
|
86443
86498
|
});
|
|
86444
86499
|
}
|
|
86445
86500
|
slot.model = opts.model;
|
|
86501
|
+
slot.wantResume = wantResume;
|
|
86446
86502
|
slot.workingDir = opts.workingDir;
|
|
86447
86503
|
slot.startedAt = this.deps.clock.now();
|
|
86448
86504
|
slot.pendingOperation = undefined;
|
|
@@ -86600,6 +86656,7 @@ var init_agent_process_manager = __esm(() => {
|
|
|
86600
86656
|
init_api3();
|
|
86601
86657
|
init_orphan_tracker();
|
|
86602
86658
|
init_agent_lifecycle();
|
|
86659
|
+
init_classify_resume_storm_reason();
|
|
86603
86660
|
init_handle_turn_completed();
|
|
86604
86661
|
});
|
|
86605
86662
|
|
|
@@ -88826,4 +88883,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
|
88826
88883
|
});
|
|
88827
88884
|
program2.parse();
|
|
88828
88885
|
|
|
88829
|
-
//# debugId=
|
|
88886
|
+
//# debugId=7F8AA45E5D5C7F2164756E2164756E21
|