Skip to content

Commit 702de1a

Browse files
committed
fix(ci): scope direct cloud overrides
1 parent fe08359 commit 702de1a

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

‎scripts/crabbox-wrapper.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,10 +922,10 @@ function shouldRequireBrokeredCloud(commandArgs, providerName) {
922922
if (requestedWorkload(commandArgs)) {
923923
return true;
924924
}
925-
if (directCloudOverrideEnabled(providerName)) {
925+
const explicitProvider = Boolean(commandProvider(commandArgs) || envProvider());
926+
if (explicitProvider && directCloudOverrideEnabled(providerName)) {
926927
return false;
927928
}
928-
const explicitProvider = Boolean(commandProvider(commandArgs) || envProvider());
929929
if (commandArgs[0] === "run" || commandArgs[0] === "warmup") {
930930
// Workload routing never consumes local cloud credentials. Keep the
931931
// shipped direct Azure/Daytona path only for commands outside that policy.

‎test/scripts/crabbox-wrapper.test.ts‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,35 @@ describe("scripts/crabbox-wrapper", () => {
11651165
expect(result.stderr).toContain("provider=azure requires a configured managed Crabbox broker");
11661166
});
11671167

1168+
it.each(["aws", "azure", "daytona"])(
1169+
"does not let direct overrides weaken implicit managed %s config",
1170+
(provider) => {
1171+
const result = runWrapper(
1172+
"provider: aws, azure, blacksmith-testbox, or daytona\n",
1173+
["run", "--", "echo ok"],
1174+
{
1175+
configJson: {
1176+
provider,
1177+
coordinator: "configured-broker",
1178+
brokerMode: "managed",
1179+
brokerAuth: "missing",
1180+
},
1181+
env: {
1182+
OPENCLAW_FAKE_CRABBOX_VERSION: "crabbox 0.40.0",
1183+
OPENCLAW_CRABBOX_ALLOW_DIRECT_CLOUD: "1",
1184+
OPENCLAW_FAKE_CRABBOX_WHOAMI_STATUS: "1",
1185+
},
1186+
},
1187+
);
1188+
1189+
expect(result.status).toBe(2);
1190+
expect(result.stdout).toBe("");
1191+
expect(result.stderr).toContain(
1192+
`provider=${provider} requires a configured managed Crabbox broker`,
1193+
);
1194+
},
1195+
);
1196+
11681197
it("still validates workloads when a provider is explicit", () => {
11691198
const result = runWrapper("provider: aws, azure, blacksmith-testbox, or daytona\n", [
11701199
"run",

0 commit comments

Comments
 (0)