Skip to content

Disable Agent retry to prevent looping on crash #3617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions server/utils/agents/aibitat/plugins/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,9 @@ const cli = {
let printing = [];

aibitat.onError(async (error) => {
console.error(chalk.red(` error: ${error?.message}`));
if (error instanceof RetryError) {
console.error(chalk.red(` retrying in 60 seconds...`));
setTimeout(() => {
aibitat.retry();
}, 60000);
return;
}
let errorMessage =
error?.message || "An error occurred while running the agent.";
console.error(chalk.red(` error: ${errorMessage}`), error);
});

aibitat.onStart(() => {
Expand Down
25 changes: 10 additions & 15 deletions server/utils/agents/aibitat/plugins/http-socket.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const chalk = require("chalk");
const { RetryError } = require("../error");
const { Telemetry } = require("../../../../models/telemetry");

/**
Expand Down Expand Up @@ -33,20 +32,16 @@ const httpSocket = {
name: this.name,
setup(aibitat) {
aibitat.onError(async (error) => {
if (!!error?.message) {
console.error(chalk.red(` error: ${error.message}`), error);
aibitat.introspect(
`Error encountered while running: ${error.message}`
);
}

if (error instanceof RetryError) {
console.error(chalk.red(` retrying in 60 seconds...`));
setTimeout(() => {
aibitat.retry();
}, 60_000);
return;
}
let errorMessage =
error?.message || "An error occurred while running the agent.";
console.error(chalk.red(` error: ${errorMessage}`), error);
aibitat.introspect(
`Error encountered while running: ${errorMessage}`
);
handler.send(
JSON.stringify({ type: "wssFailure", content: errorMessage })
);
aibitat.terminate();
});

aibitat.introspect = (messageText) => {
Expand Down
25 changes: 10 additions & 15 deletions server/utils/agents/aibitat/plugins/websocket.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const chalk = require("chalk");
const { RetryError } = require("../error");
const { Telemetry } = require("../../../../models/telemetry");
const SOCKET_TIMEOUT_MS = 300 * 1_000; // 5 mins

Expand Down Expand Up @@ -49,20 +48,16 @@ const websocket = {
name: this.name,
setup(aibitat) {
aibitat.onError(async (error) => {
if (!!error?.message) {
console.error(chalk.red(` error: ${error.message}`), error);
aibitat.introspect(
`Error encountered while running: ${error.message}`
);
}

if (error instanceof RetryError) {
console.error(chalk.red(` retrying in 60 seconds...`));
setTimeout(() => {
aibitat.retry();
}, 60000);
return;
}
let errorMessage =
error?.message || "An error occurred while running the agent.";
console.error(chalk.red(` error: ${errorMessage}`), error);
aibitat.introspect(
`Error encountered while running: ${errorMessage}`
);
socket.send(
JSON.stringify({ type: "wssFailure", content: errorMessage })
);
aibitat.terminate();
});

aibitat.introspect = (messageText) => {
Expand Down