Skip to content

Commit 67bde2f

Browse files
committed
fix(ci): keep workload routing broker-only
1 parent dca99ee commit 67bde2f

2 files changed

Lines changed: 20 additions & 26 deletions

File tree

‎scripts/crabbox-wrapper.mjs‎

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -880,19 +880,14 @@ function crabboxProviderReadiness(providerName, versionText, targetContext) {
880880
}
881881
if (
882882
canonicalProvider === "daytona" &&
883-
!directCloudOverrideEnabled(canonicalProvider) &&
884883
!satisfiesMinimumCrabboxVersion(versionText, minimumBrokeredDaytonaCrabboxVersion)
885884
) {
886885
return {
887886
ready: false,
888887
reason: `requires Crabbox >= ${formatVersionTuple(minimumBrokeredDaytonaCrabboxVersion)} for brokered Daytona`,
889888
};
890889
}
891-
if (
892-
["aws", "azure", "daytona"].includes(canonicalProvider) &&
893-
!directCloudOverrideEnabled(canonicalProvider) &&
894-
!managedBrokerAuthConfigured()
895-
) {
890+
if (["aws", "azure", "daytona"].includes(canonicalProvider) && !managedBrokerAuthConfigured()) {
896891
return { ready: false, reason: "managed Crabbox broker auth unavailable" };
897892
}
898893
const doctorArgs = ["doctor", "--provider", canonicalProvider];
@@ -917,30 +912,27 @@ function formatProviderReadiness(readiness) {
917912
}
918913

919914
function shouldRequireBrokeredCloud(commandArgs, providerName) {
920-
if (directCloudOverrideEnabled(providerName)) {
921-
return false;
922-
}
923915
const canonicalProvider = canonicalProviderName(providerName);
924916
if (!["aws", "azure", "daytona"].includes(canonicalProvider)) {
925917
// Blacksmith Testbox is provider-owned and does not use the managed
926918
// coordinator auth required by brokered cloud capacity.
927919
return false;
928920
}
921+
if (requestedWorkload(commandArgs)) {
922+
return true;
923+
}
924+
if (directCloudOverrideEnabled(providerName)) {
925+
return false;
926+
}
929927
if (commandArgs[0] === "run" || commandArgs[0] === "warmup") {
930928
// Workload routing never consumes local cloud credentials. Keep the
931929
// shipped direct Azure/Daytona path only for commands outside that policy.
932-
return (
933-
canonicalProvider === "aws" ||
934-
Boolean(requestedWorkload(commandArgs)) ||
935-
managedBrokerRequested()
936-
);
930+
return canonicalProvider === "aws" || managedBrokerRequested();
937931
}
938932
return (
939933
commandArgs[0] === "actions" &&
940934
commandArgs[1] === "hydrate" &&
941-
(canonicalProvider === "aws" ||
942-
Boolean(requestedWorkload(commandArgs)) ||
943-
managedBrokerRequested())
935+
(canonicalProvider === "aws" || managedBrokerRequested())
944936
);
945937
}
946938

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ describe("scripts/crabbox-wrapper", () => {
10911091
);
10921092
});
10931093

1094-
it("honors direct-cloud debugging during automatic readiness checks", () => {
1094+
it("ignores direct-cloud debugging during automatic readiness checks", () => {
10951095
const result = runWrapper(
10961096
"provider: aws, azure, blacksmith-testbox, or daytona\n",
10971097
["run", "--workload", "desktop", "--", "echo ok"],
@@ -1104,9 +1104,10 @@ describe("scripts/crabbox-wrapper", () => {
11041104
},
11051105
);
11061106

1107-
expect(result.status).toBe(0);
1108-
expect(parseFakeCrabboxOutput(result).args).toContain("azure");
1109-
expect(result.stderr).toContain("selected=azure");
1107+
expect(result.status).toBe(2);
1108+
expect(result.stdout).toBe("");
1109+
expect(result.stderr).toContain("no ready provider for workload=desktop");
1110+
expect(result.stderr).toContain("managed Crabbox broker auth unavailable");
11101111
});
11111112

11121113
it("keeps workload configuration away from administrative commands", () => {
@@ -1234,22 +1235,23 @@ describe("scripts/crabbox-wrapper", () => {
12341235
expect(parseFakeCrabboxOutput(result).args).toContain("daytona");
12351236
});
12361237

1237-
it("allows automatic direct Daytona routing on older Crabbox versions", () => {
1238+
it("does not allow direct cloud overrides inside workload routing", () => {
12381239
const result = runWrapper(
12391240
"provider: aws, azure, blacksmith-testbox, or daytona\n",
12401241
["run", "--workload", "interactive", "--", "echo ok"],
12411242
{
12421243
configJson: { coordinator: "", brokerAuth: "missing" },
12431244
env: {
1244-
OPENCLAW_FAKE_CRABBOX_VERSION: "crabbox 0.39.9",
1245+
OPENCLAW_FAKE_CRABBOX_VERSION: "crabbox 0.40.0",
12451246
OPENCLAW_CRABBOX_ALLOW_DIRECT_CLOUD: "1",
12461247
},
12471248
},
12481249
);
12491250

1250-
expect(result.status).toBe(0);
1251-
expect(parseFakeCrabboxOutput(result).args).toContain("daytona");
1252-
expect(result.stderr).toContain("selected=daytona");
1251+
expect(result.status).toBe(2);
1252+
expect(result.stdout).toBe("");
1253+
expect(result.stderr).toContain("no ready provider for workload=interactive");
1254+
expect(result.stderr).toContain("managed Crabbox broker auth unavailable");
12531255
});
12541256

12551257
it("fails closed when no policy provider is ready", () => {

0 commit comments

Comments
 (0)