Recover transient sandbox connections before executing tools
This commit is contained in:
1 parent
4f2cf2fc87
commit
cb896bb0fa
4 files changed
+156
-52
No files matched your search
@@ -19,6 +19,8 @@ const fileBusy = ref(false),
|
||||
fileError = ref("");
|
||||
let fileGeneration = 0;
|
||||
let fileTaskSignature = "";
|
||||
let fileRetryCount = 0;
|
||||
let nextFileRefresh = 0;
|
||||
const logPanel = ref<HTMLElement | null>(null);
|
||||
const followLogs = ref(true);
|
||||
let logRequest = 0;
|
||||
@@ -103,11 +105,15 @@ async function load() {
|
||||
.map((t) => `${t.id}:${t.status}:${t.step_count}`)
|
||||
.join("|");
|
||||
if (
|
||||
signature !== fileTaskSignature ||
|
||||
projectTasks.some((t) => t.status === "RUNNING")
|
||||
execution.value.filesConfigured &&
|
||||
!fileBusy.value &&
|
||||
Date.now() >= nextFileRefresh &&
|
||||
(signature !== fileTaskSignature ||
|
||||
fileRetryCount > 0 ||
|
||||
projectTasks.some((t) => t.status === "RUNNING"))
|
||||
) {
|
||||
fileTaskSignature = signature;
|
||||
if (execution.value.filesConfigured && !fileBusy.value) void list();
|
||||
void list();
|
||||
}
|
||||
const id = selected.value?.id;
|
||||
if (id) {
|
||||
@@ -118,13 +124,8 @@ async function load() {
|
||||
]);
|
||||
if (selected.value?.id === id && request > appliedLogRequest) {
|
||||
appliedLogRequest = request;
|
||||
const changed =
|
||||
selected.value.status !== task.status ||
|
||||
events.value.at(-1)?.id !== log.at(-1)?.id;
|
||||
selected.value = task;
|
||||
events.value = log;
|
||||
if (changed && execution.value.filesConfigured && !fileBusy.value)
|
||||
void list();
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -226,6 +227,8 @@ async function list() {
|
||||
) {
|
||||
files.value = result.files || [];
|
||||
fileLoaded.value = true;
|
||||
fileRetryCount = 0;
|
||||
nextFileRefresh = Date.now() + 9000;
|
||||
if (!editingPath.value && !content.value) {
|
||||
const first =
|
||||
files.value.find(
|
||||
@@ -243,7 +246,11 @@ async function list() {
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
if (generation === fileGeneration) fileError.value = (e as Error).message;
|
||||
if (generation === fileGeneration && directory === filePath.value) {
|
||||
fileError.value = (e as Error).message;
|
||||
fileRetryCount = Math.min(4, fileRetryCount + 1);
|
||||
nextFileRefresh = Date.now() + Math.min(30000, 3000 * 2 ** fileRetryCount);
|
||||
}
|
||||
} finally {
|
||||
fileBusy.value = false;
|
||||
if (
|
||||
@@ -335,6 +342,9 @@ watch(
|
||||
() => form.projectId,
|
||||
() => {
|
||||
fileGeneration++;
|
||||
fileTaskSignature = "";
|
||||
fileRetryCount = 0;
|
||||
nextFileRefresh = 0;
|
||||
files.value = [];
|
||||
content.value = "";
|
||||
editingPath.value = "";
|
||||
@@ -348,7 +358,7 @@ watch(
|
||||
watch(
|
||||
() => execution.value.filesConfigured,
|
||||
(configured) => {
|
||||
if (configured) void list();
|
||||
if (configured && Date.now() >= nextFileRefresh) void list();
|
||||
},
|
||||
);
|
||||
onMounted(async () => {
|
||||
|
||||
Reference in new issue
Block a user