opencara 0.23.13 → 0.23.14
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 +30 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -132,7 +132,7 @@ function parseTriggerSection(raw, defaults) {
|
|
|
132
132
|
}
|
|
133
133
|
return result;
|
|
134
134
|
}
|
|
135
|
-
var DEFAULT_MODEL_DIVERSITY_GRACE_MS =
|
|
135
|
+
var DEFAULT_MODEL_DIVERSITY_GRACE_MS = 3e5;
|
|
136
136
|
function parseDurationSeconds(value, defaultMs) {
|
|
137
137
|
if (typeof value === "number")
|
|
138
138
|
return value === 0 ? 0 : clamp(value, 0, 300) * 1e3;
|
|
@@ -4825,6 +4825,7 @@ function concatUint8Arrays(chunks, totalLength) {
|
|
|
4825
4825
|
return result;
|
|
4826
4826
|
}
|
|
4827
4827
|
var MAX_DIFF_FETCH_ATTEMPTS = 3;
|
|
4828
|
+
var MAX_TASK_ERROR_ATTEMPTS = 3;
|
|
4828
4829
|
var WEIGHT_PENALTY_FACTOR = 0.5;
|
|
4829
4830
|
var MIN_DISPATCH_WEIGHT = 0.1;
|
|
4830
4831
|
var WEIGHT_RECOVERY = 0.25;
|
|
@@ -5317,6 +5318,7 @@ async function handleTask(client, agentId, task, reviewDeps, consumptionDeps, ag
|
|
|
5317
5318
|
logError(` ${icons.error} Error on task ${task_id}: ${err.message}`);
|
|
5318
5319
|
await safeError(client, task_id, agentId, err.message, logger);
|
|
5319
5320
|
}
|
|
5321
|
+
return { toolFailed: true };
|
|
5320
5322
|
} finally {
|
|
5321
5323
|
if (taskCheckoutPath && taskBareRepoPath) {
|
|
5322
5324
|
if (cleanupTracker) {
|
|
@@ -5698,7 +5700,7 @@ function sleep2(ms, signal) {
|
|
|
5698
5700
|
async function startAgent(agentId, platformUrl, agentInfo, reviewDeps, consumptionDeps, options) {
|
|
5699
5701
|
const client = new ApiClient(platformUrl, {
|
|
5700
5702
|
authToken: options?.authToken,
|
|
5701
|
-
cliVersion: "0.23.
|
|
5703
|
+
cliVersion: "0.23.14",
|
|
5702
5704
|
versionOverride: options?.versionOverride,
|
|
5703
5705
|
onTokenRefresh: options?.onTokenRefresh
|
|
5704
5706
|
});
|
|
@@ -5895,7 +5897,9 @@ async function batchPollLoop(client, agentStates, options) {
|
|
|
5895
5897
|
accessibleRepos,
|
|
5896
5898
|
(msg) => state.logger.logWarn(`${icons.warn} ${msg}`)
|
|
5897
5899
|
);
|
|
5898
|
-
const task = eligible
|
|
5900
|
+
const task = eligible.find(
|
|
5901
|
+
(t) => (state.taskErrorCounts.get(t.task_id) ?? 0) < MAX_TASK_ERROR_ATTEMPTS
|
|
5902
|
+
);
|
|
5899
5903
|
if (!task) continue;
|
|
5900
5904
|
busyAgents.add(state);
|
|
5901
5905
|
const p = (async () => {
|
|
@@ -5931,12 +5935,31 @@ async function batchPollLoop(client, agentStates, options) {
|
|
|
5931
5935
|
state.logger.logWarn(
|
|
5932
5936
|
`${icons.warn} Weight reduced to ${state.weight.toFixed(2)} after diff fetch failure`
|
|
5933
5937
|
);
|
|
5938
|
+
} else if (result.toolFailed) {
|
|
5939
|
+
const errCount = (state.taskErrorCounts.get(task.task_id) ?? 0) + 1;
|
|
5940
|
+
state.taskErrorCounts.set(task.task_id, errCount);
|
|
5941
|
+
if (errCount >= MAX_TASK_ERROR_ATTEMPTS) {
|
|
5942
|
+
state.logger.logWarn(
|
|
5943
|
+
`${icons.warn} Giving up on task ${task.task_id.slice(0, 8)}\u2026 after ${errCount} tool failures`
|
|
5944
|
+
);
|
|
5945
|
+
}
|
|
5946
|
+
state.weight = Math.max(0, state.weight * WEIGHT_PENALTY_FACTOR);
|
|
5947
|
+
state.logger.logWarn(
|
|
5948
|
+
`${icons.warn} Weight reduced to ${state.weight.toFixed(2)} after tool error`
|
|
5949
|
+
);
|
|
5934
5950
|
} else {
|
|
5935
5951
|
state.weight = Math.min(1, state.weight + WEIGHT_RECOVERY);
|
|
5936
5952
|
}
|
|
5937
5953
|
} catch (err) {
|
|
5938
5954
|
logError(`${icons.error} Task handler failed: ${err.message}`);
|
|
5939
5955
|
consecutiveErrors++;
|
|
5956
|
+
const errCount = (state.taskErrorCounts.get(task.task_id) ?? 0) + 1;
|
|
5957
|
+
state.taskErrorCounts.set(task.task_id, errCount);
|
|
5958
|
+
if (errCount >= MAX_TASK_ERROR_ATTEMPTS) {
|
|
5959
|
+
state.logger.logWarn(
|
|
5960
|
+
`${icons.warn} Giving up on task ${task.task_id.slice(0, 8)}\u2026 after ${errCount} failures`
|
|
5961
|
+
);
|
|
5962
|
+
}
|
|
5940
5963
|
state.weight = Math.max(0, state.weight * WEIGHT_PENALTY_FACTOR);
|
|
5941
5964
|
state.logger.logWarn(
|
|
5942
5965
|
`${icons.warn} Weight reduced to ${state.weight.toFixed(2)} after task error`
|
|
@@ -6014,7 +6037,7 @@ async function startBatchAgents(config, agents, pollIntervalMs, oauthToken, opti
|
|
|
6014
6037
|
const { versionOverride, verbose, instancesOverride, agentOwner, userOrgs } = options;
|
|
6015
6038
|
const client = new ApiClient(config.platformUrl, {
|
|
6016
6039
|
authToken: oauthToken,
|
|
6017
|
-
cliVersion: "0.23.
|
|
6040
|
+
cliVersion: "0.23.14",
|
|
6018
6041
|
versionOverride,
|
|
6019
6042
|
onTokenRefresh: () => getValidToken(config.platformUrl, { configPath: config.authFile })
|
|
6020
6043
|
});
|
|
@@ -6094,6 +6117,7 @@ async function startBatchAgents(config, agents, pollIntervalMs, oauthToken, opti
|
|
|
6094
6117
|
cleanupTracker,
|
|
6095
6118
|
verbose,
|
|
6096
6119
|
diffFailCounts: /* @__PURE__ */ new Map(),
|
|
6120
|
+
taskErrorCounts: /* @__PURE__ */ new Map(),
|
|
6097
6121
|
weight: 1
|
|
6098
6122
|
});
|
|
6099
6123
|
}
|
|
@@ -6360,7 +6384,7 @@ agentCommand.command("start").description("Start agents in polling mode").option
|
|
|
6360
6384
|
}
|
|
6361
6385
|
config = loadConfig();
|
|
6362
6386
|
}
|
|
6363
|
-
console.log(formatVersionBanner("0.23.
|
|
6387
|
+
console.log(formatVersionBanner("0.23.14", "7dead21"));
|
|
6364
6388
|
if (config.agents && config.agents.length > 0) {
|
|
6365
6389
|
const toolEntries = config.agents.map((a) => ({
|
|
6366
6390
|
tool: a.tool,
|
|
@@ -7182,7 +7206,7 @@ var statusCommand = new Command4("status").description("Show agent config, conne
|
|
|
7182
7206
|
});
|
|
7183
7207
|
|
|
7184
7208
|
// src/index.ts
|
|
7185
|
-
var program = new Command5().name("opencara").description("OpenCara \u2014 distributed AI code review agent").version(`${"0.23.
|
|
7209
|
+
var program = new Command5().name("opencara").description("OpenCara \u2014 distributed AI code review agent").version(`${"0.23.14"} (${"7dead21"})`);
|
|
7186
7210
|
program.addCommand(agentCommand);
|
|
7187
7211
|
program.addCommand(authCommand());
|
|
7188
7212
|
program.addCommand(dedupCommand());
|