Skip to content

Commit b6e99c4

Browse files
committed
Keep web build waits alive longer
1 parent 35a1ff6 commit b6e99c4

4 files changed

Lines changed: 39 additions & 5 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codebase-cli",
3-
"version": "2.0.0-pre.79",
3+
"version": "2.0.0-pre.80",
44
"description": "Codebase CLI — a TypeScript coding agent on the pi-mono runtime. OAuth-aware, any LLM provider, single install.",
55
"keywords": [
66
"ai",

src/projects/cli.test.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ describe("runProjectSubcommand", () => {
100100

101101
expect(result.code).toBe(0);
102102
expect(result.stdout.join("\n")).toContain("alias: codebase web-build");
103+
expect(result.stdout.join("\n")).toContain("default: 1800");
103104
});
104105

105106
it("prints pull help without treating the flag as a project id", async () => {
@@ -267,6 +268,39 @@ describe("runProjectSubcommand", () => {
267268
expect(result.stdout.join("\n")).toContain("preview: https://codebase.design/preview/proj-1");
268269
});
269270

271+
it("keeps the default wait alive beyond ten minutes", async () => {
272+
let now = 0;
273+
const nowSpy = vi.spyOn(Date, "now").mockImplementation(() => now);
274+
const client = fakeClient({
275+
status: { sessionId: "sess-1", status: "building", projectId: "proj-1" },
276+
preview: { ok: true, previewPath: "/preview/proj-1" },
277+
}) as ProjectClient;
278+
client.getBuildStatus = async () => ({
279+
sessionId: "sess-1",
280+
status: now >= 11 * 60_000 ? "completed" : "building",
281+
projectId: "proj-1",
282+
});
283+
284+
try {
285+
const stdout: string[] = [];
286+
const code = await runProjectSubcommand(["project", "build", "--wait", "Build", "a", "demo"], {
287+
client,
288+
stdout: (message) => stdout.push(message),
289+
stderr: () => {},
290+
sleep: async (ms) => {
291+
now += ms;
292+
},
293+
handoffStore: null,
294+
});
295+
296+
expect(code).toBe(0);
297+
expect(now).toBeGreaterThanOrEqual(11 * 60_000);
298+
expect(stdout.join("\n")).toContain("build sess-1: completed");
299+
} finally {
300+
nowSpy.mockRestore();
301+
}
302+
});
303+
270304
it("fails a terminal build and prints the server reason", async () => {
271305
const result = await runProject(
272306
["project", "build", "--wait", "Build", "a", "demo"],

src/projects/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { BuildHandoffStore } from "./handoff.js";
44
import type { BuildStatusResponse, PlatformProject } from "./types.js";
55

66
const DEFAULT_LIST_LIMIT = 25;
7-
const DEFAULT_BUILD_TIMEOUT_MS = 10 * 60_000;
7+
const DEFAULT_BUILD_TIMEOUT_MS = 30 * 60_000;
88
const DEFAULT_BUILD_POLL_MS = 30_000;
99

1010
export interface ProjectCliOptions {
@@ -661,7 +661,7 @@ function printBuildHelp(out: (msg: string) => void): void {
661661
out("");
662662
out("Options:");
663663
out(" --wait, -w poll until the build completes, then print preview URL");
664-
out(" --timeout SECONDS max wait time with --wait (default: 600)");
664+
out(" --timeout SECONDS max wait time with --wait (default: 1800)");
665665
out(" --model MODEL request a specific web build model");
666666
out(" --scaffold ID request a specific web scaffold");
667667
out(" --project ID continue/build against an existing project when supported by the web API");

0 commit comments

Comments
 (0)