Skip to content

Commit 995c75b

Browse files
authored
fix(ci): restore current-main quality gates (#106751)
* fix(ci): restore Control UI quality gates * fix(ci): repair dead export cleanup fallout * fix(ci): repair latest main quality gates * fix(ci): satisfy current-main gate contracts * docs: format Cloud Workers guide * test: isolate context lookup module
1 parent b086cb3 commit 995c75b

19 files changed

Lines changed: 95 additions & 74 deletions

‎docs/gateway/cloud-workers.md‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ Cloud workers are opt-in and invisible until you configure a profile. Unconfigur
1616

1717
## What runs where
1818

19-
| Concern | Location |
20-
| --- | --- |
21-
| Agent loop + tools (`exec`, `read`, `write`, `edit`, …) | Cloud worker box |
22-
| Model inference and provider credentials | Gateway (proxied by `{provider, model}` reference) |
23-
| Transcript (durable, session store) | Gateway |
24-
| Live streaming into the sidebar | Gateway fanout, fed by the worker's replayable event stream |
25-
| Workspace git history | Authored on the box credential-free; the Gateway adopts commits and owns push/PR |
19+
| Concern | Location |
20+
| ------------------------------------------------------- | -------------------------------------------------------------------------------- |
21+
| Agent loop + tools (`exec`, `read`, `write`, `edit`, …) | Cloud worker box |
22+
| Model inference and provider credentials | Gateway (proxied by `{provider, model}` reference) |
23+
| Transcript (durable, session store) | Gateway |
24+
| Live streaming into the sidebar | Gateway fanout, fed by the worker's replayable event stream |
25+
| Workspace git history | Authored on the box credential-free; the Gateway adopts commits and owns push/PR |
2626

2727
The box needs no inbound ports except `sshd` and no egress beyond what your setup command uses: the Gateway connects out via SSH and a reverse tunnel carries the worker's WebSocket back. No Tailscale or VPN required.
2828

@@ -58,12 +58,12 @@ Add a profile under `cloudWorkers.profiles` in `openclaw.json`:
5858

5959
Profile fields:
6060

61-
| Key | Meaning |
62-
| --- | --- |
63-
| `provider` | Worker provider id registered by a plugin (`crabbox` for the bundled plugin). |
64-
| `install` | `bundle` (default) ships the running Gateway's build; `npm` installs the exact released Gateway version with pinned integrity. `npm` requires the Gateway to run from a packaged release. |
65-
| `settings` | Provider-owned JSON. For crabbox: `provider` (backend), `class` (machine class), `ttl`, `idleTimeout` (Go durations), optional `setup` and absolute `binary` path. |
66-
| `lifetime` | Optional stored policy (`idleTimeoutMinutes`, `maxLifetimeMinutes`). |
61+
| Key | Meaning |
62+
| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
63+
| `provider` | Worker provider id registered by a plugin (`crabbox` for the bundled plugin). |
64+
| `install` | `bundle` (default) ships the running Gateway's build; `npm` installs the exact released Gateway version with pinned integrity. `npm` requires the Gateway to run from a packaged release. |
65+
| `settings` | Provider-owned JSON. For crabbox: `provider` (backend), `class` (machine class), `ttl`, `idleTimeout` (Go durations), optional `setup` and absolute `binary` path. |
66+
| `lifetime` | Optional stored policy (`idleTimeoutMinutes`, `maxLifetimeMinutes`). |
6767

6868
### The setup command
6969

‎extensions/bonjour/src/advertiser.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,10 @@ export async function startGatewayBonjourAdvertiser(
466466
`bonjour: ${label} name conflict resolved; newName=${JSON.stringify(name)}`,
467467
);
468468
});
469-
svc.on("hostname-change", (hostname) => {
469+
svc.on("hostname-change", (nextHostname) => {
470470
markConflictObserved(label, svc);
471471
logger.warn(
472-
`bonjour: ${label} hostname conflict resolved; newHostname=${JSON.stringify(hostname)}`,
472+
`bonjour: ${label} hostname conflict resolved; newHostname=${JSON.stringify(nextHostname)}`,
473473
);
474474
});
475475
} catch (err) {
@@ -542,7 +542,7 @@ export async function startGatewayBonjourAdvertiser(
542542
const updateStateTrackers = (services: BonjourCycle) => {
543543
const now = Date.now();
544544
for (const { label, svc } of services) {
545-
const nextState = svc.serviceState;
545+
const nextState: string = svc.serviceState;
546546
const current = stateTracker.get(label);
547547
const nextEnteredAt =
548548
current && current.state !== "announced" && nextState !== "announced"
@@ -629,7 +629,7 @@ export async function startGatewayBonjourAdvertiser(
629629
updateStateTrackers(cycle);
630630
for (const { label, svc } of cycle) {
631631
const now = Date.now();
632-
const state = svc.serviceState;
632+
const state: string = svc.serviceState;
633633
if (state === "announced") {
634634
consecutiveRestarts = 0;
635635
consecutiveStuckStateRestarts = 0;

‎extensions/googlechat/src/google-auth.runtime.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ async function readGoogleAuthResponseBytes(response: Response): Promise<Uint8Arr
493493
}
494494

495495
export async function loadGoogleAuthRuntime(): Promise<GoogleAuthRuntime> {
496-
googleAuthRuntimePromise ??= import("google-auth-library").catch((error) => {
496+
googleAuthRuntimePromise ??= import("google-auth-library").catch((error: unknown) => {
497497
googleAuthRuntimePromise = null;
498498
throw error;
499499
});

‎scripts/check-kysely-guardrails.mjs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const rawSqliteAllowPathGroups = {
3939
"src/infra/sqlite-wal.ts",
4040
"src/state/openclaw-agent-db-session-migrations.ts",
4141
"src/state/openclaw-agent-db.ts",
42+
"src/state/openclaw-state-db-schema-helpers.ts",
4243
"src/state/openclaw-state-db.ts",
4344
"src/state/sqlite-schema-shape.test-support.ts",
4445
],
@@ -64,6 +65,7 @@ const rawSqliteAllowPathGroups = {
6465
"src/infra/state-migrations.storage.ts",
6566
"src/infra/state-migrations.cron-run-logs.ts",
6667
"src/infra/state-migrations.debug-proxy.ts",
68+
"src/infra/state-migrations.task-sidecar-rows.ts",
6769
],
6870
"shared database stores with direct DatabaseSync access": ["src/proxy-capture/store.sqlite.ts"],
6971
"Kysely-backed stores that own a DatabaseSync boundary": [

‎src/agents/bash-tools.exec-runtime.test.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ beforeAll(async () => {
4848
prepareGatewaySuspend,
4949
resetGatewaySuspendCoordinatorForLifecycleRestart,
5050
resumeGatewaySuspend,
51-
} =
52-
await import("../infra/gateway-suspend-coordinator.js"));
51+
} = await import("../infra/gateway-suspend-coordinator.js"));
5352
});
5453

5554
beforeEach(() => {

‎src/agents/context.lookup.test.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// model resolution.
33
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
44
import type { OpenClawConfig } from "../config/types.openclaw.js";
5-
import { lookupCachedContextWindow, providerContextTokenCacheKey } from "./context-cache.js";
65
import { CONTEXT_WINDOW_RUNTIME_STATE } from "./context-runtime-state.js";
76

87
type DiscoveredModel = {
@@ -122,7 +121,7 @@ async function importResolveContextTokensForModel() {
122121

123122
describe("lookupContextTokens", () => {
124123
beforeAll(async () => {
125-
contextModule = await import("./context.js");
124+
contextModule = await importFreshContextModule();
126125
});
127126

128127
beforeEach(() => {
@@ -381,7 +380,10 @@ describe("lookupContextTokens", () => {
381380
await contextModule.ensureContextWindowCacheLoaded();
382381

383382
expect(
384-
lookupCachedContextWindow(providerContextTokenCacheKey("fresh-provider", "fresh-model")),
383+
contextModule.lookupContextTokens("fresh-model", {
384+
allowAsyncLoad: false,
385+
skipRuntimeConfigLoad: true,
386+
}),
385387
).toBe(123_456);
386388
expect(CONTEXT_WINDOW_RUNTIME_STATE.loadPromise).not.toBe(legacyLoadPromise);
387389
expect(CONTEXT_WINDOW_RUNTIME_STATE.loadGeneration).toBe(

‎src/commands/agent.test.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ import { parseSqliteSessionFileMarker } from "../config/sessions/sqlite-marker.j
2626
import { clearSessionStoreCacheForTest } from "../config/sessions/store.js";
2727
import type { SessionEntry } from "../config/sessions/types.js";
2828
import type { OpenClawConfig } from "../config/types.openclaw.js";
29-
import {
30-
emitAgentEvent,
31-
onAgentEvent,
32-
resetAgentEventsForTest,
33-
} from "../infra/agent-events.js";
29+
import { emitAgentEvent, onAgentEvent, resetAgentEventsForTest } from "../infra/agent-events.js";
3430
import type { PluginProviderRegistration } from "../plugins/registry.test-fixtures.js";
3531
import { resetPluginRuntimeStateForTest, setActivePluginRegistry } from "../plugins/runtime.js";
3632
import type { RuntimeEnv } from "../runtime.js";

‎src/commands/onboard-non-interactive/local/auth-choice.plugin-providers.test.ts‎

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,34 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
33
import type { OpenClawConfig } from "../../../config/config.js";
44
import { applyNonInteractivePluginProviderChoice } from "./auth-choice.plugin-providers.js";
55

6+
type RuntimePluginInstallResult = {
7+
cfg: OpenClawConfig;
8+
required: boolean;
9+
installed: boolean;
10+
status?: "installed" | "skipped" | "failed" | "timed_out";
11+
};
12+
613
const ensureCodexRuntimePluginForModelSelection = vi.hoisted(() =>
7-
vi.fn(async ({ cfg }: { cfg: OpenClawConfig }) => ({
8-
cfg,
9-
required: false,
10-
installed: false,
11-
})),
14+
vi.fn(
15+
async ({ cfg }: { cfg: OpenClawConfig }): Promise<RuntimePluginInstallResult> => ({
16+
cfg,
17+
required: false,
18+
installed: false,
19+
}),
20+
),
1221
);
1322
vi.mock("../../codex-runtime-plugin-install.js", () => ({
1423
CODEX_RUNTIME_PLUGIN_ID: "codex",
1524
ensureCodexRuntimePluginForModelSelection,
1625
}));
1726
const ensureCopilotRuntimePluginForModelSelection = vi.hoisted(() =>
18-
vi.fn(async ({ cfg }: { cfg: OpenClawConfig }) => ({
19-
cfg,
20-
required: false,
21-
installed: false,
22-
})),
27+
vi.fn(
28+
async ({ cfg }: { cfg: OpenClawConfig }): Promise<RuntimePluginInstallResult> => ({
29+
cfg,
30+
required: false,
31+
installed: false,
32+
}),
33+
),
2334
);
2435
vi.mock("../../copilot-runtime-plugin-install.js", () => ({
2536
ensureCopilotRuntimePluginForModelSelection,

‎src/config/includes.test.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,10 @@ describe("security: path traversal protection (CWE-22)", () => {
754754
});
755755

756756
it("rejects include paths at or over the platform-safe maximum", () => {
757-
expectResolveIncludeError(() => resolve({ $include: "a".repeat(4096) }, {}), /maximum length/);
757+
expectResolveIncludeError(
758+
() => resolve({ $include: "a".repeat(4096) }, {}),
759+
/maximum length/,
760+
);
758761
expectResolveIncludeError(
759762
() => resolve({ $include: "b".repeat(4097) }, {}),
760763
/maximum length/,
@@ -863,10 +866,7 @@ describe("security: path traversal protection (CWE-22)", () => {
863866
);
864867

865868
expect(() =>
866-
resolveConfigIncludes(
867-
{ $include: "./big.json5" },
868-
path.join(configDir, "openclaw.json"),
869-
),
869+
resolveConfigIncludes({ $include: "./big.json5" }, path.join(configDir, "openclaw.json")),
870870
).toThrow(/security checks|max/i);
871871
});
872872
});

‎src/gateway/server-methods/models-auth-status.test.ts‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ describe("models.authStatus", () => {
380380
mocks.getRuntimeConfig.mockReturnValue({
381381
models: {
382382
providers: {
383-
openrouter: { ...Object.fromEntries([["apiKey", profileId]]) },
383+
openrouter: Object.fromEntries([["apiKey", profileId]]),
384384
},
385385
},
386386
});
@@ -458,11 +458,9 @@ describe("models.authStatus", () => {
458458
mocks.getRuntimeConfig.mockReturnValue({
459459
models: {
460460
providers: {
461-
openai: {
462-
...Object.fromEntries([
463-
["apiKey", { source: "file", provider: "mounted-json", id: "model-provider-key" }],
464-
]),
465-
},
461+
openai: Object.fromEntries([
462+
["apiKey", { source: "file", provider: "mounted-json", id: "model-provider-key" }],
463+
]),
466464
},
467465
},
468466
});
@@ -484,7 +482,7 @@ describe("models.authStatus", () => {
484482
mocks.getRuntimeConfig.mockReturnValue({
485483
models: {
486484
providers: {
487-
anthropic: { ...Object.fromEntries([["apiKey", "ANTHROPIC_API_KEY"]]) },
485+
anthropic: Object.fromEntries([["apiKey", "ANTHROPIC_API_KEY"]]),
488486
},
489487
},
490488
});
@@ -506,7 +504,7 @@ describe("models.authStatus", () => {
506504
mocks.getRuntimeConfig.mockReturnValue({
507505
models: {
508506
providers: {
509-
anthropic: { ...Object.fromEntries([["apiKey", "ANTHROPIC_API_KEY"]]) },
507+
anthropic: Object.fromEntries([["apiKey", "ANTHROPIC_API_KEY"]]),
510508
},
511509
},
512510
});
@@ -527,7 +525,7 @@ describe("models.authStatus", () => {
527525
mocks.getRuntimeConfig.mockReturnValue({
528526
models: {
529527
providers: {
530-
ollama: { ...Object.fromEntries([["apiKey", "ollama-local"]]) },
528+
ollama: Object.fromEntries([["apiKey", "ollama-local"]]),
531529
},
532530
},
533531
});
@@ -546,7 +544,7 @@ describe("models.authStatus", () => {
546544
const profileId = "anthropic:saved";
547545
mocks.getRuntimeConfig.mockReturnValue({
548546
models: {
549-
providers: { anthropic: { ...Object.fromEntries([["apiKey", profileId]]) } },
547+
providers: { anthropic: Object.fromEntries([["apiKey", profileId]]) },
550548
},
551549
});
552550
mocks.ensureAuthProfileStore.mockReturnValue({
@@ -1140,7 +1138,7 @@ describe("models.authLogout", () => {
11401138
mocks.getRuntimeConfig.mockReturnValue({
11411139
models: {
11421140
providers: {
1143-
openrouter: { ...Object.fromEntries([["apiKey", profileId]]) },
1141+
openrouter: Object.fromEntries([["apiKey", profileId]]),
11441142
},
11451143
},
11461144
});

0 commit comments

Comments
 (0)