Remove the fixed round limit from AI development tasks
Verify control plane / verify (push) Canceled after 0s
Verify control plane / verify (pull_request) Canceled after 0s

This commit is contained in:
WebUp Cloud committed 2026-11-08 00:43:51 +08:00
1 parent 36ee771ef0
commit 66d339fbed
5 files changed
+34 -13

No files matched your search

@@ -357,6 +357,37 @@ class AgentWorkerIntegrationTest {
verify(sandbox).execute(eq(project), argThat(call -> call.name().equals("write_file")));
}
@Test
void legacyStepLimitPauseCanResumeAndRunMoreThanThirtyAdditionalRounds() throws Exception {
UUID id =
(UUID)
tasks
.create(
user, project, model, "Finish build", new BigDecimal("20"), "legacy-step-cap")
.get("id");
users
.db()
.update(
"UPDATE ai_tasks SET step_count=60,max_steps=60,status='PAUSED',error=? WHERE id=?",
"达到步骤上限,请核对当前项目进度",
id);
tasks.action(id, user, "resume");
var toolResponse = response("Check the build", "run_command");
var finalResponse = response("Build done", null);
var rounds = new java.util.concurrent.atomic.AtomicInteger();
when(transport.request(anyString(), anyString(), anyString(), anyString(), anyInt(), any()))
.thenAnswer(call -> rounds.incrementAndGet() <= 31 ? toolResponse : finalResponse);
when(sandbox.execute(any(), any())).thenReturn("{\"exitCode\":0}");
new AgentWorker(tasks, gateway, sandbox, vault, json).run(tasks.claim());
var task = tasks.config(id);
assertEquals("COMPLETED", task.get("status"));
assertEquals(92, ((Number) task.get("step_count")).intValue());
verify(sandbox, times(31)).execute(eq(project), any());
}
@Test
void oversizedHistoryResumesAndCompactsAgainWithoutReplayingToolsOrLosingLogs() throws Exception {
String prompt = "Continue building the existing site";
@@ -162,9 +162,7 @@ class WalletTaskIntegrationTest {
UUID id = task();
tasks.action(id, user, "pause");
assertEquals("PAUSED", tasks.find(id, user).get("status"));
identity.db().update("UPDATE ai_tasks SET step_count=30 WHERE id=?", id);
tasks.action(id, user, "resume");
assertEquals(60, ((Number) tasks.find(id, user).get("max_steps")).intValue());
assertEquals("QUEUED", tasks.action(id, user, "resume").get("status"));
tasks.action(id, user, "cancel");
assertEquals("CANCELLED", tasks.find(id, user).get("status"));
assertEquals(0, BigDecimal.ZERO.compareTo((BigDecimal) wallets.get(user).get("reserved")));