Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Busy Cloud: an engine status check that cannot finish never reads as "not installed"

milind-soni5b53e9786ca9
diff --git a/server/chat-notices.ts b/server/chat-notices.ts
index 413af4e637..ea7ed5a380 100644
--- a/server/chat-notices.ts
+++ b/server/chat-notices.ts
@@ -165,6 +165,8 @@ export const CHAT_NOTICE = {
"chat.notice.memoryReclaimedOnly": "Ran out of room, so I stopped this task to keep everything here from freezing.",
"chat.notice.memoryReclaimedOnlyDetail": "Ran out of room, so I stopped this task to keep everything here from freezing. ({detail})",
"chat.notice.outOfProcesses": "There is no room to start another program ({code}), so this task could not run. Nothing was sent to the AI. It starts again by itself when there is room.",
+ "chat.notice.cloudBusyStart": "This Cloud is too busy right now to start the AI, so this task did not run. Wait a minute and send it again, stop a heavy task that is running, or move to a bigger plan for more room.",
+ "chat.notice.cloudOutOfCpu": "The Cloud ran out of CPU for this task, so the AI could not start and nothing ran. Wait a minute and send it again, stop a heavy task that is running, or move to a bigger plan for more CPU.",
} as const;
export type ChatNoticeKey = keyof typeof CHAT_NOTICE;
diff --git a/server/cli-version-probe.test.ts b/server/cli-version-probe.test.ts
index 9022adf5d9..e328a0976f 100644
--- a/server/cli-version-probe.test.ts
+++ b/server/cli-version-probe.test.ts
@@ -81,7 +81,7 @@ it.each(["ENOENT", "EACCES", "EPERM"])("forgets a known version after %s instead
expect(read(null, "2.1.311")).toEqual({ version: "2.1.311" });
const unavailable = read(Object.assign(new Error("fixture launch failure"), { code }), "");
expect(unavailable).toEqual({ reason: expect.stringContaining(code === "ENOENT" ? "CLI not found" : "file permissions") });
- expect(read(Object.assign(new Error("fixture timeout"), { killed: true }), "")).toEqual({ reason: expect.stringContaining("took longer than 30 seconds") });
+ expect(read(Object.assign(new Error("fixture timeout"), { killed: true }), "")).toEqual({ reason: expect.stringContaining("took longer than 30 seconds"), busy: true });
});
it("reports an unrecognized failure without claiming the CLI is missing or exposing its output", () => {
diff --git a/server/contracts.ts b/server/contracts.ts
index dbefbf8ffa..f243ea81ef 100644
--- a/server/contracts.ts
+++ b/server/contracts.ts
@@ -400,6 +400,11 @@ export interface ProviderSnapshot {
nativeCli?: true;
/** Not ready because its runtime is being installed on this computer right now. */
installing?: true;
+ /** With `unavailable`: its status check could not finish (out of time, killed, no room to start it), which says nothing
+ * about whether it is installed. Never a reason to show that no AI is connected. */
+ busy?: true;
+ /** With `available`: its program file is there but its status check could not finish yet; it is checked again. */
+ unverified?: true;
/** Display identity from the provider CLI, never credentials; `method` is a personal login or the workspace API key. */
account?: { email?: string; organization?: string; method?: "login" | "api-key" };
version?: string | null;
diff --git a/server/drivers/acp/acp.test.ts b/server/drivers/acp/acp.test.ts
index 820923f88e..db90a45553 100644
--- a/server/drivers/acp/acp.test.ts
+++ b/server/drivers/acp/acp.test.ts
@@ -302,6 +302,7 @@ describe("ACP turns (fake CLI)", () => {
delete process.env.FAKE_ACP_RPC_APPEND_FILE;
delete process.env.FAKE_ACP_RPC_FAILURE_FILE;
delete process.env.FAKE_ACP_RPC_FAILURE_METHOD;
+ delete process.env.FAKE_ACP_RPC_FAILURE_ONCE;
delete process.env.FAKE_ACP_RPC_FAILURE_AFTER_OUTPUT;
delete process.env.FAKE_ACP_RPC_FAILURE_AFTER_USAGE;
delete process.env.FAKE_ACP_LOAD_ERROR;
@@ -2806,6 +2807,18 @@ describe("ACP turns (fake CLI)", () => {
expect(argv.indexOf("--permission-mode")).toBeLessThan(agent);
});
+ it("asks session/new once more after the engine's own transient refusal, and the turn runs", async () => {
+ const failureFile = join(scratch, "session-new-once.json"), rpcFile = join(scratch, "session-new-once-rpc.json");
+ Object.assign(process.env, { FAKE_ACP_RPC_FAILURE_FILE: failureFile, FAKE_ACP_RPC_FAILURE_METHOD: "session/new", FAKE_ACP_RPC_FAILURE_ONCE: "1", FAKE_ACP_RPC_DUMP: rpcFile });
+ writeFileSync(failureFile, JSON.stringify({ code: -32603, message: "Internal error", data: { details: "Internal service failure", errorName: "ServiceUnavailableError" } }));
+ await create();
+ await instance.adapter.sendTurn({ threadId: "t-session-new-once", text: "hi" });
+ expect(await recorder.until((event) => event.type === "turn.completed")).toMatchObject({ ok: true });
+ expect(recorder.events.some((event) => event.type === "runtime.error")).toBe(false);
+ const methods = JSON.parse(readFileSync(rpcFile, "utf8")) as string[];
+ expect(methods.filter((method) => method.startsWith("session/new"))).toEqual(["session/new", "session/new.error", "session/new"]);
+ });
+
describe("opt-in startup recovery", () => {
const failStartup = async (message = "503 Service Unavailable") => {
const failureFile = join(scratch, "startup-failure.json");
diff --git a/server/drivers/acp/busy-start.test.ts b/server/drivers/acp/busy-start.test.ts
new file mode 100644
index 0000000000..95f899d1b6
--- /dev/null
+++ b/server/drivers/acp/busy-start.test.ts
@@ -0,0 +1,91 @@
+import { describe, expect, it, vi } from "vitest";
+
+import { CHAT_NOTICE } from "../../chat-notices.ts";
+import { classifyError } from "../retry.ts";
+import { runtimeErrorText } from "../runtime-notice-error.ts";
+import { startupFailureRecoverable } from "./startup-recovery.ts";
+import { acpRpcError } from "./rpc-error.ts";
+import { BUSY_RETRY_PAUSE_MS, busyStartFailure, sessionNewRetried, type BusyStartDeps } from "./busy-start.ts";
+import { acpRuntimeFailure } from "./failure-words.ts";
+import { classifyOpenCodeError } from "./opencode-go.ts";
+
+/** OpenCode's own refusal on the starved Cloud, as acpRpcError words it. */
+const refusal = () => acpRpcError({ code: -32603, message: "Internal error", data: { details: "Internal service failure", errorName: "ServiceUnavailableError" } }, "session/new");
+
+function deps(over: Partial<BusyStartDeps> = {}) {
+ const paused: number[] = [];
+ const made: BusyStartDeps = { pressure: () => null, cloud: () => true, pause: async (ms) => { paused.push(ms); }, ...over };
+ return { deps: made, paused };
+}
+
+describe("session/new on a busy Cloud", () => {
+ it("the refusal reads as the customer saw it, and is transient", () => {
+ expect(refusal().message).toBe("Internal error: Internal service failure (session/new, ServiceUnavailableError)");
+ expect(classifyError({ text: refusal().message }).transient).toBe(true);
+ });
+
+ it("is asked once more while its process lives, and a second answer is the session", async () => {
+ const { deps: d, paused } = deps();
+ const send = vi.fn().mockRejectedValueOnce(refusal()).mockResolvedValueOnce({ sessionId: "s1" });
+ await expect(sessionNewRetried(send, () => true, d)).resolves.toEqual({ sessionId: "s1" });
+ expect(send).toHaveBeenCalledTimes(2);
+ expect(paused).toEqual([]);
+ });
+
+ it("waits a bounded pause first while the machine is pressed", async () => {
+ const { deps: d, paused } = deps({ pressure: () => "memory stall 10%" });
+ const send = vi.fn().mockRejectedValueOnce(refusal()).mockResolvedValueOnce({ sessionId: "s1" });
+ await sessionNewRetried(send, () => true, d);
+ expect(paused).toEqual([BUSY_RETRY_PAUSE_MS]);
+ });
+
+ it("still refused on a pressed Cloud: one plain line, keeping what the turn's own handling reads", async () => {
+ const { deps: d } = deps({ pressure: () => "memory stall 10%" });
+ const failed = await sessionNewRetried(() => Promise.reject(refusal()), () => true, d).catch((error) => error);
+ expect(failed.message).toBe(CHAT_NOTICE["chat.notice.cloudBusyStart"]);
+ expect(runtimeErrorText(failed)).toMatchObject({ key: "chat.notice.cloudBusyStart" });
+ expect(failed).toMatchObject({ code: -32603, acpSessionFailure: true });
+ // Not a provider outage: no backup AI is started on a machine with no room for one, read as core.ts reads it.
+ expect(classifyError({ text: failed.message }).transient).toBe(false);
+ const code = classifyOpenCodeError(failed);
+ expect(code).toBeUndefined();
+ expect(startupFailureRecoverable(failed, failed.message, code, { approvalUnconfirmed: false, promptSent: false, promptUnreachedModel: false })).toBe(false);
+ // What the failed task's error row shows.
+ expect(acpRuntimeFailure(failed, "OpenCode")).toMatchObject({ message: CHAT_NOTICE["chat.notice.cloudBusyStart"], text: { key: "chat.notice.cloudBusyStart" } });
+ });
+
+ it("a Cloud pressed for CPU says it ran out of CPU", async () => {
+ for (const why of ["cpu stall 80%", "cpu throttled 60%", "cpu steal 40%", "event loop delayed 11s"]) {
+ const failed = await sessionNewRetried(() => Promise.reject(refusal()), () => true, deps({ pressure: () => why }).deps).catch((error) => error);
+ expect(failed.message).toBe(CHAT_NOTICE["chat.notice.cloudOutOfCpu"]);
+ expect(runtimeErrorText(failed)).toMatchObject({ key: "chat.notice.cloudOutOfCpu" });
+ }
+ });
+
+ it("a Cloud pressed when the start began counts, though calm when it failed", async () => {
+ const readings = ["memory stall 12%", null, null, null];
+ const failed = await sessionNewRetried(() => Promise.reject(refusal()), () => true, deps({ pressure: () => readings.shift() ?? null }).deps).catch((error) => error);
+ expect(failed.message).toBe(CHAT_NOTICE["chat.notice.cloudBusyStart"]);
+ });
+
+ it("keeps the engine's words off a Cloud, on a quick refusal, and for a refusal that is not transient", async () => {
+ const quick = await sessionNewRetried(() => Promise.reject(refusal()), () => true, deps().deps).catch((error) => error);
+ expect(quick.message).toMatch(/ServiceUnavailableError/);
+ const desktop = await sessionNewRetried(() => Promise.reject(refusal()), () => true, deps({ pressure: () => "memory stall 10%", cloud: () => false }).deps).catch((error) => error);
+ expect(desktop.message).toMatch(/ServiceUnavailableError/);
+ const key = new Error("Internal error: Invalid API key. (session/new, APIError)");
+ expect(busyStartFailure(key, "memory stall 10%", deps().deps)).toBe(key);
+ });
+
+ it("is not asked again when its process ended, for a timeout, or for a sign-in", async () => {
+ for (const [error, alive] of [
+ [refusal(), false],
+ [new Error("ACP request timed out: session/new"), true],
+ [Object.assign(refusal(), { acpSignInRequired: true }), true],
+ ] as const) {
+ const send = vi.fn(() => Promise.reject(error));
+ await sessionNewRetried(send, () => alive, deps().deps).catch(() => {});
+ expect(send).toHaveBeenCalledTimes(1);
+ }
+ });
+});
diff --git a/server/drivers/acp/busy-start.ts b/server/drivers/acp/busy-start.ts
new file mode 100644
index 0000000000..c9a795c0d0
--- /dev/null
+++ b/server/drivers/acp/busy-start.ts
@@ -0,0 +1,70 @@
+// session/new on a starved Cloud: OpenCode 1.19 on a 2 GB shared-CPU Cloud whose memory was held by a bot's commands took
+// 26–46 s to answer it and then refused with its own `Internal error: Internal service failure (session/new,
+// ServiceUnavailableError)`. A transient refusal on a live process is asked once more (after a pause while the machine is
+// pressed); one that still fails on a Cloud found pressed during the start ends the task with one plain line
+// instead of the engine's words: out of CPU (chat.notice.cloudOutOfCpu) when CPU presses it, else too busy
+// (chat.notice.cloudBusyStart). Our own limits stay as they are (session/new may take
+// NEW_SESSION_TIMEOUT); a timeout is never asked again, which would double the wait.
+import { CHAT_NOTICE } from "../../chat-notices.ts";
+import { engineMemory } from "../../engine-memory.ts";
+import { machinePressure } from "../../machine-pressure.ts";
+import { classifyError } from "../retry.ts";
+import { RuntimeNoticeError } from "../runtime-notice-error.ts";
+
+/** Before asking again while the machine is pressed: room for what holds it to ease. */
+export const BUSY_RETRY_PAUSE_MS = 10_000;
+export interface BusyStartDeps {
+ /** Why the machine is pressed now, null when it is not (machine-pressure.ts). */
+ pressure: () => string | null;
+ /** This server is a Cloud home, whose plan the plain line names. */
+ cloud: () => boolean;
+ pause: (ms: number) => Promise<void>;
+}
+
+const defaults: BusyStartDeps = {
+ pressure: () => machinePressure.reason(),
+ cloud: () => engineMemory.enabled && !engineMemory.selfHosted(),
+ pause: (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
+};
+
+const text = (error: unknown) => (error instanceof Error ? error.message : String(error));
+
+/** A refusal worth one more ask: transient, not a sign-in, not a timeout. */
+function askAgain(error: unknown): boolean {
+ if ((error as { acpSignInRequired?: unknown } | null)?.acpSignInRequired === true || /\btimed? out\b/i.test(text(error))) return false;
+ return classifyError({ text: text(error) }).transient;
+}
+
+/** The plain line for a start the Cloud was too busy for (`why`: the pressure read during the start, null for none), keeping
+ * the fields the turn's own handling reads (the JSON-RPC code, and whether the process is fit for more sessions); any
+ * other failure, or one on a calm machine (a provider outage, which a backup AI may carry), as it was. */
+export function busyStartFailure(error: unknown, why: string | null, deps: Pick<BusyStartDeps, "cloud"> = defaults): unknown {
+ if (why === null || !deps.cloud() || (error as { acpSignInRequired?: unknown } | null)?.acpSignInRequired === true) return error;
+ if (!classifyError({ text: text(error) }).transient) return error;
+ const key = why !== null && /^(?:cpu|event loop)\b/.test(why) ? "chat.notice.cloudOutOfCpu" : "chat.notice.cloudBusyStart";
+ const fields = error && typeof error === "object" ? error as { code?: unknown; acpSessionFailure?: unknown } : {};
+ return Object.assign(new RuntimeNoticeError(CHAT_NOTICE[key], key), {
+ ...(fields.code !== undefined ? { code: fields.code } : {}),
+ ...(fields.acpSessionFailure !== undefined ? { acpSessionFailure: fields.acpSessionFailure } : {}),
+ });
+}
+
+/** session/new, asked once more after a transient refusal while its process lives. */
+export async function sessionNewRetried<T>(send: () => Promise<T>, alive: () => boolean, deps: BusyStartDeps = defaults): Promise<T> {
+ const atStart = deps.pressure();
+ /** The pressure read at the start, else now: a Cloud pressed at any point of the start. */
+ const during = () => atStart ?? deps.pressure();
+ try {
+ return await send();
+ } catch (first) {
+ if (!askAgain(first) || !alive()) throw busyStartFailure(first, during(), deps);
+ const afterFirst = during();
+ if (afterFirst !== null) await deps.pause(BUSY_RETRY_PAUSE_MS);
+ if (!alive()) throw busyStartFailure(first, afterFirst ?? deps.pressure(), deps);
+ try {
+ return await send();
+ } catch (second) {
+ throw busyStartFailure(second, afterFirst ?? deps.pressure(), deps);
+ }
+ }
+}
diff --git a/server/drivers/acp/core.ts b/server/drivers/acp/core.ts
index c0393b079e..a2a3508a3a 100644
--- a/server/drivers/acp/core.ts
+++ b/server/drivers/acp/core.ts
@@ -26,7 +26,7 @@ import { acpCapabilities } from "./capabilities.ts"; import { readAcpMediaLinks
import { acpNativeLogMessage } from "./tool-log.ts";
import { stripLeakedSystemHarnessMessages } from "../../../shared/system-message-guard.ts";
import { formatQuietLimit, lastSeenPhrase, LIMIT_WORDS, promptIdleTimeoutMs, type LogSignal } from "./quiet-status.ts"; import { startAcpQuietWatch } from "./quiet-watch.ts"; import { AppliedConfig } from "./applied-config.ts"; import { modelRefused, roomForReadBeside, startupRefresh } from "./startup-refresh.ts"; import { stderrFailureOf, watchStderrFailure, type StderrFailure } from "./harness-failure.ts"; import { timed, turnStartClock, type TurnStartClock } from "../../perf/turn-starts.ts";
-import { acpMissingSession, retryTransient } from "./rpc-error.ts";
+import { acpMissingSession, retryTransient } from "./rpc-error.ts"; import { busyOf, inconclusiveMark } from "../../harness/probe-hold.ts"; import { sessionNewRetried } from "./busy-start.ts";
import { readSessionReport } from "./session-reports.ts";
import { promptTokenUsage } from "./prompt-usage.ts";
import { advertisedCommands, turnAnswers, turnSteering, type AcpSteerSupport } from "./steer.ts";
@@ -1179,11 +1179,11 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
promptTurn = { ...turn, text: recovery.text };
rebuiltFromReplay = recovery.replayed;
}
- await request("session/new", { cwd, mcpServers: support.mcpServersFromLaunch ? [] : acpSessionMcpServers(mcpServers, ownMcp, init), ...selectionParams, ...support.sessionSetupParams?.(init, heldSystem()) }, support.sessionSetupTimeoutMs ?? NEW_SESSION_TIMEOUT, (result) => {
+ await sessionNewRetried(() => request("session/new", { cwd, mcpServers: support.mcpServersFromLaunch ? [] : acpSessionMcpServers(mcpServers, ownMcp, init), ...selectionParams, ...support.sessionSetupParams?.(init, heldSystem()) }, support.sessionSetupTimeoutMs ?? NEW_SESSION_TIMEOUT, (result) => {
session.sessionId = typeof result?.sessionId === "string" ? result.sessionId : null;
session.sessionKey = liveSessionKey(sessionKey, heldSystem());
receiveModelVariants(result, true);
- });
+ }), () => session.child.exitCode === null && !session.closing && !session.dead); // a busy machine: once more, then plain words
break;
}
const sessionId = session.sessionId;
@@ -1420,14 +1420,14 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
? `\`${config.cli}\` version check timed out after 8 seconds. Check it in a terminal on the server, then try again.`
: `\`${config.cli}\` version check failed. Run it with --version on the server to diagnose the installation, then check again.`;
// Do not echo arbitrary CLI output or its environment into Settings.
- resolve({ reason });
+ resolve({ reason, ...inconclusiveMark(err) }); // `busy`: the check could not finish, which says nothing about the install
return;
}
const version = versionFromProbe(stdout, stderr);
resolve(!version ? { reason: `\`${config.cli}\` returned no version. Check the configured executable with --version, then try again.` } : support.cliVersion && !support.cliVersion.test(version) ? { reason: notThisCli(config.cli, support.displayName), other: true } : { version });
});
});
- if (!probe.version) return { state: "unavailable", reason: probe.reason, ...(probe.other ? { notEngineCli: true } : {}) };
+ if (!probe.version) return { state: "unavailable", reason: probe.reason, ...(probe.other ? { notEngineCli: true } : {}), ...busyOf(probe) };
const authenticated = await support.isAuthenticated(env, config, instanceId, instanceEnvNames(input.environment, env)); return { state: "available", version: probe.version, authenticated, ...apiKeyAccount(env, support.credentialEnv, authenticated) };
};
diff --git a/server/drivers/claude.ts b/server/drivers/claude.ts
index 740d6956be..20ee78406a 100644
--- a/server/drivers/claude.ts
+++ b/server/drivers/claude.ts
@@ -1820,7 +1820,7 @@ export const ClaudeDriver: ProviderDriver<ClaudeConfig> = {
const snapshot = async (): Promise<ProviderSnapshot> => {
const env = environment();
const probe = await readCliVersion(env);
- if (!("version" in probe)) return { state: "unavailable", reason: probe.reason };
+ if (!("version" in probe)) return { state: "unavailable", ...probe }; // `busy` when the check could not finish
const { version } = probe;
[cliVersion, cliVersionChecked, cliProbedAt] = [parseClaudeCliVersion(version), true, findCliCandidates(config.cli, env.PATH ?? "")[0]];
if (!config.managed && !config.endpointModels) models = withCliVersionGate(models, "claude", cliVersion);
diff --git a/server/drivers/codex-login.test.ts b/server/drivers/codex-login.test.ts
index 83723e06b1..b17f21fbfc 100644
--- a/server/drivers/codex-login.test.ts
+++ b/server/drivers/codex-login.test.ts
@@ -4,7 +4,7 @@ import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { removeTempDir } from "../testing/cleanup.ts";
-import { codexLoginCheck } from "./codex-login.ts";
+import { codexLoginCheck, keptCodexLogin } from "./codex-login.ts";
const FAKE_CLI = join(dirname(fileURLToPath(import.meta.url)), "..", "testing", "fake-codex-app-server.ts");
@@ -26,3 +26,16 @@ describe("Codex login check", () => {
await expect(login.check(env("logged-out"))).resolves.toBe("missing");
});
});
+
+describe("Codex sign-in through a check that could not finish", () => {
+ it("keeps the last answer; an answer that finished always counts", () => {
+ const signedIn = keptCodexLogin();
+ expect(signedIn({ status: "unknown", busy: true })).toBe(false);
+ expect(signedIn({ status: "signed-in" })).toBe(true);
+ expect(signedIn({ status: "unknown", busy: true })).toBe(true);
+ expect(signedIn({ status: "unknown" })).toBe(false);
+ expect(signedIn({ status: "unknown", busy: true })).toBe(false);
+ expect(signedIn({ status: "signed-in" })).toBe(true);
+ expect(signedIn({ status: "signed-out" })).toBe(false);
+ });
+});
diff --git a/server/drivers/codex-login.ts b/server/drivers/codex-login.ts
index 8ca547a48c..01f329948a 100644
--- a/server/drivers/codex-login.ts
+++ b/server/drivers/codex-login.ts
@@ -3,6 +3,7 @@
import { readFileSync } from "node:fs";
import { join } from "node:path";
import { execCli } from "../procs.ts";
+import { inconclusiveFailure } from "../harness/probe-hold.ts";
import { codexHome } from "./codex-identity.ts";
type Env = Record<string, string | undefined>;
@@ -30,17 +31,25 @@ const API_KEY_LOGIN = /^(?:api key configured|logged in using an api key)\b/im;
export type CodexLoginStatus = "signed-in" | "signed-out" | "unknown";
/** `apiKey` is true for an API-key login, which `codex logout` as a ChatGPT sign-out cannot confirm. */
-export function readCodexLogin(cli: string, env: Env): Promise<{ status: CodexLoginStatus; apiKey: boolean }> {
+/** `busy`: the check could not finish (out of time, killed, no room to start it), which says nothing about the login. */
+export function readCodexLogin(cli: string, env: Env): Promise<{ status: CodexLoginStatus; apiKey: boolean; busy?: true }> {
return new Promise((resolve) => execCli(cli, ["login", "status"], { timeout: 8000, env }, (err, stdout, stderr) => {
const said = `${stdout}\n${stderr ?? ""}`;
const signedIn = !err && codexReportsLogin(said);
resolve({
status: signedIn ? "signed-in" : err && /^(?:not logged in|error checking login status)\b/im.test(said) ? "signed-out" : "unknown",
apiKey: signedIn && API_KEY_LOGIN.test(said),
+ ...(!signedIn && inconclusiveFailure(err) ? { busy: true as const } : {}),
});
}));
}
+/** Whether Codex is signed in, by its last check that finished: one that could not finish keeps the answer before it. */
+export function keptCodexLogin(): (login: { status: CodexLoginStatus; busy?: true }) => boolean {
+ let last: boolean | undefined;
+ return (login) => (login.busy && last !== undefined ? last : (last = login.status === "signed-in"));
+}
+
export async function codexLoginStatus(cli: string, env: Env): Promise<CodexLoginStatus> {
return (await readCodexLogin(cli, env)).status;
}
diff --git a/server/drivers/codex.ts b/server/drivers/codex.ts
index 6c6be62c5d..1b6ccfbc0e 100644
--- a/server/drivers/codex.ts
+++ b/server/drivers/codex.ts
@@ -56,7 +56,7 @@ import { codexAccountEmail, codexHome } from "./codex-identity.ts";
import { keepChatsOutOfCodexHistory, linkSharedCodexHome } from "./codex-shared-home.ts";
import { mcpAppApprovalForm, mcpAppApprovalText, mcpElicitationDeclined, plainRecord } from "./codex-app-approval.ts";
import { archivedNativeCodexThread, CODEX_MISSING_CREDENTIALS, codexProviderMismatch, CODEX_SIGN_IN_EXPIRED, codexLimitFacts, codexNotSignedIn, CodexRpcError, codexSignInExpired, codexPlanModelRefused, codexPlanUnsupportedInput, codexSignInRefused, codexUserError, codexUserFailure, missingNativeCodexThread, type CodexRoute } from "./codex-errors.ts";
-import { codexTierOf } from "./codex-tier.ts"; import { codexLoginCheck, readCodexLogin, storedCodexLogin } from "./codex-login.ts";
+import { codexTierOf } from "./codex-tier.ts"; import { codexLoginCheck, keptCodexLogin, readCodexLogin, storedCodexLogin } from "./codex-login.ts";
import { keyRejected, noteKeyAccepted, noteKeyRejected } from "../key-rejections.ts";
import { classifyResumeFailure, mayReplay, rebuiltSessionNotice, recoveryPromptFor } from "../resume-recovery.ts";
import { extractMcpImages } from "../mcp-tool-images.ts"; import { codexImageInputs, withoutInlineImages } from "./codex-images.ts";
@@ -1395,11 +1395,11 @@ export const CodexDriver: ProviderDriver<CodexConfig> = {
return { turnId };
};
- const readCliVersion = cliVersionProbe(config.cli);
+ const readCliVersion = cliVersionProbe(config.cli), signedIn = keptCodexLogin();
const snapshot = async (): Promise<ProviderSnapshot> => {
const env = childEnv();
const probe = await readCliVersion(env);
- if (!("version" in probe)) return { state: "unavailable", reason: probe.reason, ...(plan ? { chatgptPlan: true } : {}) };
+ if (!("version" in probe)) return { state: "unavailable", ...probe, ...(plan ? { chatgptPlan: true } : {}) }; // `busy` when the check could not finish
const { version } = probe;
const warning = planWarning ?? (planAuth && !planRenewal.noteVersion(version) ? "Update Codex to 0.165.0 or newer to renew ChatGPT credentials during a running task." : undefined);
if (planAuth) return { state: "available", version, chatgptPlan: true, billing: "subscription", ...await planAuth.snapshot(), update: await codexReleaseUpdate(version, config.cli),
@@ -1409,7 +1409,7 @@ export const CodexDriver: ProviderDriver<CodexConfig> = {
const previousCliVersion = modelsCliVersion;
modelsCliVersion = version;
if (previousCliVersion !== null && previousCliVersion !== version) await refreshModels();
- const login = await readCodexLogin(config.cli, env), authenticated = login.status === "signed-in";
+ const login = await readCodexLogin(config.cli, env), authenticated = signedIn(login);
if (authenticated && loginRejected()) {
return { state: "available", version, authenticated: false, reason: CODEX_SIGN_IN_EXPIRED,
update: await codexReleaseUpdate(version, config.cli), billing: "subscription" };
diff --git a/server/harness/engine-status-file.ts b/server/harness/engine-status-file.ts
index 85cbefc42f..1cc13cdbae 100644
--- a/server/harness/engine-status-file.ts
+++ b/server/harness/engine-status-file.ts
@@ -47,6 +47,9 @@ export function snapshotFrom(value: unknown): ProviderSnapshot | null {
...(flag(raw.chatgptPlan) ? { chatgptPlan: raw.chatgptPlan } : {}),
// Until the start-up read reaches it, OpenCode on its free models alone still ranks and reads as the backup it is.
...(flag(raw.freeFallback) ? { freeFallback: raw.freeFallback } : {}),
+ // Installed but not yet confirmed (probe-hold.ts): a restart on a busy machine starts from that, not from nothing.
+ ...(raw.unverified === true && raw.state === "available" ? { unverified: true as const } : {}),
+ ...(raw.busy === true && raw.state === "unavailable" ? { busy: true as const } : {}),
...(text(raw.authenticationUnavailableReason) ? { authenticationUnavailableReason: raw.authenticationUnavailableReason } : {}),
...(signedInAs ? { account: signedInAs } : {}),
...(text(raw.version) || raw.version === null ? { version: raw.version } : {}),
diff --git a/server/harness/probe-hold.test.ts b/server/harness/probe-hold.test.ts
new file mode 100644
index 0000000000..d4aa9af234
--- /dev/null
+++ b/server/harness/probe-hold.test.ts
@@ -0,0 +1,64 @@
+import { chmodSync, mkdirSync, mkdtempSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { afterEach, describe, expect, it } from "vitest";
+
+import { removeTempDir } from "../testing/cleanup.ts";
+import { cliPresent, heldSnapshot, inconclusiveFailure, inconclusiveMark } from "./probe-hold.ts";
+
+const scratch: string[] = [];
+afterEach(async () => { for (const dir of scratch.splice(0)) await removeTempDir(dir); });
+
+describe("a check that could not finish", () => {
+ it("is a timeout, a signal or a refused spawn; never a missing file, a permission or an exit status", () => {
+ // execCli's own cut-off and Node's timeout kill.
+ expect(inconclusiveFailure(Object.assign(new Error("opencode timed out after 8000 ms"), { killed: true, code: null, signal: null }))).toBe(true);
+ expect(inconclusiveFailure(Object.assign(new Error("Command failed"), { killed: true, code: null, signal: "SIGTERM" }))).toBe(true);
+ // The OOM killer's SIGKILL, with no timeout.
+ expect(inconclusiveFailure(Object.assign(new Error("Command failed"), { killed: false, code: null, signal: "SIGKILL" }))).toBe(true);
+ for (const code of ["EAGAIN", "ENOMEM", "EMFILE", "ENFILE"]) expect(inconclusiveFailure(Object.assign(new Error(`spawn ${code}`), { code }))).toBe(true);
+
+ for (const code of ["ENOENT", "EACCES", "EPERM"]) expect(inconclusiveFailure(Object.assign(new Error(`spawn ${code}`), { code }))).toBe(false);
+ expect(inconclusiveFailure(Object.assign(new Error("Command failed"), { killed: false, code: 1, signal: null }))).toBe(false);
+ expect(inconclusiveFailure(null)).toBe(false);
+ expect(inconclusiveMark(Object.assign(new Error("x"), { code: "EAGAIN" }))).toEqual({ busy: true });
+ expect(inconclusiveMark(Object.assign(new Error("x"), { code: "ENOENT" }))).toEqual({});
+ });
+
+ it("keeps the last status that found the engine; else the program file decides", () => {
+ const busy = { state: "unavailable", reason: "timed out", busy: true } as const;
+ const known = { state: "available", version: "1.19.3", authenticated: true } as const;
+ expect(heldSnapshot(known, busy, () => false)).toBe(known);
+ expect(heldSnapshot(undefined, busy, () => true)).toEqual({ state: "available", unverified: true });
+ expect(heldSnapshot({ state: "unavailable", reason: "old", version: "1.0.0" }, busy, () => true)).toEqual({ state: "available", unverified: true, version: "1.0.0" });
+ expect(heldSnapshot(undefined, busy, () => false)).toEqual({ state: "unavailable", reason: "timed out" });
+ // No program to look at (an engine without a CLI): unknown, and still never "missing".
+ expect(heldSnapshot(undefined, busy, () => null)).toEqual(busy);
+ });
+});
+
+describe("cliPresent", () => {
+ const dir = () => { const made = mkdtempSync(join(tmpdir(), "omb-cli-present-")); scratch.push(made); return made; };
+
+ it("finds an executable file without starting it", () => {
+ const bin = dir(), file = join(bin, "opencode");
+ writeFileSync(file, "#!/bin/sh\nexit 1\n");
+ chmodSync(file, 0o755);
+ expect(cliPresent("opencode", process.platform, () => [file])).toBe(true);
+ expect(cliPresent(`"${file}" acp`, process.platform, (name) => [name])).toBe(true);
+ });
+
+ it("a missing file, a folder, or (off Windows) a file that cannot run is not there", () => {
+ const bin = dir(), file = join(bin, "opencode"), folder = join(bin, "folder");
+ mkdirSync(folder);
+ expect(cliPresent("opencode", "linux", () => [])).toBe(false);
+ expect(cliPresent("opencode", "linux", () => [join(bin, "gone")])).toBe(false);
+ expect(cliPresent("opencode", "linux", () => [folder])).toBe(false);
+ expect(cliPresent("", "linux", () => [file])).toBe(false);
+ writeFileSync(file, "not executable");
+ chmodSync(file, 0o644);
+ if (process.platform !== "win32" && process.getuid?.() !== 0) expect(cliPresent("opencode", "linux", () => [file])).toBe(false);
+ // Windows has no execute bit: a file that is there is there (a .cmd shim, a D:\ path).
+ expect(cliPresent("opencode", "win32", () => [file])).toBe(true);
+ });
+});
diff --git a/server/harness/probe-hold.ts b/server/harness/probe-hold.ts
new file mode 100644
index 0000000000..fe377be5aa
--- /dev/null
+++ b/server/harness/probe-hold.ts
@@ -0,0 +1,84 @@
+// An engine status check that could not finish (it ran out of time, was killed, or could not be started for want of room)
+// says nothing about whether the engine is installed or signed in: on a starved machine (a small Cloud whose CPU is
+// throttled while a bot's commands hold its memory) `<cli> --version` can take longer than its limit while the engine works.
+// Such a check is never recorded as "unavailable": the registry keeps what it last knew and checks again later, and with
+// nothing known it looks for the program file itself (no process started) and takes it as installed but unverified.
+import { accessSync, constants, statSync } from "node:fs";
+
+import type { ProviderSnapshot, RuntimeEvent } from "../contracts.ts";
+import { findCliCandidates, splitCliString } from "../env-path.ts";
+import { shortageCode } from "../process-shortage.ts";
+
+/** Before each check again after one that could not finish: then the last of these, until one answers. */
+export const PROBE_RETRY_MS = [30_000, 60_000, 120_000, 300_000, 600_000] as const;
+/** An event from one of the engine's turns this recently, with no end since, proves it runs: no check is needed then. */
+export const TURN_PROOF_MS = 5 * 60_000;
+/** On a small machine a status check waits for the one before it at most this long: longer than a CLI's own version check
+ * may take (procs.ts CLI_VERSION_TIMEOUT_MS), so two never run at once there unless one is stuck past its own limit. */
+export const PROBE_QUEUE_WAIT_MS = 35_000;
+
+/** A failed `execFile` that says nothing about the program: cut off at its time limit, ended by a signal (the OOM killer's
+ * SIGKILL), or never started for want of processes, open files or memory. A missing or non-executable file, or an exit
+ * with a status, is an answer. */
+export function inconclusiveFailure(error: unknown): boolean {
+ if (!error || typeof error !== "object") return false;
+ const failure = error as { code?: unknown; killed?: unknown; signal?: unknown };
+ if (shortageCode(failure)) return true;
+ if (failure.killed === true && typeof failure.code !== "string") return true;
+ return typeof failure.signal === "string" && failure.signal !== "" && typeof failure.code !== "number";
+}
+
+/** The `busy` mark a status read sets on an unavailable status whose check could not finish. */
+export const inconclusiveMark = (error: unknown): { busy?: true } => (inconclusiveFailure(error) ? { busy: true } : {});
+
+/** The mark on a probe result, for a read that keeps it in a type of its own. */
+export const busyOf = (probe: object): { busy?: true } => ("busy" in probe && probe.busy === true ? { busy: true } : {});
+
+/** Whether the program this CLI runs is an executable file on the PATH engines are started with: a look at the file, never a
+ * process. */
+export function cliPresent(cli: string, platform: NodeJS.Platform = process.platform, find: (name: string) => string[] = findCliCandidates): boolean {
+ const program = splitCliString(cli)[0];
+ if (!program) return false;
+ for (const candidate of find(program)) {
+ try {
+ if (!statSync(candidate).isFile()) continue;
+ accessSync(candidate, platform === "win32" ? constants.F_OK : constants.X_OK);
+ return true;
+ } catch {}
+ }
+ return false;
+}
+
+/** What a check that could not finish leaves recorded: the last status that said the engine was there; else, when its
+ * program file is there, installed but unverified; else not installed. */
+export function heldSnapshot(before: ProviderSnapshot | undefined, now: ProviderSnapshot, present: () => boolean | null): ProviderSnapshot {
+ if (before?.state === "available") return before;
+ const file = present();
+ if (file === true) return { state: "available", unverified: true, ...(before?.version ? { version: before.version } : {}) };
+ if (file === false) {
+ const { busy: _busy, ...missing } = now;
+ return { ...missing, state: "unavailable" };
+ }
+ return { ...now, state: "unavailable", busy: true };
+}
+
+const TERMINAL = new Set<RuntimeEvent["type"]>(["turn.completed", "session.exited"]);
+
+/** Which threads have a turn under way on one engine, from its own events: the latest activity of each. */
+export function turnActivity(now: () => number = Date.now) {
+ const threads = new Map<string, number>();
+ return {
+ note(event: RuntimeEvent): void {
+ if (TERMINAL.has(event.type) || (event.type === "runtime.error" && event.terminal === true)) threads.delete(event.threadId);
+ else threads.set(event.threadId, now());
+ },
+ running(): boolean {
+ const at = now();
+ for (const [threadId, seen] of threads) {
+ if (at - seen < TURN_PROOF_MS && at >= seen) return true;
+ threads.delete(threadId);
+ }
+ return false;
+ },
+ };
+}
diff --git a/server/harness/registry-probe-hold.test.ts b/server/harness/registry-probe-hold.test.ts
new file mode 100644
index 0000000000..da4bd9fd1f
--- /dev/null
+++ b/server/harness/registry-probe-hold.test.ts
@@ -0,0 +1,256 @@
+// A status check that could not finish on a starved machine never reads as "not installed": the registry keeps what it last
+// knew (across a restart too), takes a program file that is there as installed until a check answers, checks again later,
+// and runs no check that can wait during the engine's turn, while the machine is pressed, or two at once on a small one.
+import { mkdtempSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+import type { ProviderSnapshot, RuntimeEvent } from "../contracts.ts";
+import { removeTempDir } from "../testing/cleanup.ts";
+import { makeFakeDriver, type FakeDriverHandle, type FakeDriverOptions } from "../testing/fake-driver.ts";
+import { STATUS_SAVE_DELAY_MS } from "./engine-status-file.ts";
+import { PROBE_RETRY_MS, TURN_PROOF_MS } from "./probe-hold.ts";
+import { ENGINE_LIST_REUSE_MS, ProviderRegistry, SNAPSHOT_DEADLINE_MS } from "./registry.ts";
+
+const SIGNED_IN = { state: "available", version: "1.2.3", authenticated: true } as const satisfies ProviderSnapshot;
+/** What a driver reports for a `--version` cut off at its limit (procs.ts, acp/core.ts). */
+const TIMED_OUT = { state: "unavailable", reason: "`opencode` version check timed out after 8 seconds.", busy: true } as const satisfies ProviderSnapshot;
+const NOT_FOUND = { state: "unavailable", reason: "`opencode` isn't installed, or isn't on this app's PATH." } as const satisfies ProviderSnapshot;
+
+type Options = ConstructorParameters<typeof ProviderRegistry>[1];
+/** The app's rule for its "no AI connected" page (src/lib/onboarding.ts noEnginesDue): no engine there, by checks that answered. */
+const noEngines = (rows: ReadonlyArray<{ snapshot: ProviderSnapshot }>) => rows.length > 0 && !rows.some((row) => row.snapshot.state === "available" || row.snapshot.busy === true);
+const registries: ProviderRegistry[] = [];
+const scratch: string[] = [];
+
+async function engine(answer: ProviderSnapshot, options: Options = {}, more: FakeDriverOptions = {}) {
+ const opts: FakeDriverOptions = { kind: "opencodeGo", answer, ...more };
+ const fake: FakeDriverHandle = makeFakeDriver(opts);
+ fake.driver.defaultConfig = () => ({ cli: "opencode" });
+ const registry = new ProviderRegistry([fake.driver], { cliPresent: () => true, ...options });
+ registries.push(registry);
+ await registry.load({ opencode: { driver: "opencodeGo" } });
+ const emit = (event: Partial<RuntimeEvent> & { type: RuntimeEvent["type"] }) =>
+ fake.created.get("opencode")!.emit({ eventId: `e${Math.random()}`, provider: "opencodeGo", threadId: "t1", createdAt: new Date().toISOString(), ...event } as RuntimeEvent);
+ const listed = async () => (await registry.describe()).find((row) => row.instanceId === "opencode")!.snapshot;
+ return { registry, fake, opts, emit, listed, probes: () => fake.probes.length };
+}
+
+function statusFile(): string {
+ const dir = mkdtempSync(join(tmpdir(), "omb-probe-hold-"));
+ scratch.push(dir);
+ return join(dir, "providers", "engine-status.json");
+}
+
+afterEach(async () => {
+ vi.useRealTimers();
+ for (const registry of registries.splice(0)) await registry.disposeAll();
+ for (const dir of scratch.splice(0)) await removeTempDir(dir);
+});
+
+describe("a status check that could not finish", () => {
+ it("keeps the last status, signed in and all, and the setup page stays away", async () => {
+ const { registry, opts, listed } = await engine(SIGNED_IN);
+ expect(await listed()).toEqual(SIGNED_IN);
+
+ opts.answer = TIMED_OUT;
+ registry.forgetSnapshots();
+ const held = await listed();
+ expect(held).toEqual(SIGNED_IN);
+ expect(registry.knownSnapshot("opencode")).toEqual(SIGNED_IN);
+ expect(noEngines(await registry.describe())).toBe(false);
+ });
+
+ it("first ever, with the program file there: installed but unverified, never missing", async () => {
+ const present = vi.fn(() => true);
+ const { listed } = await engine(TIMED_OUT, { cliPresent: present });
+ expect(await listed()).toEqual({ state: "available", unverified: true });
+ expect(present).toHaveBeenCalledWith("opencode");
+ });
+
+ it("first ever, with no program file: not installed, and the setup page shows", async () => {
+ const { registry, listed } = await engine(TIMED_OUT, { cliPresent: () => false });
+ const snapshot = await listed();
+ expect(snapshot).toMatchObject({ state: "unavailable", reason: TIMED_OUT.reason });
+ expect("busy" in snapshot).toBe(false);
+ expect(noEngines(await registry.describe())).toBe(true);
+ });
+
+ it("a binary that is truly missing still shows the setup page, whatever was known before", async () => {
+ const { registry, opts, listed } = await engine(SIGNED_IN);
+ await listed();
+ opts.answer = NOT_FOUND;
+ registry.forgetSnapshots();
+ expect(await listed()).toEqual(NOT_FOUND);
+ expect(noEngines(await registry.describe())).toBe(true);
+ });
+
+ it("a status read cut off by the registry's own minute is held too", async () => {
+ vi.useFakeTimers({ toFake: ["setTimeout", "clearTimeout", "Date"] });
+ const { registry, opts, listed } = await engine(SIGNED_IN);
+ await listed();
+ opts.hangSnapshot = true;
+ registry.forgetSnapshots();
+ const read = listed();
+ await vi.advanceTimersByTimeAsync(SNAPSHOT_DEADLINE_MS);
+ expect(await read).toEqual(SIGNED_IN);
+ });
+
+ it("is checked again later, backing off, and a check that answers ends the retries", async () => {
+ vi.useFakeTimers({ toFake: ["setTimeout", "clearTimeout", "Date"] });
+ const { registry, opts, listed, probes } = await engine(SIGNED_IN);
+ await listed();
+ opts.answer = TIMED_OUT;
+ registry.forgetSnapshots();
+ await listed();
+ expect(probes()).toBe(2);
+
+ await vi.advanceTimersByTimeAsync(PROBE_RETRY_MS[0]);
+ expect(probes()).toBe(3);
+ await vi.advanceTimersByTimeAsync(PROBE_RETRY_MS[0]);
+ expect(probes()).toBe(3); // the next waits longer
+ await vi.advanceTimersByTimeAsync(PROBE_RETRY_MS[1] - PROBE_RETRY_MS[0]);
+ expect(probes()).toBe(4);
+
+ opts.answer = NOT_FOUND;
+ await vi.advanceTimersByTimeAsync(PROBE_RETRY_MS[2]);
+ expect(probes()).toBe(5);
+ expect(registry.knownSnapshot("opencode")).toEqual(NOT_FOUND);
+ await vi.advanceTimersByTimeAsync(PROBE_RETRY_MS[4] * 2);
+ expect(probes()).toBe(5);
+ });
+
+ it("a sign-out read on a pressed machine is checked once more, pressed or not, then believed", async () => {
+ vi.useFakeTimers({ toFake: ["setTimeout", "clearTimeout", "Date"] });
+ const { registry, opts, listed, probes } = await engine(SIGNED_IN, { pressed: () => true });
+ await listed();
+ opts.answer = { ...SIGNED_IN, authenticated: false };
+ await vi.advanceTimersByTimeAsync(5_000);
+ expect(await listed()).toEqual(SIGNED_IN);
+ await vi.advanceTimersByTimeAsync(PROBE_RETRY_MS[0]);
+ expect(probes()).toBe(3);
+ expect(registry.knownSnapshot("opencode")).toEqual({ ...SIGNED_IN, authenticated: false });
+ });
+
+ it("a sign-out after a sign-in change is believed at once, pressed or not", async () => {
+ const { registry, opts, listed } = await engine(SIGNED_IN, { pressed: () => true });
+ await listed();
+ opts.answer = { ...SIGNED_IN, authenticated: false };
+ registry.forgetSnapshots();
+ expect(await listed()).toEqual({ ...SIGNED_IN, authenticated: false });
+ });
+
+ it("a restart on a busy machine starts from the last status saved, not from nothing installed", async () => {
+ vi.useFakeTimers({ toFake: ["setTimeout", "clearTimeout", "Date"] });
+ const file = statusFile();
+ const first = await engine(SIGNED_IN, { statusFile: file });
+ await first.listed();
+ await vi.advanceTimersByTimeAsync(STATUS_SAVE_DELAY_MS);
+ await first.registry.disposeAll();
+
+ const second = await engine(TIMED_OUT, { statusFile: file, cliPresent: () => false });
+ const { engines } = await second.registry.readAtStart();
+ expect(engines.find((row) => row.instanceId === "opencode")!.snapshot).toEqual(SIGNED_IN);
+ expect(await second.listed()).toEqual(SIGNED_IN);
+ await vi.advanceTimersByTimeAsync(STATUS_SAVE_DELAY_MS);
+
+ const third = await engine(TIMED_OUT, { statusFile: file, cliPresent: () => false });
+ await third.registry.readAtStart();
+ expect(third.registry.knownSnapshot("opencode")).toEqual(SIGNED_IN);
+ });
+});
+
+describe("checks that can wait", () => {
+ const reused = (registry: ProviderRegistry) => registry.describe({ reuse: { ms: ENGINE_LIST_REUSE_MS, changed: () => {} } });
+
+ it("do not run during the engine's turn, and run again once it ends", async () => {
+ vi.useFakeTimers({ toFake: ["Date"] });
+ const { registry, emit, probes } = await engine(SIGNED_IN, { turnsProve: true });
+ await reused(registry);
+ expect(probes()).toBe(1);
+
+ emit({ type: "turn.started", turnId: "u1" } as Partial<RuntimeEvent> & { type: "turn.started" });
+ vi.setSystemTime(Date.now() + ENGINE_LIST_REUSE_MS);
+ expect((await reused(registry))[0]!.snapshot).toEqual(SIGNED_IN);
+ expect(probes()).toBe(1);
+
+ emit({ type: "turn.completed", turnId: "u1", ok: true, stopReason: "end_turn", cost: null } as Partial<RuntimeEvent> & { type: "turn.completed" });
+ await reused(registry);
+ expect(probes()).toBe(2);
+ });
+
+ it("a turn that has sent nothing for a while proves nothing", async () => {
+ vi.useFakeTimers({ toFake: ["Date"] });
+ const { registry, emit, probes } = await engine(SIGNED_IN, { turnsProve: true });
+ await reused(registry);
+ emit({ type: "turn.started", turnId: "u1" } as Partial<RuntimeEvent> & { type: "turn.started" });
+ vi.setSystemTime(Date.now() + TURN_PROOF_MS);
+ await reused(registry);
+ expect(probes()).toBe(2);
+ });
+
+ it("do not run while the machine is pressed", async () => {
+ vi.useFakeTimers({ toFake: ["Date"] });
+ let pressed = false;
+ const { registry, probes } = await engine(SIGNED_IN, { pressed: () => pressed });
+ await reused(registry);
+ pressed = true;
+ vi.setSystemTime(Date.now() + ENGINE_LIST_REUSE_MS);
+ await reused(registry);
+ expect(probes()).toBe(1);
+ pressed = false;
+ await reused(registry);
+ expect(probes()).toBe(2);
+ });
+
+ it("a retry that comes due while the machine is pressed waits for another", async () => {
+ vi.useFakeTimers({ toFake: ["setTimeout", "clearTimeout", "Date"] });
+ let pressed = false;
+ const { registry, opts, listed, probes } = await engine(SIGNED_IN, { pressed: () => pressed });
+ await listed();
+ opts.answer = TIMED_OUT;
+ registry.forgetSnapshots();
+ await listed();
+ pressed = true;
+ await vi.advanceTimersByTimeAsync(PROBE_RETRY_MS[0]);
+ expect(probes()).toBe(2);
+ pressed = false;
+ await vi.advanceTimersByTimeAsync(PROBE_RETRY_MS[1]);
+ expect(probes()).toBe(3);
+ });
+
+ it("without a turn signal or pressure (the desktop app), the engine list reads as before", async () => {
+ vi.useFakeTimers({ toFake: ["Date"] });
+ const { registry, emit, probes } = await engine(SIGNED_IN);
+ await reused(registry);
+ emit({ type: "turn.started", turnId: "u1" } as Partial<RuntimeEvent> & { type: "turn.started" });
+ vi.setSystemTime(Date.now() + ENGINE_LIST_REUSE_MS);
+ await reused(registry);
+ expect(probes()).toBe(2);
+ });
+});
+
+describe("on a small machine", () => {
+ it("runs one engine's status check at a time", async () => {
+ const opens: Array<() => void> = [];
+ const gate = () => new Promise<void>((resolve) => opens.push(resolve));
+ const fakes = ["a", "b"].map((kind) => {
+ const fake = makeFakeDriver({ kind, holdSnapshot: gate() });
+ fake.driver.defaultConfig = () => ({ cli: `${kind}-cli` });
+ return fake;
+ });
+ const registry = new ProviderRegistry(fakes.map((fake) => fake.driver), { small: () => true });
+ registries.push(registry);
+ await registry.load({ a: { driver: "a" }, b: { driver: "b" } });
+ const listed = registry.describe();
+ await new Promise((resolve) => setImmediate(resolve));
+ expect(fakes.map((fake) => fake.probes.length)).toEqual([1, 0]);
+ opens[0]!();
+ await new Promise((resolve) => setImmediate(resolve));
+ await new Promise((resolve) => setImmediate(resolve));
+ expect(fakes.map((fake) => fake.probes.length)).toEqual([1, 1]);
+ opens[1]!();
+ expect((await listed).map((row) => row.snapshot.state)).toEqual(["available", "available"]);
+ });
+});
diff --git a/server/harness/registry.ts b/server/harness/registry.ts
index 9e2993166a..049e70c74c 100644
--- a/server/harness/registry.ts
+++ b/server/harness/registry.ts
@@ -4,14 +4,16 @@ import { installNpmEngine, npmAvailable, serverInstallFor, standaloneLookupPath
import { installStandaloneEngine, isAppStandaloneCopy, type StandaloneInstalled } from "../engine-standalone.ts";
import { pinnedNpmVersion } from "../engine-versions.ts";
import { withBotMemoryCap } from "../bot-memory-cap.ts";
-import { withEngineMemory } from "../engine-memory.ts";
+import { engineMemory as memoryGate, withEngineMemory } from "../engine-memory.ts";
import { withEngineHomes } from "../engine-homes/engine-homes.ts";
import { withLocalContext } from "../drivers/local-inject.ts";
import { engineStatusFile, snapshotFrom } from "./engine-status-file.ts";
+import { cliPresent, heldSnapshot, inconclusiveFailure, PROBE_QUEUE_WAIT_MS, PROBE_RETRY_MS, turnActivity } from "./probe-hold.ts";
import { withUnaskedStops } from "./unasked-stop.ts";
import { withTurnScope } from "../crash-guard.ts";
import { withWslNotice } from "./wsl-launch.ts";
import { modelManifest, startModelManifestRefresh } from "../model-manifest/manifest.ts";
+import { machinePressure } from "../machine-pressure.ts";
export { engineMemory } from "../engine-memory.ts";
import { clientInstall } from "../contracts.ts";
import type {
@@ -26,6 +28,11 @@ import type {
StandaloneRelease,
} from "../contracts.ts";
+/** The server's own registry, where turns wait for room (a Cloud home, a self-hosted Linux server): checks that can wait
+ * wait for a calmer machine and for the engine's turns, and run one at a time on a small one. Off on the desktop app. */
+export const probeGate = () => ({ pressed: machinePressure.pressed, small: machinePressure.small, turnsProve: memoryGate.enabled,
+ log: (line: string) => console.warn(line) });
+
export interface ShadowInstance {
instanceId: InstanceId;
driverKind: string;
@@ -88,13 +95,15 @@ export const SNAPSHOT_REUSE_MS = 3_000;
/** How long the engine list people see answers from earlier reads before one is read again in the background. */
export const ENGINE_LIST_REUSE_MS = 60_000;
const SNAPSHOT_DEADLINE_REASON = "This engine did not report its status within a minute. Check that its CLI starts in a terminal.";
+/** A status read cut off by SNAPSHOT_DEADLINE_MS: it could not finish, which says nothing about the engine. */
+class SnapshotDeadlineError extends Error {}
function withinDeadline(read: () => Promise<ProviderSnapshot>): Promise<ProviderSnapshot> {
let deadline: NodeJS.Timeout | undefined;
return Promise.race([
read(),
new Promise<never>((_resolve, reject) => {
- deadline = setTimeout(() => reject(new Error(SNAPSHOT_DEADLINE_REASON)), SNAPSHOT_DEADLINE_MS);
+ deadline = setTimeout(() => reject(new SnapshotDeadlineError(SNAPSHOT_DEADLINE_REASON)), SNAPSHOT_DEADLINE_MS);
deadline.unref?.();
}),
]).finally(() => clearTimeout(deadline));
@@ -141,11 +150,29 @@ export class ProviderRegistry {
private readonly npmPresent: () => boolean;
private readonly status: ReturnType<typeof engineStatusFile> | null;
private readonly installStandalone: InstallStandalone;
+ /** Whether the machine is too busy now for a check that can wait (machine-pressure.ts); never, unless given. */
+ private readonly pressed: () => boolean;
+ /** A machine where status checks that start a CLI run one at a time; none is, unless given. */
+ private readonly small: () => boolean;
+ private readonly cliPresent: (cli: string) => boolean;
+ /** Engines whose last check could not finish: how many times in a row, and the check again that is due. */
+ private readonly retries = new Map<InstanceId, { attempt: number; timer?: NodeJS.Timeout; signOut?: true }>();
+ private readonly turns = new Map<InstanceId, { activity: ReturnType<typeof turnActivity>; off: () => void }>();
+ private probeQueue: Promise<void> = Promise.resolve();
+ /** Whether a turn under way puts off its engine's checks that can wait (where turns wait for room); off unless given. */
+ private readonly turnsProve: boolean;
+ private readonly log: (line: string) => void;
constructor(
drivers: readonly AnyProviderDriver[],
- options: { enginesBaseDir?: string; npmAvailable?: () => boolean; statusFile?: string; installStandalone?: InstallStandalone } = {},
+ options: { enginesBaseDir?: string; npmAvailable?: () => boolean; statusFile?: string; installStandalone?: InstallStandalone;
+ pressed?: () => boolean; small?: () => boolean; cliPresent?: (cli: string) => boolean; turnsProve?: boolean; log?: (line: string) => void } = {},
) {
+ this.pressed = options.pressed ?? (() => false);
+ this.small = options.small ?? (() => false);
+ this.turnsProve = options.turnsProve === true;
+ this.log = options.log ?? (() => {});
+ this.cliPresent = options.cliPresent ?? ((cli) => cliPresent(cli));
this.enginesBaseDir = options.enginesBaseDir;
this.npmPresent = options.npmAvailable ?? npmAvailable;
this.status = options.statusFile ? engineStatusFile(options.statusFile) : null;
@@ -217,6 +244,7 @@ export class ProviderRegistry {
config,
})))))));
this.shareSnapshot(live);
+ this.watchTurns(instanceId, live);
return { instanceId, live: decorate ? decorate(live) : live };
} catch (e) {
return {
@@ -245,13 +273,60 @@ export class ProviderRegistry {
instance.snapshot = () => {
if (held && held.generation === this.snapshotGeneration
&& (held.settledAt === undefined || Date.now() - held.settledAt < SNAPSHOT_REUSE_MS)) return held.read;
- const current: SharedRead = { generation: this.snapshotGeneration, read: withinDeadline(read) };
+ const current: SharedRead = { generation: this.snapshotGeneration, read: this.probeSlot(instance.instanceId, () => withinDeadline(read)) };
held = current;
current.read.then(() => { current.settledAt = Date.now(); }, () => { if (held === current) held = undefined; });
return current.read;
};
}
+ /** On a small machine, a status read that starts a CLI waits for the one before it (at most PROBE_QUEUE_WAIT_MS), so a
+ * starved Cloud never runs several engines' checks at once; elsewhere, and for engines without a CLI, it starts now. */
+ private probeSlot(instanceId: InstanceId, run: () => Promise<ProviderSnapshot>): Promise<ProviderSnapshot> {
+ if (!this.cliTarget(instanceId)?.cli || !this.small()) return run();
+ const read = settledOrAfter(this.probeQueue, PROBE_QUEUE_WAIT_MS).then(run);
+ this.probeQueue = read.then(() => undefined, () => undefined);
+ return read;
+ }
+
+ /** A turn of this engine that is under way proves it runs: its own events say which. */
+ private watchTurns(instanceId: InstanceId, live: ProviderInstance): void {
+ this.turns.get(instanceId)?.off();
+ this.turns.delete(instanceId);
+ if (!this.turnsProve) return;
+ const activity = turnActivity();
+ let off: unknown;
+ try { off = live.adapter.onEvent((event) => activity.note(event)); } catch {}
+ this.turns.set(instanceId, { activity, off: typeof off === "function" ? off as () => void : () => {} });
+ }
+
+ /** A check that can wait does, while the machine is pressed or the engine has a turn under way. */
+ probeDeferred(instanceId: InstanceId): boolean {
+ return this.turns.get(instanceId)?.activity.running() === true || this.pressed();
+ }
+
+ /** After a check that could not finish: one more, later, backing off; a turn or a pressed machine puts it off again. */
+ private retryLater(instance: ProviderInstance, signOut = false): void {
+ const entry = this.retries.get(instance.instanceId) ?? { attempt: 0 };
+ this.retries.set(instance.instanceId, entry);
+ if (signOut) entry.signOut = true;
+ if (entry.timer) return;
+ entry.timer = setTimeout(() => {
+ entry.timer = undefined;
+ if (this.retries.get(instance.instanceId) !== entry || this.byId.get(instance.instanceId)?.live !== instance) return;
+ entry.attempt += 1;
+ if (!entry.signOut && this.probeDeferred(instance.instanceId)) this.retryLater(instance);
+ else void this.read(instance);
+ }, PROBE_RETRY_MS[Math.min(entry.attempt, PROBE_RETRY_MS.length - 1)]);
+ entry.timer.unref?.();
+ }
+
+ private stopRetry(instanceId: InstanceId): void {
+ const entry = this.retries.get(instanceId);
+ if (entry?.timer) clearTimeout(entry.timer);
+ this.retries.delete(instanceId);
+ }
+
/** Every engine's next status read probes its CLI again: an install, update, sign-in or key change may alter what it reports. */
forgetSnapshots(): void {
this.snapshotGeneration += 1;
@@ -283,7 +358,9 @@ export class ProviderRegistry {
}
afterFirst();
await Promise.all([withoutCli, this.engineRead(...live)]);
- const gone = [...seeded].filter(([id, seed]) => seed.state === "available" && this.lastSnapshots.get(id)?.state === "unavailable");
+ // Also one whose check could not finish and kept the last status (probe-hold.ts), unless the machine is pressed now.
+ const gone = [...seeded].filter(([id, seed]) => seed.state === "available"
+ && (this.lastSnapshots.get(id)?.state === "unavailable" || (this.retries.has(id) && !this.probeDeferred(id))));
if (gone.length) {
this.forgetSnapshots();
for (const [id] of gone) this.unread?.add(id);
@@ -475,7 +552,9 @@ export class ProviderRegistry {
if (seed) return Promise.resolve(seed);
const last = options.reuse && this.readsOf.get(instance);
if (!options.reuse || !last || last.generation !== this.snapshotGeneration) return this.read(instance);
- if (options.reuse.maxAgeMs !== undefined && Date.now() - last.at >= options.reuse.maxAgeMs) return this.read(instance);
+ if (options.reuse.maxAgeMs !== undefined && Date.now() - last.at >= options.reuse.maxAgeMs && !this.probeDeferred(instance.instanceId)) return this.read(instance);
+ // A check that can wait does not run during a turn of this engine or while the machine is pressed: the last answer stands.
+ if (this.probeDeferred(instance.instanceId)) return Promise.resolve(last.snapshot);
if (Date.now() - last.at >= options.reuse.ms) {
const { changed } = options.reuse;
void this.read(instance).then((snapshot) => { if (JSON.stringify(snapshot) !== JSON.stringify(last.snapshot)) changed(); });
@@ -486,20 +565,37 @@ export class ProviderRegistry {
private async read(instance: ProviderInstance): Promise<ProviderSnapshot> {
let snapshot: ProviderSnapshot;
+ let answered = true, inconclusive = false;
const generation = this.snapshotGeneration;
try {
snapshot = await instance.snapshot();
- this.readsOf.set(instance, { snapshot, at: Date.now(), generation });
+ inconclusive = snapshot.state === "unavailable" && snapshot.busy === true;
} catch (e) {
- snapshot = { state: "unavailable", reason: e instanceof Error ? e.message : String(e) };
+ answered = false;
+ inconclusive = e instanceof SnapshotDeadlineError || inconclusiveFailure(e);
+ snapshot = { state: "unavailable", reason: e instanceof Error ? e.message : String(e), ...(inconclusive ? { busy: true as const } : {}) };
+ }
+ const before = this.lastSnapshots.get(instance.instanceId) ?? this.seeds.get(instance.instanceId);
+ // Signed out, read on a pressed machine just after being signed in: checked once more (pressed or not) before it is
+ // believed. Believed at once after a sign-in change (forgetSnapshots since this engine's last read), and the second time.
+ const lastRead = this.readsOf.get(instance), signOutHeld = this.retries.get(instance.instanceId)?.signOut === true;
+ const holdSignOut = !inconclusive && !signOutHeld && before?.authenticated === true && snapshot.state === "available" && snapshot.authenticated === false
+ && (lastRead === undefined || lastRead.generation === generation) && this.pressed();
+ if (holdSignOut) inconclusive = true;
+ if (inconclusive) {
+ const cli = this.cliTarget(instance.instanceId)?.cli;
+ snapshot = heldSnapshot(before, snapshot, () => (cli ? this.cliPresent(cli) : null));
+ this.log(`engines: ${instance.instanceId}'s status check gave no clear answer; ${snapshot === before ? "keeping its last status"
+ : snapshot.unverified ? "its program is there, taken as installed until a check answers" : snapshot.busy ? "status unknown" : "its program is not there"}`);
}
+ if (answered || inconclusive) this.readsOf.set(instance, { snapshot, at: Date.now(), generation });
// Only while this is still the live instance: a reload may have replaced it during the read.
if (this.byId.get(instance.instanceId)?.live === instance) {
- const before = this.lastSnapshots.get(instance.instanceId) ?? this.seeds.get(instance.instanceId);
+ if (inconclusive) this.retryLater(instance, holdSignOut); else this.stopRetry(instance.instanceId);
this.lastSnapshots.set(instance.instanceId, snapshot);
this.unread?.delete(instance.instanceId);
this.saveStatus();
- this.healWrongCli(instance.instanceId, snapshot);
+ if (!inconclusive) this.healWrongCli(instance.instanceId, snapshot);
if (before?.authenticated === false && snapshot.state === "available" && snapshot.authenticated === true) {
for (const listener of this.signedInListeners) listener(instance.instanceId);
}
@@ -589,6 +685,9 @@ export class ProviderRegistry {
}
async disposeAll() {
+ for (const instanceId of this.retries.keys()) this.stopRetry(instanceId);
+ for (const { off } of this.turns.values()) off();
+ this.turns.clear();
await Promise.allSettled(this.instances().map((i) => i.dispose()));
this.byId.clear();
this.cliByInstance.clear();
@@ -598,6 +697,9 @@ export class ProviderRegistry {
async dispose(instanceId: InstanceId) {
const entry = this.byId.get(instanceId);
+ this.stopRetry(instanceId);
+ this.turns.get(instanceId)?.off();
+ this.turns.delete(instanceId);
this.byId.delete(instanceId);
this.cliByInstance.delete(instanceId);
this.lastSnapshots.delete(instanceId);
diff --git a/server/index.ts b/server/index.ts
index 486f9b0a77..4ec829d351 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -268,7 +268,7 @@ import {
SendSequencer,
} from "./send-idempotency.ts";
import { EventBus } from "./harness/bus.ts"; import { publicReplyEvent } from "./harness/public-reply.ts";
-import { ENGINE_LIST_REUSE_MS, engineMemory, enginesByUse, ProviderRegistry } from "./harness/registry.ts"; import { afterFirstEngineRead, holdUntilFirstEngineRead } from "./first-engine-read.ts"; import { HANDOFF_BROWSER_NOTE, HANDOFF_BROWSER_ONLY, handoffSurface, StoppedHandoffs, stoppedHandoffResult } from "./host/handoff-browser.ts";
+import { ENGINE_LIST_REUSE_MS, engineMemory, enginesByUse, probeGate, ProviderRegistry } from "./harness/registry.ts"; import { afterFirstEngineRead, holdUntilFirstEngineRead } from "./first-engine-read.ts"; import { HANDOFF_BROWSER_NOTE, HANDOFF_BROWSER_ONLY, handoffSurface, StoppedHandoffs, stoppedHandoffResult } from "./host/handoff-browser.ts";
import { ManagedDesktopProviders } from "./managed-desktop.ts";
import { mainThread, mainThreadToKeep, wasOldestThread } from "./main-thread.ts"; import { createThreadSaveLines, createThreadScope, reachThreads, scopedMemoryUpdate, threadNotesPrompt } from "./thread-notes.ts";
import { computerKindForResource, ManagedDesktopPolicy, type ComputerKind } from "./managed-policy.ts"; import { nudgeCloudTeamPolicy, remoteAccessPaths, startCloudTeamPolicy, stopCloudTeamPolicy } from "./cloud-team-policy.ts"; import { startCloudTeamRoster, stopCloudTeamRoster } from "./cloud-team-roster.ts"; import { createTeamWelcomeStore } from "./team-welcome.ts"; import { teamOnboarding, teamSignInFor } from "./host/team-join-host.ts";
@@ -798,7 +798,7 @@ function customDomainStatus() {
serverIpv4: DESKTOP_MANAGED ? null : customDomainIpv4(),
};
}
-const registry = new ProviderRegistry(BUILT_IN_DRIVERS, { statusFile: join(DATA_DIR, "providers", "engine-status.json") });
+const registry = new ProviderRegistry(BUILT_IN_DRIVERS, { statusFile: join(DATA_DIR, "providers", "engine-status.json"), ...probeGate() });
const supportsApprovalMode = createApprovalModeSupport(registry);
registerEnginesBinDir(); const engineUpdates = engineUpdatesFor({ drivers: BUILT_IN_DRIVERS, turnRunning: () => store.bots.some((bot) => botHasActiveTurn(bot.id)) || store.groups.some(groupIsWorking) || Boolean(routines?.hasActiveRuns()), configuredClis: () => Object.values(providerConfigs()).flatMap((entry) => { const cli = (entry.config as { cli?: unknown } | undefined)?.cli; return typeof cli === "string" && cli ? [cli] : []; }), antigravityWanted: () => antigravityInUse(providerConfigs(), [cfg.defaultModelSelection, ...store.bots.flatMap((bot) => [bot.modelSelection, ...(bot.tasks ?? []).map((task) => task.modelSelection)])]), updated: () => { registry.forgetSnapshots(); broadcast({ kind: "config", ...configStatus() }); } });
diff --git a/server/machine-pressure.test.ts b/server/machine-pressure.test.ts
new file mode 100644
index 0000000000..50ee0c1df6
--- /dev/null
+++ b/server/machine-pressure.test.ts
@@ -0,0 +1,74 @@
+import { describe, expect, it } from "vitest";
+
+import type { HostMemory } from "./engine-memory.ts";
+import { createMachinePressure, PRESSURE_READ_MS, SMALL_MEMORY_BYTES } from "./machine-pressure.ts";
+
+const GB = 1024 ** 3;
+const calm: HostMemory = { totalBytes: 2 * GB, availableBytes: GB, swapFreeBytes: 0, oomKills: 0, fullStall10: 0 };
+const psi = (some: number) => `some avg10=${some} avg60=0.00 avg300=0.00 total=1\nfull avg10=0.00 avg60=0.00 avg300=0.00 total=1\n`;
+const stat = (total: number, steal: number) => `cpu ${total - steal} 0 0 0 0 0 0 ${steal} 0 0\ncpu0 1 2 3\n`;
+
+function machine(files: Record<string, string>, more: Partial<Parameters<typeof createMachinePressure>[0]> = {}) {
+ let at = 1_000_000;
+ const pressure = createMachinePressure({
+ enabled: () => true, read: (path) => files[path] ?? null, memory: () => calm, loopDelayMs: () => 0, now: () => at, cpus: () => 4, ...more,
+ });
+ return { pressure, later: (ms: number) => { at += ms; } };
+}
+
+describe("machine pressure", () => {
+ it("reads calm on a quiet machine", () => {
+ const { pressure } = machine({ "/proc/pressure/cpu": psi(3) });
+ expect(pressure.reason()).toBeNull();
+ expect(pressure.pressed()).toBe(false);
+ });
+
+ it("the memory stall the starved Cloud showed presses it", () => {
+ const { pressure } = machine({}, { memory: () => ({ ...calm, fullStall10: 10.4 }) });
+ expect(pressure.reason()).toBe("memory stall 10.4%");
+ });
+
+ it("CPU pressure, the cgroup's own first, presses it", () => {
+ expect(machine({ "/proc/pressure/cpu": psi(72) }).pressure.reason()).toBe("cpu stall 72%");
+ expect(machine({ "/sys/fs/cgroup/cpu.pressure": psi(64), "/proc/pressure/cpu": psi(1) }).pressure.reason()).toBe("cpu stall 64%");
+ });
+
+ it("steal and cgroup throttling between two readings press it", () => {
+ const files: Record<string, string> = { "/proc/stat": stat(10_000, 0), "/sys/fs/cgroup/cpu.stat": "usage_usec 1\nthrottled_usec 0\n" };
+ const { pressure, later } = machine(files);
+ expect(pressure.reason()).toBeNull();
+ files["/proc/stat"] = stat(10_400, 200);
+ later(PRESSURE_READ_MS);
+ expect(pressure.reason()).toBe("cpu steal 50%");
+ files["/proc/stat"] = stat(10_800, 210);
+ files["/sys/fs/cgroup/cpu.stat"] = "usage_usec 1\nthrottled_usec 3000000\n";
+ later(PRESSURE_READ_MS);
+ expect(pressure.reason()).toBe("cpu throttled 60%");
+ });
+
+ it("an event loop held for seconds presses it", () => {
+ expect(machine({}, { loopDelayMs: () => 11_000 }).pressure.reason()).toBe("event loop delayed 11s");
+ });
+
+ it("answers from its last reading for a few seconds", () => {
+ let stall = 0;
+ const { pressure, later } = machine({}, { memory: () => ({ ...calm, fullStall10: stall }) });
+ expect(pressure.pressed()).toBe(false);
+ stall = 30;
+ expect(pressure.pressed()).toBe(false);
+ later(PRESSURE_READ_MS);
+ expect(pressure.pressed()).toBe(true);
+ });
+
+ it("never reads pressed or small where turns do not wait for room (the desktop app)", () => {
+ const { pressure } = machine({ "/proc/pressure/cpu": psi(99) }, { enabled: () => false });
+ expect(pressure.pressed()).toBe(false);
+ expect(pressure.small()).toBe(false);
+ });
+
+ it("a 2 GB Cloud or two CPUs is small", () => {
+ expect(machine({}).pressure.small()).toBe(true);
+ expect(machine({}, { memory: () => ({ ...calm, totalBytes: SMALL_MEMORY_BYTES * 2 }) }).pressure.small()).toBe(false);
+ expect(machine({}, { memory: () => ({ ...calm, totalBytes: SMALL_MEMORY_BYTES * 2 }), cpus: () => 2 }).pressure.small()).toBe(true);
+ });
+});
diff --git a/server/machine-pressure.ts b/server/machine-pressure.ts
new file mode 100644
index 0000000000..777b373b07
--- /dev/null
+++ b/server/machine-pressure.ts
@@ -0,0 +1,108 @@
+// Whether this machine is too busy right now for work that can wait, read from the signals the server already keeps:
+// the memory stall (engine-memory.ts), the CPU's pressure, steal and cgroup throttling (the files stall-watch reads), and
+// the event loop's longest recent delay (perf/loop-stalls.ts). Only where turns wait for room (a Cloud home, a self-hosted
+// Linux server: engine-memory's gate); the desktop app and any machine without /proc never read as pressed.
+import { availableParallelism } from "node:os";
+import { readFileSync } from "node:fs";
+
+import { engineMemory, readHostMemory, type HostMemory } from "./engine-memory.ts";
+import { recentLoopDelayMs } from "./perf/loop-stalls.ts";
+import { pressure10 } from "./perf/stall-sample.ts";
+
+/** Every runnable task waited on memory this much of the last ten seconds (`full avg10`, percent): a 2 GB Cloud whose
+ * engine status checks timed out showed about 10%. */
+export const MEMORY_STALL_PERCENT = 5;
+/** Some task waited for a CPU this much of the last ten seconds (`some avg10`, percent). */
+export const CPU_STALL_PERCENT = 50;
+/** Of the CPU time between two reads, this much went to another machine (steal) or was held back by the cgroup's quota. */
+export const HELD_BACK_PERCENT = 25;
+/** The event loop could not answer for this long in the last minute or two. */
+export const LOOP_DELAY_MS = 2_000;
+/** A reading answers later questions this long. */
+export const PRESSURE_READ_MS = 5_000;
+/** At or under this much memory, or this few CPUs, the machine is small: one engine status check runs at a time. */
+export const SMALL_MEMORY_BYTES = 4 * 1024 ** 3;
+export const SMALL_CPUS = 2;
+
+type Read = (path: string) => string | null;
+const readText: Read = (path) => { try { return readFileSync(path, "utf8"); } catch { return null; } };
+
+export interface PressureSources {
+ enabled?: () => boolean;
+ read?: Read;
+ memory?: () => HostMemory | null;
+ loopDelayMs?: () => number | null;
+ now?: () => number;
+ cpus?: () => number;
+}
+
+/** `/proc/stat`'s first line: all CPU time and the stolen part, in ticks. */
+function cpuTicks(text: string | null): { total: number; steal: number } | null {
+ const fields = text ? /^cpu\s+([\d\s]+)$/m.exec(text)?.[1]?.trim().split(/\s+/).map(Number) : undefined;
+ if (!fields || fields.length < 8 || fields.some((value) => !Number.isFinite(value))) return null;
+ return { total: fields.slice(0, 8).reduce((sum, value) => sum + value, 0), steal: fields[7]! };
+}
+
+/** cgroup v2's `cpu.stat` throttled time, microseconds. */
+const throttledUs = (text: string | null): number | null => {
+ const found = text ? /^throttled_usec (\d+)$/m.exec(text) : null;
+ return found ? Number(found[1]) : null;
+};
+
+export function createMachinePressure(sources: PressureSources = {}) {
+ const enabled = sources.enabled ?? (() => engineMemory.enabled && process.platform === "linux");
+ const read = sources.read ?? readText;
+ const memory = sources.memory ?? (() => readHostMemory());
+ const loopDelayMs = sources.loopDelayMs ?? recentLoopDelayMs;
+ const now = sources.now ?? Date.now;
+ const cpus = sources.cpus ?? availableParallelism;
+ let last: { at: number; why: string | null } | null = null;
+ let counters: { at: number; ticks: { total: number; steal: number } | null; throttled: number | null } | null = null;
+
+ const why = (): string | null => {
+ const host = memory();
+ if ((host?.fullStall10 ?? 0) >= MEMORY_STALL_PERCENT) return `memory stall ${host!.fullStall10}%`;
+ const cpu = pressure10(read("/sys/fs/cgroup/cpu.pressure") ?? read("/proc/pressure/cpu"), "some");
+ if ((cpu ?? 0) >= CPU_STALL_PERCENT) return `cpu stall ${cpu}%`;
+ const at = now(), ticks = cpuTicks(read("/proc/stat")), throttled = throttledUs(read("/sys/fs/cgroup/cpu.stat"));
+ const before = counters;
+ counters = { at, ticks, throttled };
+ if (before && at > before.at) {
+ if (before.ticks && ticks && ticks.total > before.ticks.total) {
+ const steal = ((ticks.steal - before.ticks.steal) / (ticks.total - before.ticks.total)) * 100;
+ if (steal >= HELD_BACK_PERCENT) return `cpu steal ${Math.round(steal)}%`;
+ }
+ if (before.throttled !== null && throttled !== null && throttled >= before.throttled) {
+ const share = ((throttled - before.throttled) / 1000 / (at - before.at)) * 100;
+ if (share >= HELD_BACK_PERCENT) return `cpu throttled ${Math.round(share)}%`;
+ }
+ }
+ const delay = loopDelayMs();
+ if (delay !== null && delay >= LOOP_DELAY_MS) return `event loop delayed ${Math.round(delay / 100) / 10}s`;
+ return null;
+ };
+
+ const reason = (): string | null => {
+ if (!enabled()) return null;
+ const at = now();
+ if (last && at >= last.at && at - last.at < PRESSURE_READ_MS) return last.why;
+ let found: string | null = null;
+ try { found = why(); } catch {}
+ last = { at, why: found };
+ return found;
+ };
+
+ return {
+ /** Why work that can wait should wait now, in a few words for the log; null when it need not. */
+ reason,
+ pressed: (): boolean => reason() !== null,
+ /** A machine where two engine status checks at once are one too many. */
+ small: (): boolean => {
+ if (!enabled()) return false;
+ const host = memory();
+ return (host !== null && host.totalBytes <= SMALL_MEMORY_BYTES) || cpus() <= SMALL_CPUS;
+ },
+ };
+}
+
+export const machinePressure = createMachinePressure();
diff --git a/server/perf/loop-stalls.ts b/server/perf/loop-stalls.ts
index d565d8f749..ae55df5ae5 100644
--- a/server/perf/loop-stalls.ts
+++ b/server/perf/loop-stalls.ts
@@ -119,6 +119,10 @@ export interface LoopStallsOptions {
resumed?: (gapMs: number) => void;
}
+/** The started recorder's longest event-loop delay over the last full minute and the one under way, ms; null when none runs. */
+let longestRecent: (() => number) | null = null;
+export const recentLoopDelayMs = (): number | null => longestRecent?.() ?? null;
+
export function createLoopStalls(options: LoopStallsOptions = {}) {
const resolutionMs = options.resolutionMs ?? STALL_RESOLUTION_MS;
const histogram = options.histogram ?? monitorEventLoopDelay({ resolution: resolutionMs });
@@ -146,6 +150,7 @@ export function createLoopStalls(options: LoopStallsOptions = {}) {
idleSince = idle();
if (paused !== null) options.resumed?.(Math.round(paused));
};
+ const longest = () => Math.max(minutes.at(-1)?.maxMs ?? 0, histogram.count ? lateMs(histogram.max, resolutionMs) : 0);
return {
start() {
if (timer) return;
@@ -154,11 +159,13 @@ export function createLoopStalls(options: LoopStallsOptions = {}) {
idleSince = lastIdleSince = idle();
timer = setInterval(roll, minuteMs);
timer.unref?.();
+ longestRecent = longest;
},
stop() {
if (timer) clearInterval(timer);
timer = undefined;
histogram.disable();
+ if (longestRecent === longest) longestRecent = null;
},
/** Rolls the minute now (tests). */
roll,
diff --git a/server/procs.test.ts b/server/procs.test.ts
index f01ef6b496..7348699bf2 100644
--- a/server/procs.test.ts
+++ b/server/procs.test.ts
@@ -126,7 +126,7 @@ describe("CLI version probes", () => {
const timedOut = await new Promise<Error | null>((resolve) => {
execCli(process.execPath, ["-e", "setInterval(() => {}, 1000)"], { timeout: 200 }, (error) => resolve(error));
});
- expect(cliVersionReader("claude")(timedOut, "")).toEqual({ reason: expect.stringContaining("took longer than 30 seconds") });
+ expect(cliVersionReader("claude")(timedOut, "")).toEqual({ reason: expect.stringContaining("took longer than 30 seconds"), busy: true });
const read = cliVersionReader("claude");
expect(read(null, " 2.1.302\n")).toEqual({ version: "2.1.302" });
expect(read(timedOut, "")).toEqual({ version: "2.1.302" });
@@ -142,7 +142,7 @@ describe("CLI version probes", () => {
execCli(process.execPath, ["-e", "process.stdout.write('2.1.302')"], { timeout: 100 }, (err, stdout) => resolve({ err, stdout }));
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 1_500);
});
- expect(cliVersionReader("claude")(late.err, late.stdout)).toEqual({ reason: expect.stringContaining("took longer than 30 seconds") });
+ expect(cliVersionReader("claude")(late.err, late.stdout)).toEqual({ reason: expect.stringContaining("took longer than 30 seconds"), busy: true });
const read = cliVersionReader("claude");
expect(read(null, "2.1.302")).toEqual({ version: "2.1.302" });
expect(read(late.err, late.stdout)).toEqual({ version: "2.1.302" });
diff --git a/server/procs.ts b/server/procs.ts
index 4807d1f2ef..0b3138d207 100644
--- a/server/procs.ts
+++ b/server/procs.ts
@@ -28,6 +28,7 @@ import { spawnBotWork } from "./oom-score.ts";
import { noticeFailure } from "./chat-notices.ts";
import { processBudget } from "./process-room.ts";
import { shortageCode } from "./process-shortage.ts";
+import { inconclusiveMark } from "./harness/probe-hold.ts";
import { unboxedGitCredential } from "./github/git-credential.ts";
export function resolveCli(cli: string, args: string[] = [], env?: NodeJS.ProcessEnv): ResolvedSpawn {
@@ -564,7 +565,8 @@ function cutOffError(cli: string, timeout: number | undefined): Error {
export const CLI_VERSION_TIMEOUT_MS = 30_000;
-export function cliVersionReader(cli: string): (err: Error | null, stdout: string) => { version: string } | { reason: string } {
+/** `busy`: the check could not finish (probe-hold.ts), which says nothing about whether the CLI is installed. */
+export function cliVersionReader(cli: string): (err: Error | null, stdout: string) => { version: string } | { reason: string; busy?: true } {
let last: string | null = null;
return (err, stdout) => {
const version = err ? "" : stdout.trim();
@@ -582,7 +584,7 @@ export function cliVersionReader(cli: string): (err: Error | null, stdout: strin
if (last && (timedOut || !err || typeof failure?.code === "number")) return { version: last };
return { reason: timedOut
? `\`${cli}\` took longer than ${CLI_VERSION_TIMEOUT_MS / 1000} seconds to answer --version. The machine may be busy; check again.`
- : !err ? `\`${cli}\` returned no version. Check again.` : `\`${cli}\` could not report its version. Check that it starts in a terminal, then check again.` };
+ : !err ? `\`${cli}\` returned no version. Check again.` : `\`${cli}\` could not report its version. Check that it starts in a terminal, then check again.`, ...inconclusiveMark(err) };
};
}
diff --git a/server/testing/fake-acp-cli.ts b/server/testing/fake-acp-cli.ts
index b01cc808a9..ae67d5f757 100755
--- a/server/testing/fake-acp-cli.ts
+++ b/server/testing/fake-acp-cli.ts
@@ -51,6 +51,7 @@
// FAKE_ACP_RPC_FAILURE_FILE JSON-RPC error for session/prompt; once read the process stays poisoned
// FAKE_ACP_RPC_FAILURE_METHOD initialize, authenticate, session/new or session/prompt (default)
// FAKE_ACP_RPC_FAILURE_GATE hold the error until this file exists
+// FAKE_ACP_RPC_FAILURE_ONCE fail once, then answer as usual (the failure file is removed)
// FAKE_ACP_RPC_FAILURE_AFTER_OUTPUT emit text and a tool result before failing
// FAKE_ACP_RPC_FAILURE_AFTER_USAGE emit the scripted usage updates and FAKE_ACP_UPDATES_FILE's before failing
// FAKE_ACP_LOAD_ERROR JSON-RPC error returned by session/load
@@ -714,6 +715,10 @@ function failRpc(msg: { method: string; id: unknown }): boolean {
const fail = () => {
recordMethod(`${msg.method}.error`);
out({ jsonrpc: "2.0", id: msg.id, error: rpcFailure });
+ if (process.env.FAKE_ACP_RPC_FAILURE_ONCE === "1") {
+ rpcFailure = null;
+ if (failureFile) try { unlinkSync(failureFile); } catch {}
+ }
};
const gate = process.env.FAKE_ACP_RPC_FAILURE_GATE;
if (gate && !existsSync(gate)) {
diff --git a/src/App.tsx b/src/App.tsx
index aebe7dd40b..bd8a45f0aa 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -8,7 +8,7 @@ import { MausBotWelcome } from "@/components/MausBotWelcome";
import { NewBotNameHost } from "@/components/NewBotName";
import { MemberApps } from "@/components/MemberApps";
import { CloudTimeZoneSync } from "@/components/CloudTimeZone";
-import { cloudSignInDue, spotlightsQuiet, type WelcomeViewer } from "@/lib/onboarding";
+import { cloudSignInDue, noEnginesDue, spotlightsQuiet, workedEarlier, type WelcomeViewer } from "@/lib/onboarding";
import { FirstConversationTour } from "@/components/onboarding/FirstConversationTour";
import { GuidedTour } from "@/components/onboarding/GuidedTour";
import { LiveCallHost } from "@/components/LiveCallHost";
@@ -223,11 +223,9 @@ function Shell({ viewer }: { viewer: WelcomeViewer | null }) {
const sidebarBesidePanel = anySidePanel(panelsMovingSidebar(sidePanels)) && !sidebarAndPanelFit;
const notificationTray = notificationFeed && !calendarFocus;
- const noEngines =
- state.connected &&
- state.instances.length > 0 &&
- !state.instances.some((i) => i.snapshot.state === "available");
- const cloudSignIn = cloudSignInDue(viewer, state, engineReady);
+ // Only engines truly absent, never status checks that could not finish on a busy machine (onboarding.ts).
+ const noEngines = noEnginesDue(state);
+ const cloudSignIn = cloudSignInDue(viewer, state, (instance) => engineReady(instance) || instance.snapshot.busy === true || (workedEarlier(instance) && instance.snapshot.authenticated !== false));
const cloudIntent = useCloudIntent();
const cloudAsk = cloudIntentShown(cloudIntentDue({
viewer, connected: state.connected, enginesKnown: state.instances.length > 0,
diff --git a/src/lib/onboarding.test.ts b/src/lib/onboarding.test.ts
index 645ae8da2b..320f0eb759 100644
--- a/src/lib/onboarding.test.ts
+++ b/src/lib/onboarding.test.ts
@@ -5,6 +5,8 @@ import {
aiWorks,
beatsFor,
cloudSignInDue,
+ noEnginesDue,
+ workedEarlier,
companyModelCount,
completionPatch,
EMPTY_ONBOARDING,
@@ -319,3 +321,33 @@ describe("welcomeFinishedThisLaunch", () => {
expect(welcomeFinishedThisLaunch()).toBe(true);
});
});
+
+describe("the no-AI setup page", () => {
+ let n = 0;
+ const row = (snapshot: { state: string; busy?: true; unverified?: true; authenticated?: boolean }, instanceId = `e${++n}`) => ({ instanceId, snapshot });
+ it("shows only when engines are known and none is there", () => {
+ const worked = new Set<string>();
+ expect(noEnginesDue({ connected: true, instances: [row({ state: "unavailable" })] }, worked)).toBe(true);
+ expect(noEnginesDue({ connected: true, instances: [row({ state: "unavailable" }), row({ state: "available" })] }, worked)).toBe(false);
+ expect(noEnginesDue({ connected: true, instances: [] }, worked)).toBe(false);
+ expect(noEnginesDue({ connected: false, instances: [row({ state: "unavailable" })] }, worked)).toBe(false);
+ });
+
+ it("never for status checks that could not finish on a busy machine", () => {
+ const worked = new Set<string>();
+ expect(noEnginesDue({ connected: true, instances: [row({ state: "unavailable", busy: true }), row({ state: "unavailable" })] }, worked)).toBe(false);
+ expect(noEnginesDue({ connected: true, instances: [row({ state: "available", unverified: true })] }, worked)).toBe(false);
+ });
+
+ it("never for an engine that worked earlier since the page loaded", () => {
+ const worked = new Set<string>();
+ expect(noEnginesDue({ connected: true, instances: [row({ state: "available" }, "opencode")] }, worked)).toBe(false);
+ expect(noEnginesDue({ connected: true, instances: [row({ state: "unavailable", reason: "gone" } as never, "opencode")] }, worked)).toBe(false);
+ expect(workedEarlier(row({ state: "unavailable" }, "opencode"), worked)).toBe(true);
+ expect(workedEarlier(row({ state: "unavailable" }, "codex"), worked)).toBe(false);
+ expect(noEnginesDue({ connected: true, instances: [row({ state: "unavailable" }, "codex")] }, worked)).toBe(true);
+ // Another place, after the connection dropped: its own engines decide.
+ expect(noEnginesDue({ connected: false, instances: [row({ state: "unavailable" }, "opencode")] }, worked)).toBe(false);
+ expect(noEnginesDue({ connected: true, instances: [row({ state: "unavailable" }, "opencode")] }, worked)).toBe(true);
+ });
+});
diff --git a/src/lib/onboarding.ts b/src/lib/onboarding.ts
index 7e1805611e..4ca2b30bb3 100644
--- a/src/lib/onboarding.ts
+++ b/src/lib/onboarding.ts
@@ -243,6 +243,34 @@ export function plainSignIn(instance: SignInStep): boolean {
: Boolean(instance.install?.server || instance.install?.managed);
}
+/** A status check that could not finish (`busy`, a starved machine) says nothing about whether an engine is there: it never
+ * counts as missing. The status the server keeps when a check could not finish (`unverified`) is available already. */
+export function engineMaybeThere(instance: { snapshot: { state: string; busy?: true } }): boolean {
+ return instance.snapshot.state === "available" || instance.snapshot.busy === true;
+}
+
+type EngineRow = { instanceId: string; snapshot: { state: string; busy?: true; authenticated?: boolean } };
+
+/** Engines seen available since this page loaded. */
+const workedThisSession = new Set<string>();
+
+/** Notes the engines available now; true for one that was available earlier since this page loaded. A setup page never
+ * replaces a working engine that reads unavailable later: the app's usual waiting view stays while the server checks it
+ * again. */
+export function workedEarlier(instance: EngineRow, worked: Set<string> = workedThisSession): boolean {
+ if (instance.snapshot.state === "available") worked.add(instance.instanceId);
+ return worked.has(instance.instanceId);
+}
+
+/** The "no AI connected" setup page: engines are known and none is there, by checks that answered, and none of them
+ * worked earlier since this page loaded. */
+export function noEnginesDue(state: { connected: boolean; instances: ReadonlyArray<EngineRow> }, worked: Set<string> = workedThisSession): boolean {
+ // Ids repeat across places: what worked is forgotten whenever the live connection drops, as it does on a switch.
+ if (!state.connected) worked.clear();
+ const earlier = state.instances.filter((instance) => workedEarlier(instance, worked));
+ return state.connected && state.instances.length > 0 && !state.instances.some(engineMaybeThere) && earlier.length === 0;
+}
+
export function cloudSignInDue<Instance>(
viewer: WelcomeViewer | null,
state: { connected: boolean; instances: readonly Instance[] },
diff --git a/src/locales/de.json b/src/locales/de.json
index d5eab38d61..1fcf9f0d4b 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -223,6 +223,8 @@
"server.room.turns": "Wartet auf einen Platz: Dieser Server führt {limit} Aufgaben gleichzeitig aus. Davor in der Reihe: {ahead}. Es startet von selbst, sobald eine fertig ist.",
"server.room.turnsStill": "Wartet noch: Dieser Server führt {limit} Aufgaben gleichzeitig aus. Davor in der Reihe: {ahead}.",
"chat.notice.outOfProcesses": "Es ist kein Platz, um ein weiteres Programm zu starten ({code}), deshalb konnte diese Aufgabe nicht laufen. An die KI wurde nichts gesendet. Sie startet von selbst neu, sobald Platz ist.",
+ "chat.notice.cloudBusyStart": "Diese Cloud ist gerade zu ausgelastet, um die KI zu starten, deshalb lief diese Aufgabe nicht. Warte eine Minute und sende sie erneut, beende eine aufwendige laufende Aufgabe oder wechsle für mehr Platz zu einem größeren Plan.",
+ "chat.notice.cloudOutOfCpu": "Deiner Cloud ist für diese Aufgabe die CPU ausgegangen, deshalb konnte die KI nicht starten und nichts lief. Warte eine Minute und sende sie erneut, beende eine aufwendige laufende Aufgabe oder wechsle für mehr CPU zu einem größeren Plan.",
"server.botPaused": "Pausiert: Starter hält {limit} Bots wach. Führe ein Upgrade durch, um ihn zu wecken, oder tausche, welche Bots wach sind.",
"server.starter.routineRanPaused": "@{bot} kümmert sich um „{routine}“ und bleibt sonst pausiert: Starter hält {limit} Bots wach. Seine Routinen und Auslöser laufen trotzdem; um mit ihm zu chatten, schreib ihm eine Nachricht und wähle, welche Bots wach bleiben.",
"server.starter.routineWoke": "@{bot} wurde für „{routine}“ geweckt: Starter hält {limit} Bots wach, deshalb ist @{out}, der eine Weile nichts zu tun hatte, jetzt pausiert. Um das rückgängig zu machen, schreib @{out} eine Nachricht und wähle, welche Bots wach bleiben.",
diff --git a/src/locales/en.json b/src/locales/en.json
index de43bb8b37..ae29ad62ce 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -10481,6 +10481,8 @@
"chat.notice.memoryReclaimedOnly": "Ran out of room, so I stopped this task to keep everything here from freezing.",
"chat.notice.memoryReclaimedOnlyDetail": "Ran out of room, so I stopped this task to keep everything here from freezing. ({detail})",
"chat.notice.outOfProcesses": "There is no room to start another program ({code}), so this task could not run. Nothing was sent to the AI. It starts again by itself when there is room.",
+ "chat.notice.cloudBusyStart": "This Cloud is too busy right now to start the AI, so this task did not run. Wait a minute and send it again, stop a heavy task that is running, or move to a bigger plan for more room.",
+ "chat.notice.cloudOutOfCpu": "The Cloud ran out of CPU for this task, so the AI could not start and nothing ran. Wait a minute and send it again, stop a heavy task that is running, or move to a bigger plan for more CPU.",
"server.personFirst.stoppedSeconds": "Stopped a step that had run for {seconds} s, to answer you first",
"server.personFirst.stoppedMinutes": "Stopped a step that had run for {minutes} min, to answer you first",
"server.runOwner.onlyAskerStops": "Only {name} or an admin can stop this.",
diff --git a/src/locales/es.json b/src/locales/es.json
index 6836429772..8da9f0c5ab 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -6649,5 +6649,7 @@
"phone.reach.offAdding": "Desactivado · Al añadir un teléfono se activan",
"settings.nav.devicesNeedYou": "Un dispositivo o la red privada te necesita",
"settings.nav.phoneConnectedAllClear": "Hay un teléfono conectado y nada te necesita",
- "keys.vps.ownServer": "Tu propio servidor (SSH)"
+ "keys.vps.ownServer": "Tu propio servidor (SSH)",
+ "chat.notice.cloudBusyStart": "Esta Cloud está demasiado ocupada ahora mismo para iniciar la IA, así que esta tarea no se ejecutó. Espera un minuto y vuelve a enviarla, detén una tarea pesada que esté en marcha o pasa a un plan mayor para tener más espacio.",
+ "chat.notice.cloudOutOfCpu": "Tu Cloud se quedó sin CPU para esta tarea, así que la IA no pudo iniciarse y no se ejecutó nada. Espera un minuto y vuelve a enviarla, detén una tarea pesada que esté en marcha o pasa a un plan mayor para tener más CPU."
}
diff --git a/src/locales/fr.json b/src/locales/fr.json
index 840dfcc112..82dca51f57 100644
--- a/src/locales/fr.json
+++ b/src/locales/fr.json
@@ -4057,5 +4057,7 @@
"phone.reach.offAdding": "Désactivé · Ajouter un téléphone les active",
"settings.nav.devicesNeedYou": "Un appareil ou le réseau privé a besoin de vous",
"settings.nav.phoneConnectedAllClear": "Un téléphone est connecté, et rien n’a besoin de vous",
- "keys.vps.ownServer": "Votre propre serveur (SSH)"
+ "keys.vps.ownServer": "Votre propre serveur (SSH)",
+ "chat.notice.cloudBusyStart": "Ce Cloud est trop occupé pour démarrer l'IA en ce moment, donc cette tâche n'a pas été exécutée. Attendez une minute et renvoyez-la, arrêtez une tâche lourde en cours ou passez à un plan supérieur pour avoir plus de place.",
+ "chat.notice.cloudOutOfCpu": "Votre Cloud a manqué de CPU pour cette tâche, donc l'IA n'a pas pu démarrer et rien n'a été exécuté. Attendez une minute et renvoyez-la, arrêtez une tâche lourde en cours ou passez à un plan supérieur pour avoir plus de CPU."
}
diff --git a/src/locales/hi.json b/src/locales/hi.json
index 3e276f887a..da24296221 100644
--- a/src/locales/hi.json
+++ b/src/locales/hi.json
@@ -3909,5 +3909,7 @@
"phone.reach.offAdding": "बंद · फ़ोन जोड़ने पर ये चालू हो जाते हैं",
"settings.nav.devicesNeedYou": "किसी डिवाइस या निजी नेटवर्क को आपकी ज़रूरत है",
"settings.nav.phoneConnectedAllClear": "एक फ़ोन जुड़ा है, और किसी चीज़ को आपकी ज़रूरत नहीं है",
- "keys.vps.ownServer": "आपका अपना सर्वर (SSH)"
+ "keys.vps.ownServer": "आपका अपना सर्वर (SSH)",
+ "chat.notice.cloudBusyStart": "यह Cloud अभी AI शुरू करने के लिए बहुत व्यस्त है, इसलिए यह काम नहीं चला। एक मिनट रुककर इसे फिर से भेजें, चल रहा कोई भारी काम रोकें, या ज़्यादा जगह के लिए बड़े प्लान पर जाएँ।",
+ "chat.notice.cloudOutOfCpu": "इस काम के लिए आपके Cloud का CPU ख़त्म हो गया, इसलिए AI शुरू नहीं हो सका और कुछ नहीं चला। एक मिनट रुककर इसे फिर से भेजें, चल रहा कोई भारी काम रोकें, या ज़्यादा CPU के लिए बड़े प्लान पर जाएँ।"
}
diff --git a/src/locales/it.json b/src/locales/it.json
index 57bf1dd39b..c75d839aef 100644
--- a/src/locales/it.json
+++ b/src/locales/it.json
@@ -10437,6 +10437,8 @@
"chat.notice.memoryReclaimedOnly": "Memoria esaurita, quindi ho interrotto questa attività per evitare che tutto si blocchi.",
"chat.notice.memoryReclaimedOnlyDetail": "Memoria esaurita, quindi ho interrotto questa attività per evitare che tutto si blocchi. ({detail})",
"chat.notice.outOfProcesses": "Spazio insufficiente per avviare un altro programma ({code}), quindi questa attività non è stata eseguita. Non è stato inviato nulla all'AI. Ripartirà automaticamente non appena ci sarà spazio.",
+ "chat.notice.cloudBusyStart": "Questo Cloud è troppo occupato in questo momento per avviare l'IA, quindi questa attività non è partita. Aspetta un minuto e inviala di nuovo, ferma un'attività pesante in corso o passa a un piano più grande per avere più spazio.",
+ "chat.notice.cloudOutOfCpu": "Il tuo Cloud ha esaurito la CPU per questa attività, quindi l'IA non è partita e non è stato eseguito nulla. Aspetta un minuto e inviala di nuovo, ferma un'attività pesante in corso o passa a un piano più grande per avere più CPU.",
"server.personFirst.stoppedSeconds": "ha fermato un passo per {seconds} s, per rispondere prima",
"server.personFirst.stoppedMinutes": "ha fermato un passo per {minutes} min, per rispondere prima",
"server.runOwner.onlyAskerStops": "Solo {name} o un amministratore può fermare questo.",
diff --git a/src/locales/ja.json b/src/locales/ja.json
index 75da991a2e..95226afe8a 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -8183,5 +8183,7 @@
"phone.reach.offAdding": "オフ · スマホを追加するとこれらがオンになります",
"settings.nav.devicesNeedYou": "デバイスまたはプライベートネットワークの対応が必要です",
"settings.nav.phoneConnectedAllClear": "スマホが接続されていて、対応が必要なものはありません",
- "keys.vps.ownServer": "自分のサーバー (SSH)"
+ "keys.vps.ownServer": "自分のサーバー (SSH)",
+ "chat.notice.cloudBusyStart": "この Cloud は今とても混み合っていて AI を起動できなかったため、このタスクは実行されませんでした。1 分ほど待ってからもう一度送るか、実行中の重いタスクを止めるか、余裕のあるより大きなプランに切り替えてください。",
+ "chat.notice.cloudOutOfCpu": "このタスクのための CPU が Cloud で足りなくなったため、AI を起動できず、何も実行されませんでした。1 分ほど待ってからもう一度送るか、実行中の重いタスクを止めるか、CPU に余裕のあるより大きなプランに切り替えてください。"
}
diff --git a/src/locales/ko.json b/src/locales/ko.json
index 89d41ec73a..b163a8212b 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -7873,5 +7873,7 @@
"phone.reach.offAdding": "꺼짐 · 휴대폰을 추가하면 이 설정이 켜져요",
"settings.nav.devicesNeedYou": "기기나 사설 네트워크를 확인해야 해요",
"settings.nav.phoneConnectedAllClear": "휴대폰이 연결되어 있고 확인할 것이 없어요",
- "keys.vps.ownServer": "내 서버 (SSH)"
+ "keys.vps.ownServer": "내 서버 (SSH)",
+ "chat.notice.cloudBusyStart": "지금 이 Cloud가 너무 바빠서 AI를 시작하지 못해 이 작업은 실행되지 않았어요. 1분 정도 기다렸다가 다시 보내거나, 실행 중인 무거운 작업을 멈추거나, 여유 있는 더 큰 요금제로 바꿔 주세요.",
+ "chat.notice.cloudOutOfCpu": "이 작업에 쓸 CPU가 Cloud에서 부족해 AI를 시작하지 못했고 아무것도 실행되지 않았어요. 1분 정도 기다렸다가 다시 보내거나, 실행 중인 무거운 작업을 멈추거나, CPU가 더 많은 더 큰 요금제로 바꿔 주세요."
}
diff --git a/src/locales/pl.json b/src/locales/pl.json
index d7f5b01845..123f635ed3 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -7345,5 +7345,7 @@
"phone.reach.offAdding": "Wyłączone · Dodanie telefonu włącza te opcje",
"settings.nav.devicesNeedYou": "Urządzenie lub sieć prywatna wymaga uwagi",
"settings.nav.phoneConnectedAllClear": "Telefon jest połączony i nic nie wymaga uwagi",
- "keys.vps.ownServer": "Własny serwer (SSH)"
+ "keys.vps.ownServer": "Własny serwer (SSH)",
+ "chat.notice.cloudBusyStart": "Ta chmura jest teraz zbyt zajęta, by uruchomić AI, więc to zadanie się nie wykonało. Poczekaj minutę i wyślij je ponownie, zatrzymaj ciężkie zadanie, które właśnie działa, albo przejdź na większy plan, by mieć więcej miejsca.",
+ "chat.notice.cloudOutOfCpu": "Twojej chmurze zabrakło procesora na to zadanie, więc AI nie mogło się uruchomić i nic się nie wykonało. Poczekaj minutę i wyślij je ponownie, zatrzymaj ciężkie zadanie, które właśnie działa, albo przejdź na większy plan, by mieć więcej procesora."
}
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index e029989906..14c094d34c 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -10392,6 +10392,8 @@
"chat.notice.memoryReclaimedOnly": "Faltou memória, então interrompi esta tarefa para que nada aqui travasse.",
"chat.notice.memoryReclaimedOnlyDetail": "Faltou memória, então interrompi esta tarefa para que nada aqui travasse. ({detail})",
"chat.notice.outOfProcesses": "Não há espaço para iniciar outro programa ({code}), então esta tarefa não pôde rodar. Nada foi enviado à IA. Ela começa de novo sozinha quando houver espaço.",
+ "chat.notice.cloudBusyStart": "Esta Cloud está ocupada demais agora para iniciar a IA, então esta tarefa não rodou. Espere um minuto e envie de novo, pare uma tarefa pesada que esteja rodando ou mude para um plano maior para ter mais espaço.",
+ "chat.notice.cloudOutOfCpu": "Sua Cloud ficou sem CPU para esta tarefa, então a IA não pôde iniciar e nada rodou. Espere um minuto e envie de novo, pare uma tarefa pesada que esteja rodando ou mude para um plano maior para ter mais CPU.",
"server.personFirst.stoppedSeconds": "Interrompi um passo que já durava {seconds} s para responder a você primeiro",
"server.runOwner.onlyAskerStops": "Só {name} ou um administrador pode interromper isto.",
"server.runOwner.notYourQueued": "Só quem enviou esta mensagem pode removê-la.",
diff --git a/src/locales/ru.json b/src/locales/ru.json
index 5bc9904602..7acd587408 100644
--- a/src/locales/ru.json
+++ b/src/locales/ru.json
@@ -7399,5 +7399,7 @@
"phone.reach.offAdding": "Выкл. · При добавлении телефона они включаются",
"settings.nav.devicesNeedYou": "Устройству или частной сети нужно ваше внимание",
"settings.nav.phoneConnectedAllClear": "Телефон подключён, и ничего не требует вашего внимания",
- "keys.vps.ownServer": "Свой сервер (SSH)"
+ "keys.vps.ownServer": "Свой сервер (SSH)",
+ "chat.notice.cloudBusyStart": "Этот Cloud сейчас слишком загружен, чтобы запустить ИИ, поэтому задача не выполнилась. Подождите минуту и отправьте её снова, остановите тяжёлую задачу, которая сейчас работает, или перейдите на более крупный план, чтобы было больше места.",
+ "chat.notice.cloudOutOfCpu": "Вашему Cloud не хватило процессора для этой задачи, поэтому ИИ не смог запуститься и ничего не выполнилось. Подождите минуту и отправьте её снова, остановите тяжёлую задачу, которая сейчас работает, или перейдите на более крупный план, чтобы было больше процессора."
}
diff --git a/src/locales/source-hashes.json b/src/locales/source-hashes.json
index 7516669f46..053a986ac9 100644
--- a/src/locales/source-hashes.json
+++ b/src/locales/source-hashes.json
@@ -3309,6 +3309,8 @@
"server.room.turns": "22d3991e5e5089d0ec7c8997863b7172c73e1bc0bbaf9dc96febeaae98e02d0b",
"server.room.turnsStill": "02e83aa50e246a76d138335f0ba4d12c15efc909de572cb1a27be7ccaee2307f",
"chat.notice.outOfProcesses": "7dd799040935793afd9a12757698c404c5b9d9a83d9a749dda145d05607a5a85",
+ "chat.notice.cloudBusyStart": "6527443654885b972eadaaab2d27d31e2d6376f53209f967e35ea225e898013f",
+ "chat.notice.cloudOutOfCpu": "9ace19c7c64d5f83b31ac29a4bff62cef4cf767c33b1f4ca5d632fd18edea221",
"server.botPaused": "44a1a67145a3178073e8dd5ecbc95a7bba0e9bdb2a4daca56b58c81c0a5a9105",
"botLimit.tasks.title": "406225acaae475dfba01e5670171a780563961c82f6cb05f9c74eed8d564c373",
"botLimit.tasks.body": "8858c581592229bb8a2c27d0c646c80294e5832f15be671067eda856926b55b1",
@@ -10988,7 +10990,9 @@
"cloudSend.changes.lendCommandsHint": "f2454f4eb2cd204a3de88bf81670931a3906f8783641dbd990d3ec0738c7cfa3",
"cloudSend.changes.engine": "5cb26111535a50b4390e44357b933b4f72576dc81f3ab2f4e0026b28a4de864a",
"cloudSend.botMove.goes": "670b500e4fcd0a977b5645e4938a8881cf97f15e76782edaceb4c8f2eadb0062",
- "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236"
+ "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236",
+ "chat.notice.cloudBusyStart": "6527443654885b972eadaaab2d27d31e2d6376f53209f967e35ea225e898013f",
+ "chat.notice.cloudOutOfCpu": "9ace19c7c64d5f83b31ac29a4bff62cef4cf767c33b1f4ca5d632fd18edea221"
},
"fr": {
"pro.fromPrice": "a48a04a457d60b08b54fc83e7a6c4584ffedb1e23621859084900c8521a3af7b",
@@ -15026,7 +15030,9 @@
"cloudSend.changes.lendCommandsHint": "f2454f4eb2cd204a3de88bf81670931a3906f8783641dbd990d3ec0738c7cfa3",
"cloudSend.changes.engine": "5cb26111535a50b4390e44357b933b4f72576dc81f3ab2f4e0026b28a4de864a",
"cloudSend.botMove.goes": "670b500e4fcd0a977b5645e4938a8881cf97f15e76782edaceb4c8f2eadb0062",
- "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236"
+ "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236",
+ "chat.notice.cloudBusyStart": "6527443654885b972eadaaab2d27d31e2d6376f53209f967e35ea225e898013f",
+ "chat.notice.cloudOutOfCpu": "9ace19c7c64d5f83b31ac29a4bff62cef4cf767c33b1f4ca5d632fd18edea221"
},
"hi": {
"pro.fromPrice": "a48a04a457d60b08b54fc83e7a6c4584ffedb1e23621859084900c8521a3af7b",
@@ -18916,7 +18922,9 @@
"cloudSend.changes.lendCommandsHint": "f2454f4eb2cd204a3de88bf81670931a3906f8783641dbd990d3ec0738c7cfa3",
"cloudSend.changes.engine": "5cb26111535a50b4390e44357b933b4f72576dc81f3ab2f4e0026b28a4de864a",
"cloudSend.botMove.goes": "670b500e4fcd0a977b5645e4938a8881cf97f15e76782edaceb4c8f2eadb0062",
- "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236"
+ "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236",
+ "chat.notice.cloudBusyStart": "6527443654885b972eadaaab2d27d31e2d6376f53209f967e35ea225e898013f",
+ "chat.notice.cloudOutOfCpu": "9ace19c7c64d5f83b31ac29a4bff62cef4cf767c33b1f4ca5d632fd18edea221"
},
"ja": {
"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",
@@ -27079,7 +27087,9 @@
"cloudSend.changes.lendCommandsHint": "f2454f4eb2cd204a3de88bf81670931a3906f8783641dbd990d3ec0738c7cfa3",
"cloudSend.changes.engine": "5cb26111535a50b4390e44357b933b4f72576dc81f3ab2f4e0026b28a4de864a",
"cloudSend.botMove.goes": "670b500e4fcd0a977b5645e4938a8881cf97f15e76782edaceb4c8f2eadb0062",
- "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236"
+ "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236",
+ "chat.notice.cloudBusyStart": "6527443654885b972eadaaab2d27d31e2d6376f53209f967e35ea225e898013f",
+ "chat.notice.cloudOutOfCpu": "9ace19c7c64d5f83b31ac29a4bff62cef4cf767c33b1f4ca5d632fd18edea221"
},
"pt-br": {
"voice.gemini.keyPlaceholder": "8c87ba2043a4a89d63c90cae8a6dafd5cbd193652e923b97988e381a74773e10",
@@ -36207,6 +36217,8 @@
"chat.notice.memoryReclaimedBrowserDetail": "29c781b36ba9bc63c701f8ac7c9488b0b116430c3e400ceaa51694c41e3d9050",
"chat.notice.memoryReclaimedTaskDetail": "8692d2880c5425cd005f7002561ae2d7850e41209d0dcf40b1e098a9ea1725f8",
"chat.notice.outOfProcesses": "7dd799040935793afd9a12757698c404c5b9d9a83d9a749dda145d05607a5a85",
+ "chat.notice.cloudBusyStart": "6527443654885b972eadaaab2d27d31e2d6376f53209f967e35ea225e898013f",
+ "chat.notice.cloudOutOfCpu": "9ace19c7c64d5f83b31ac29a4bff62cef4cf767c33b1f4ca5d632fd18edea221",
"server.personFirst.stoppedSeconds": "9ccef9cb0269e710e1fb314a11834a4033b48d66cb54ca6b38e8c7a2fdcb9a8a",
"server.personFirst.stoppedMinutes": "b36afce574a81b8dfc9a4141f280973c6ca5fa7ef4ae008045494b31622ce387",
"server.routines.held.planCancelled": "8a6b13354ba469ae192bc6f6e65a0e40689ade9798eafb23136f6dfdb8a2db48",
@@ -49282,7 +49294,9 @@
"cloudSend.changes.lendCommandsHint": "f2454f4eb2cd204a3de88bf81670931a3906f8783641dbd990d3ec0738c7cfa3",
"cloudSend.changes.engine": "5cb26111535a50b4390e44357b933b4f72576dc81f3ab2f4e0026b28a4de864a",
"cloudSend.botMove.goes": "670b500e4fcd0a977b5645e4938a8881cf97f15e76782edaceb4c8f2eadb0062",
- "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236"
+ "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236",
+ "chat.notice.cloudBusyStart": "6527443654885b972eadaaab2d27d31e2d6376f53209f967e35ea225e898013f",
+ "chat.notice.cloudOutOfCpu": "9ace19c7c64d5f83b31ac29a4bff62cef4cf767c33b1f4ca5d632fd18edea221"
},
"zh-tw": {
"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",
@@ -59723,7 +59737,9 @@
"cloudSend.changes.lendCommandsHint": "f2454f4eb2cd204a3de88bf81670931a3906f8783641dbd990d3ec0738c7cfa3",
"cloudSend.changes.engine": "5cb26111535a50b4390e44357b933b4f72576dc81f3ab2f4e0026b28a4de864a",
"cloudSend.botMove.goes": "670b500e4fcd0a977b5645e4938a8881cf97f15e76782edaceb4c8f2eadb0062",
- "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236"
+ "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236",
+ "chat.notice.cloudBusyStart": "6527443654885b972eadaaab2d27d31e2d6376f53209f967e35ea225e898013f",
+ "chat.notice.cloudOutOfCpu": "9ace19c7c64d5f83b31ac29a4bff62cef4cf767c33b1f4ca5d632fd18edea221"
},
"uk": {
"pro.fromPrice": "a48a04a457d60b08b54fc83e7a6c4584ffedb1e23621859084900c8521a3af7b",
@@ -64032,7 +64048,9 @@
"cloudSend.changes.lendCommandsHint": "f2454f4eb2cd204a3de88bf81670931a3906f8783641dbd990d3ec0738c7cfa3",
"cloudSend.changes.engine": "5cb26111535a50b4390e44357b933b4f72576dc81f3ab2f4e0026b28a4de864a",
"cloudSend.botMove.goes": "670b500e4fcd0a977b5645e4938a8881cf97f15e76782edaceb4c8f2eadb0062",
- "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236"
+ "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236",
+ "chat.notice.cloudBusyStart": "6527443654885b972eadaaab2d27d31e2d6376f53209f967e35ea225e898013f",
+ "chat.notice.cloudOutOfCpu": "9ace19c7c64d5f83b31ac29a4bff62cef4cf767c33b1f4ca5d632fd18edea221"
},
"vi": {
"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",
@@ -70156,7 +70174,9 @@
"cloudSend.changes.lendCommandsHint": "f2454f4eb2cd204a3de88bf81670931a3906f8783641dbd990d3ec0738c7cfa3",
"cloudSend.changes.engine": "5cb26111535a50b4390e44357b933b4f72576dc81f3ab2f4e0026b28a4de864a",
"cloudSend.botMove.goes": "670b500e4fcd0a977b5645e4938a8881cf97f15e76782edaceb4c8f2eadb0062",
- "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236"
+ "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236",
+ "chat.notice.cloudBusyStart": "6527443654885b972eadaaab2d27d31e2d6376f53209f967e35ea225e898013f",
+ "chat.notice.cloudOutOfCpu": "9ace19c7c64d5f83b31ac29a4bff62cef4cf767c33b1f4ca5d632fd18edea221"
},
"tr": {
"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",
@@ -76280,7 +76300,9 @@
"cloudSend.changes.lendCommandsHint": "f2454f4eb2cd204a3de88bf81670931a3906f8783641dbd990d3ec0738c7cfa3",
"cloudSend.changes.engine": "5cb26111535a50b4390e44357b933b4f72576dc81f3ab2f4e0026b28a4de864a",
"cloudSend.botMove.goes": "670b500e4fcd0a977b5645e4938a8881cf97f15e76782edaceb4c8f2eadb0062",
- "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236"
+ "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236",
+ "chat.notice.cloudBusyStart": "6527443654885b972eadaaab2d27d31e2d6376f53209f967e35ea225e898013f",
+ "chat.notice.cloudOutOfCpu": "9ace19c7c64d5f83b31ac29a4bff62cef4cf767c33b1f4ca5d632fd18edea221"
},
"pl": {
"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",
@@ -83605,7 +83627,9 @@
"cloudSend.changes.lendCommandsHint": "f2454f4eb2cd204a3de88bf81670931a3906f8783641dbd990d3ec0738c7cfa3",
"cloudSend.changes.engine": "5cb26111535a50b4390e44357b933b4f72576dc81f3ab2f4e0026b28a4de864a",
"cloudSend.botMove.goes": "670b500e4fcd0a977b5645e4938a8881cf97f15e76782edaceb4c8f2eadb0062",
- "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236"
+ "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236",
+ "chat.notice.cloudBusyStart": "6527443654885b972eadaaab2d27d31e2d6376f53209f967e35ea225e898013f",
+ "chat.notice.cloudOutOfCpu": "9ace19c7c64d5f83b31ac29a4bff62cef4cf767c33b1f4ca5d632fd18edea221"
},
"ru": {
"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",
@@ -90984,7 +91008,9 @@
"cloudSend.changes.lendCommandsHint": "f2454f4eb2cd204a3de88bf81670931a3906f8783641dbd990d3ec0738c7cfa3",
"cloudSend.changes.engine": "5cb26111535a50b4390e44357b933b4f72576dc81f3ab2f4e0026b28a4de864a",
"cloudSend.botMove.goes": "670b500e4fcd0a977b5645e4938a8881cf97f15e76782edaceb4c8f2eadb0062",
- "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236"
+ "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236",
+ "chat.notice.cloudBusyStart": "6527443654885b972eadaaab2d27d31e2d6376f53209f967e35ea225e898013f",
+ "chat.notice.cloudOutOfCpu": "9ace19c7c64d5f83b31ac29a4bff62cef4cf767c33b1f4ca5d632fd18edea221"
},
"it": {
"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",
@@ -101763,6 +101789,8 @@
"chat.notice.memoryReclaimedBrowserDetail": "29c781b36ba9bc63c701f8ac7c9488b0b116430c3e400ceaa51694c41e3d9050",
"chat.notice.memoryReclaimedTaskDetail": "8692d2880c5425cd005f7002561ae2d7850e41209d0dcf40b1e098a9ea1725f8",
"chat.notice.outOfProcesses": "7dd799040935793afd9a12757698c404c5b9d9a83d9a749dda145d05607a5a85",
+ "chat.notice.cloudBusyStart": "6527443654885b972eadaaab2d27d31e2d6376f53209f967e35ea225e898013f",
+ "chat.notice.cloudOutOfCpu": "9ace19c7c64d5f83b31ac29a4bff62cef4cf767c33b1f4ca5d632fd18edea221",
"server.personFirst.stoppedSeconds": "9ccef9cb0269e710e1fb314a11834a4033b48d66cb54ca6b38e8c7a2fdcb9a8a",
"server.personFirst.stoppedMinutes": "b36afce574a81b8dfc9a4141f280973c6ca5fa7ef4ae008045494b31622ce387",
"server.runOwner.onlyAskerStops": "832c893848422bf9040e17b415756f5466d3988354b4e661cb73511be36ff56e",
@@ -110607,7 +110635,9 @@
"cloudSend.changes.lendCommandsHint": "f2454f4eb2cd204a3de88bf81670931a3906f8783641dbd990d3ec0738c7cfa3",
"cloudSend.changes.engine": "5cb26111535a50b4390e44357b933b4f72576dc81f3ab2f4e0026b28a4de864a",
"cloudSend.botMove.goes": "670b500e4fcd0a977b5645e4938a8881cf97f15e76782edaceb4c8f2eadb0062",
- "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236"
+ "cloudSend.changes.commandsTools": "af6e99ce2459132c8aa5a48d21aa12e8e2bbe5d3d4f49b99d7656f947c883236",
+ "chat.notice.cloudBusyStart": "6527443654885b972eadaaab2d27d31e2d6376f53209f967e35ea225e898013f",
+ "chat.notice.cloudOutOfCpu": "9ace19c7c64d5f83b31ac29a4bff62cef4cf767c33b1f4ca5d632fd18edea221"
}
}
}
diff --git a/src/locales/tr.json b/src/locales/tr.json
index bc7452fc7f..13cc41aef2 100644
--- a/src/locales/tr.json
+++ b/src/locales/tr.json
@@ -6144,5 +6144,7 @@
"phone.reach.offAdding": "Kapalı · Telefon eklemek bunları açar",
"settings.nav.devicesNeedYou": "Bir cihazın veya özel ağın ilgilenmenize ihtiyacı var",
"settings.nav.phoneConnectedAllClear": "Bir telefon bağlı ve hiçbir şeyin ilgilenmenize ihtiyacı yok",
- "keys.vps.ownServer": "Kendi sunucunuz (SSH)"
+ "keys.vps.ownServer": "Kendi sunucunuz (SSH)",
+ "chat.notice.cloudBusyStart": "Bu Cloud şu anda yapay zekâyı başlatamayacak kadar meşgul, bu yüzden bu görev çalışmadı. Bir dakika bekleyip yeniden gönderin, çalışan ağır bir görevi durdurun ya da daha fazla yer için daha büyük bir plana geçin.",
+ "chat.notice.cloudOutOfCpu": "Cloud'unuzun bu görev için CPU'su yetmedi, bu yüzden yapay zekâ başlayamadı ve hiçbir şey çalışmadı. Bir dakika bekleyip yeniden gönderin, çalışan ağır bir görevi durdurun ya da daha fazla CPU için daha büyük bir plana geçin."
}
diff --git a/src/locales/uk.json b/src/locales/uk.json
index 38df304cb2..1c5cbc0cb0 100644
--- a/src/locales/uk.json
+++ b/src/locales/uk.json
@@ -4329,5 +4329,7 @@
"phone.reach.offAdding": "Вимк. · Додавання телефона вмикає їх",
"settings.nav.devicesNeedYou": "Пристрою або приватній мережі потрібна ваша увага",
"settings.nav.phoneConnectedAllClear": "Телефон під’єднано, і ніщо не потребує вашої уваги",
- "keys.vps.ownServer": "Власний сервер (SSH)"
+ "keys.vps.ownServer": "Власний сервер (SSH)",
+ "chat.notice.cloudBusyStart": "Цей Cloud зараз надто завантажений, щоб запустити ШІ, тому завдання не виконалося. Зачекайте хвилину й надішліть його знову, зупиніть важке завдання, яке зараз працює, або перейдіть на більший план, щоб мати більше місця.",
+ "chat.notice.cloudOutOfCpu": "Вашому Cloud не вистачило процесора для цього завдання, тому ШІ не зміг запуститися й нічого не виконалося. Зачекайте хвилину й надішліть його знову, зупиніть важке завдання, яке зараз працює, або перейдіть на більший план, щоб мати більше процесора."
}
diff --git a/src/locales/vi.json b/src/locales/vi.json
index b3065d4634..7f51209782 100644
--- a/src/locales/vi.json
+++ b/src/locales/vi.json
@@ -6144,5 +6144,7 @@
"phone.reach.offAdding": "Tắt · Thêm điện thoại sẽ bật các mục này",
"settings.nav.devicesNeedYou": "Một thiết bị hoặc mạng riêng cần bạn",
"settings.nav.phoneConnectedAllClear": "Một điện thoại đang kết nối, và không có gì cần bạn",
- "keys.vps.ownServer": "Máy chủ của riêng bạn (SSH)"
+ "keys.vps.ownServer": "Máy chủ của riêng bạn (SSH)",
+ "chat.notice.cloudBusyStart": "Cloud này hiện quá bận để khởi động AI, nên việc này chưa chạy. Hãy chờ một phút rồi gửi lại, dừng một việc nặng đang chạy, hoặc chuyển sang gói lớn hơn để có thêm chỗ.",
+ "chat.notice.cloudOutOfCpu": "Cloud của bạn đã hết CPU cho việc này, nên AI không khởi động được và chưa có gì chạy. Hãy chờ một phút rồi gửi lại, dừng một việc nặng đang chạy, hoặc chuyển sang gói lớn hơn để có thêm CPU."
}
diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.json
index c7cfed257d..c835e8df3c 100644
--- a/src/locales/zh-tw.json
+++ b/src/locales/zh-tw.json
@@ -10464,5 +10464,7 @@
"phone.reach.offAdding": "已關閉 · 新增手機會開啟這些",
"settings.nav.devicesNeedYou": "有裝置或私人網路需要你處理",
"settings.nav.phoneConnectedAllClear": "有一部手機已連線,沒有需要你處理的事",
- "keys.vps.ownServer": "你自己的伺服器 (SSH)"
+ "keys.vps.ownServer": "你自己的伺服器 (SSH)",
+ "chat.notice.cloudBusyStart": "這個 Cloud 現在太忙,無法啟動 AI,所以這項任務沒有執行。請等一分鐘後再傳送,停止一項正在執行的繁重任務,或改用更大的方案以取得更多空間。",
+ "chat.notice.cloudOutOfCpu": "你的 Cloud 沒有足夠的 CPU 來處理這項任務,所以 AI 無法啟動,什麼也沒有執行。請等一分鐘後再傳送,停止一項正在執行的繁重任務,或改用更大的方案以取得更多 CPU。"
}
diff --git a/src/locales/zh.json b/src/locales/zh.json
index da170c4869..ef3039ccd3 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -10373,5 +10373,7 @@
"phone.reach.offAdding": "已关闭 · 添加手机会开启这些",
"settings.nav.devicesNeedYou": "有设备或私有网络需要你处理",
"settings.nav.phoneConnectedAllClear": "有一部手机已连接,没有需要你处理的事",
- "keys.vps.ownServer": "你自己的服务器 (SSH)"
+ "keys.vps.ownServer": "你自己的服务器 (SSH)",
+ "chat.notice.cloudBusyStart": "这个 Cloud 现在太忙,无法启动 AI,所以这个任务没有运行。请等一分钟后再发送,停止一个正在运行的繁重任务,或换用更大的方案以获得更多空间。",
+ "chat.notice.cloudOutOfCpu": "你的 Cloud 没有足够的 CPU 来处理这个任务,所以 AI 无法启动,什么也没有运行。请等一分钟后再发送,停止一个正在运行的繁重任务,或换用更大的方案以获得更多 CPU。"
}
diff --git a/src/state/store.tsx b/src/state/store.tsx
index 99e99a286c..f12a426fe8 100644
--- a/src/state/store.tsx
+++ b/src/state/store.tsx
@@ -424,7 +424,7 @@ export interface InstanceInfo extends InstanceEndpointInfo {
snapshot: {
state: "available" | "unavailable";
reason?: string;
- authenticated?: boolean; /** The CLI path runs another program, not this engine's CLI. */ notEngineCli?: true; /** Runs Google's native Antigravity CLI. */ nativeCli?: true; /** Its runtime is being installed now. */ installing?: true;
+ authenticated?: boolean; /** Its status check could not finish (a busy machine): not a sign that it is missing. */ busy?: true; /** Installed, not yet confirmed. */ unverified?: true; /** The CLI path runs another program, not this engine's CLI. */ notEngineCli?: true; /** Runs Google's native Antigravity CLI. */ nativeCli?: true; /** Its runtime is being installed now. */ installing?: true;
chatgptPlan?: boolean;
/** Ready only through OpenCode's free no-login models: a backup, never "an AI already works". */
freeFallback?: boolean;