@tarcisiopgs/lisa 1.21.3 → 1.22.0
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 +72 -53
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5735,70 +5735,88 @@ import { resolve as resolve9 } from "path";
|
|
|
5735
5735
|
async function runWorktreeMultiRepoSession(config2, issue2, logFile, session, models) {
|
|
5736
5736
|
const workspace = resolve9(config2.workspace);
|
|
5737
5737
|
const planPath = getPlanPath(workspace, issue2.id);
|
|
5738
|
-
cleanupPlanFile(planPath);
|
|
5739
5738
|
initLogFile(logFile);
|
|
5740
5739
|
kanbanEmitter.emit("issue:log-file", issue2.id, logFile);
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
shouldAbort: () => userKilledSet.has(issue2.id) || userSkippedSet.has(issue2.id)
|
|
5757
|
-
});
|
|
5758
|
-
stopSpinner();
|
|
5759
|
-
try {
|
|
5760
|
-
appendFileSync10(
|
|
5740
|
+
const cachedPlan = readPlanFile(planPath);
|
|
5741
|
+
let planProviderUsed = models[0]?.provider ?? "claude";
|
|
5742
|
+
let planFallback = null;
|
|
5743
|
+
let sortedSteps;
|
|
5744
|
+
if (cachedPlan?.steps && cachedPlan.steps.length > 0) {
|
|
5745
|
+
sortedSteps = [...cachedPlan.steps].sort((a, b) => a.order - b.order);
|
|
5746
|
+
ok(
|
|
5747
|
+
`Reusing cached plan for ${issue2.id}: ${sortedSteps.length} step(s) \u2014 ${sortedSteps.map((s) => s.repoPath).join(" \u2192 ")}`
|
|
5748
|
+
);
|
|
5749
|
+
} else {
|
|
5750
|
+
startSpinner(`${issue2.id} \u2014 analyzing issue...`);
|
|
5751
|
+
log(`Multi-repo planning phase for ${issue2.id}`);
|
|
5752
|
+
const globalContextMd = readContext(workspace);
|
|
5753
|
+
const planPrompt = buildPlanningPrompt(issue2, config2, planPath, globalContextMd);
|
|
5754
|
+
const planResult = await runWithFallback(models, planPrompt, {
|
|
5761
5755
|
logFile,
|
|
5762
|
-
|
|
5756
|
+
cwd: workspace,
|
|
5757
|
+
guardrailsDir: workspace,
|
|
5758
|
+
issueId: issue2.id,
|
|
5759
|
+
overseer: config2.overseer,
|
|
5760
|
+
sessionTimeout: config2.loop.session_timeout,
|
|
5761
|
+
outputStallTimeout: config2.loop.output_stall_timeout,
|
|
5762
|
+
onProcess: (pid) => {
|
|
5763
|
+
activeProviderPids.set(issue2.id, pid);
|
|
5764
|
+
},
|
|
5765
|
+
shouldAbort: () => userKilledSet.has(issue2.id) || userSkippedSet.has(issue2.id)
|
|
5766
|
+
});
|
|
5767
|
+
stopSpinner();
|
|
5768
|
+
planProviderUsed = planResult.providerUsed;
|
|
5769
|
+
planFallback = planResult;
|
|
5770
|
+
try {
|
|
5771
|
+
appendFileSync10(
|
|
5772
|
+
logFile,
|
|
5773
|
+
`
|
|
5763
5774
|
${"=".repeat(80)}
|
|
5764
5775
|
Planning phase \u2014 provider: ${planResult.providerUsed}
|
|
5765
5776
|
${planResult.output}
|
|
5766
5777
|
`
|
|
5778
|
+
);
|
|
5779
|
+
} catch {
|
|
5780
|
+
}
|
|
5781
|
+
if (!planResult.success) {
|
|
5782
|
+
error(`Planning phase failed for ${issue2.id}. Check ${logFile}`);
|
|
5783
|
+
cleanupPlanFile(planPath);
|
|
5784
|
+
activeProviderPids.delete(issue2.id);
|
|
5785
|
+
return {
|
|
5786
|
+
success: false,
|
|
5787
|
+
providerUsed: planResult.providerUsed,
|
|
5788
|
+
prUrls: [],
|
|
5789
|
+
fallback: planResult
|
|
5790
|
+
};
|
|
5791
|
+
}
|
|
5792
|
+
const plan = readPlanFile(planPath);
|
|
5793
|
+
if (!plan?.steps || plan.steps.length === 0) {
|
|
5794
|
+
error(`Agent did not produce a valid execution plan for ${issue2.id}. Aborting.`);
|
|
5795
|
+
cleanupPlanFile(planPath);
|
|
5796
|
+
activeProviderPids.delete(issue2.id);
|
|
5797
|
+
return {
|
|
5798
|
+
success: false,
|
|
5799
|
+
providerUsed: planResult.providerUsed,
|
|
5800
|
+
prUrls: [],
|
|
5801
|
+
fallback: planResult
|
|
5802
|
+
};
|
|
5803
|
+
}
|
|
5804
|
+
sortedSteps = [...plan.steps].sort((a, b) => a.order - b.order);
|
|
5805
|
+
ok(
|
|
5806
|
+
`Plan produced ${sortedSteps.length} step(s): ${sortedSteps.map((s) => s.repoPath).join(" \u2192 ")}`
|
|
5767
5807
|
);
|
|
5768
|
-
} catch {
|
|
5769
|
-
}
|
|
5770
|
-
if (!planResult.success) {
|
|
5771
|
-
error(`Planning phase failed for ${issue2.id}. Check ${logFile}`);
|
|
5772
|
-
cleanupPlanFile(planPath);
|
|
5773
|
-
activeProviderPids.delete(issue2.id);
|
|
5774
|
-
return {
|
|
5775
|
-
success: false,
|
|
5776
|
-
providerUsed: planResult.providerUsed,
|
|
5777
|
-
prUrls: [],
|
|
5778
|
-
fallback: planResult
|
|
5779
|
-
};
|
|
5780
|
-
}
|
|
5781
|
-
const plan = readPlanFile(planPath);
|
|
5782
|
-
if (!plan?.steps || plan.steps.length === 0) {
|
|
5783
|
-
error(`Agent did not produce a valid execution plan for ${issue2.id}. Aborting.`);
|
|
5784
|
-
cleanupPlanFile(planPath);
|
|
5785
|
-
activeProviderPids.delete(issue2.id);
|
|
5786
|
-
return {
|
|
5787
|
-
success: false,
|
|
5788
|
-
providerUsed: planResult.providerUsed,
|
|
5789
|
-
prUrls: [],
|
|
5790
|
-
fallback: planResult
|
|
5791
|
-
};
|
|
5792
5808
|
}
|
|
5793
|
-
const
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5809
|
+
const defaultFallback = planFallback ?? {
|
|
5810
|
+
success: true,
|
|
5811
|
+
output: "",
|
|
5812
|
+
duration: 0,
|
|
5813
|
+
providerUsed: planProviderUsed,
|
|
5814
|
+
attempts: []
|
|
5815
|
+
};
|
|
5798
5816
|
const prUrls = [];
|
|
5799
5817
|
const previousResults = [];
|
|
5800
|
-
let lastFallback =
|
|
5801
|
-
let lastProvider =
|
|
5818
|
+
let lastFallback = defaultFallback;
|
|
5819
|
+
let lastProvider = planProviderUsed;
|
|
5802
5820
|
for (const [i, step] of sortedSteps.entries()) {
|
|
5803
5821
|
const stepNum = i + 1;
|
|
5804
5822
|
const isLastStep = i === sortedSteps.length - 1;
|
|
@@ -5836,6 +5854,7 @@ ${planResult.output}
|
|
|
5836
5854
|
});
|
|
5837
5855
|
}
|
|
5838
5856
|
activeProviderPids.delete(issue2.id);
|
|
5857
|
+
cleanupPlanFile(planPath);
|
|
5839
5858
|
ok(`Session ${session} complete for ${issue2.id} \u2014 ${prUrls.length} PR(s) created`);
|
|
5840
5859
|
return { success: true, providerUsed: lastProvider, prUrls, fallback: lastFallback };
|
|
5841
5860
|
}
|