@tarcisiopgs/lisa 1.20.0 → 1.20.1

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 (2) hide show
  1. package/dist/index.js +49 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4210,6 +4210,19 @@ async function handleSessionResult(sessionResult, issue2, previousStatus, source
4210
4210
  } catch (err) {
4211
4211
  error(`Failed to revert status: ${err instanceof Error ? err.message : String(err)}`);
4212
4212
  }
4213
+ if (!opts.issueId) {
4214
+ const labelToRemove = getRemoveLabel(config2.source_config);
4215
+ if (labelToRemove) {
4216
+ try {
4217
+ await source.removeLabel(issue2.id, labelToRemove);
4218
+ ok(`Removed label "${labelToRemove}" from ${issue2.id} to prevent retry`);
4219
+ } catch (err) {
4220
+ warn(
4221
+ `Failed to remove label: ${err instanceof Error ? err.message : String(err)}`
4222
+ );
4223
+ }
4224
+ }
4225
+ }
4213
4226
  activeCleanups.delete(issue2.id);
4214
4227
  return false;
4215
4228
  }
@@ -6273,6 +6286,9 @@ async function runConcurrentLoop(config2, source, models, workspace, opts) {
6273
6286
  let consecutiveFetchErrors = 0;
6274
6287
  const MAX_CONSECUTIVE_FETCH_ERRORS = 3;
6275
6288
  const activeWorkers = /* @__PURE__ */ new Map();
6289
+ const claimedIssueIds = /* @__PURE__ */ new Set();
6290
+ let consecutiveExhaustions = 0;
6291
+ const MAX_CONSECUTIVE_EXHAUSTIONS = 3;
6276
6292
  const processIssue = async (issue2, session) => {
6277
6293
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").substring(0, 19);
6278
6294
  const logFile = resolve11(getLogsDir(workspace), `session_${session}_${timestamp}.log`);
@@ -6334,16 +6350,26 @@ async function runConcurrentLoop(config2, source, models, workspace, opts) {
6334
6350
  );
6335
6351
  if (completed) completedCount++;
6336
6352
  if (!sessionResult.success && !userKilledSet.has(issue2.id) && !userSkippedSet.has(issue2.id) && isCompleteProviderExhaustion(sessionResult.fallback.attempts)) {
6337
- exhausted = true;
6338
- error(
6339
- "All providers exhausted due to infrastructure issues. Fix your provider configuration and restart lisa."
6340
- );
6353
+ consecutiveExhaustions++;
6354
+ if (consecutiveExhaustions >= MAX_CONSECUTIVE_EXHAUSTIONS) {
6355
+ exhausted = true;
6356
+ error(
6357
+ "All providers exhausted due to infrastructure issues. Fix your provider configuration and restart lisa."
6358
+ );
6359
+ } else {
6360
+ warn(
6361
+ `Provider exhausted for ${issue2.id} (${consecutiveExhaustions}/${MAX_CONSECUTIVE_EXHAUSTIONS}). Continuing with next issue.`
6362
+ );
6363
+ }
6364
+ } else if (sessionResult.success) {
6365
+ consecutiveExhaustions = 0;
6341
6366
  }
6342
6367
  userKilledSet.delete(issue2.id);
6343
6368
  userSkippedSet.delete(issue2.id);
6344
6369
  providerPausedSet.delete(issue2.id);
6345
6370
  activeProviderPids.delete(issue2.id);
6346
6371
  activeCleanups.delete(issue2.id);
6372
+ claimedIssueIds.delete(issue2.id);
6347
6373
  };
6348
6374
  while (!noMoreIssues && !exhausted) {
6349
6375
  await waitIfPaused();
@@ -6372,6 +6398,11 @@ async function runConcurrentLoop(config2, source, models, workspace, opts) {
6372
6398
  }
6373
6399
  break;
6374
6400
  }
6401
+ if (issue2 && claimedIssueIds.has(issue2.id)) {
6402
+ log(`Issue ${issue2.id} already claimed by another worker. Skipping.`);
6403
+ sessionCounter--;
6404
+ break;
6405
+ }
6375
6406
  if (!issue2) {
6376
6407
  if (opts.watch) {
6377
6408
  if (activeWorkers.size === 0) {
@@ -6408,6 +6439,7 @@ async function runConcurrentLoop(config2, source, models, workspace, opts) {
6408
6439
  break;
6409
6440
  }
6410
6441
  const session = sessionCounter;
6442
+ claimedIssueIds.add(issue2.id);
6411
6443
  const promise = processIssue(issue2, session).finally(() => {
6412
6444
  activeWorkers.delete(issue2.id);
6413
6445
  });
@@ -6637,6 +6669,8 @@ async function runSequentialLoop(config2, source, models, workspace, opts) {
6637
6669
  let completedCount = 0;
6638
6670
  let consecutiveFetchErrors = 0;
6639
6671
  const MAX_CONSECUTIVE_FETCH_ERRORS = 3;
6672
+ let consecutiveExhaustions = 0;
6673
+ const MAX_CONSECUTIVE_EXHAUSTIONS = 3;
6640
6674
  while (true) {
6641
6675
  session++;
6642
6676
  if (opts.limit > 0 && session > opts.limit) {
@@ -6812,10 +6846,18 @@ async function runSequentialLoop(config2, source, models, workspace, opts) {
6812
6846
  break;
6813
6847
  }
6814
6848
  if (!sessionResult.success && !userKilledSet.has(issue2.id) && !userSkippedSet.has(issue2.id) && isCompleteProviderExhaustion(sessionResult.fallback.attempts)) {
6815
- error(
6816
- "All providers exhausted due to infrastructure issues (quota, plan limits, or not installed). Fix your provider configuration and restart lisa."
6849
+ consecutiveExhaustions++;
6850
+ if (consecutiveExhaustions >= MAX_CONSECUTIVE_EXHAUSTIONS) {
6851
+ error(
6852
+ "All providers exhausted due to infrastructure issues (quota, plan limits, or not installed). Fix your provider configuration and restart lisa."
6853
+ );
6854
+ break;
6855
+ }
6856
+ warn(
6857
+ `Provider exhausted for ${issue2.id} (${consecutiveExhaustions}/${MAX_CONSECUTIVE_EXHAUSTIONS}). Continuing with next issue.`
6817
6858
  );
6818
- break;
6859
+ } else if (sessionResult.success) {
6860
+ consecutiveExhaustions = 0;
6819
6861
  }
6820
6862
  userKilledSet.delete(issue2.id);
6821
6863
  userSkippedSet.delete(issue2.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarcisiopgs/lisa",
3
- "version": "1.20.0",
3
+ "version": "1.20.1",
4
4
  "description": "Autonomous issue resolver",
5
5
  "keywords": [
6
6
  "loop",