Skip to content

Commit 94de81e

Browse files
authored
Merge pull request #714 from rogerchappel/fix/blueprint-deploy-openclaw
2 parents a982bb3 + 1577c62 commit 94de81e

2 files changed

Lines changed: 26 additions & 4 deletions

File tree

‎src/lib/blueprint-runtime-provisioning.test.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,26 @@ function agent(overrides: Partial<BlueprintAgentTemplate> = {}): BlueprintAgentT
3030
}
3131

3232
describe("buildBlueprintRuntimeConfigPatch", () => {
33+
it("uses OpenClaw's default agent directory when no agent list exists yet", () => {
34+
const patch = buildBlueprintRuntimeConfigPatch({
35+
config: {
36+
agents: {
37+
defaults: { workspace: "/workspace" },
38+
},
39+
},
40+
agentTemplates: [agent({ callsign: "Cipher" })],
41+
runtimeCapabilities: null,
42+
});
43+
44+
expect(patch.agents.list).toEqual([
45+
expect.objectContaining({
46+
id: "cipher",
47+
workspace: "/workspace/agents/cipher",
48+
}),
49+
]);
50+
expect(patch.agents.list[0]).not.toHaveProperty("agentDir");
51+
});
52+
3353
it("adds provisioned blueprint agents to the OpenClaw agent list and ACP allowlist", () => {
3454
const patch = buildBlueprintRuntimeConfigPatch({
3555
config: {

‎src/lib/blueprint-runtime-provisioning.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ export function buildBlueprintRuntimeConfigPatch(params: {
100100
const agentRoot = inferAgentRoot(existingAgents);
101101
const directReports = buildDirectReportRuntimeRefs(params.agentTemplates);
102102

103-
if (!workspaceRoot || !agentRoot) {
104-
throw new Error("Primary runtime config does not expose agent workspace roots");
103+
if (!workspaceRoot) {
104+
throw new Error("Primary runtime config does not expose an agent workspace root");
105105
}
106106

107107
const blueprintEntries = params.agentTemplates.map((tmpl) => {
@@ -112,13 +112,15 @@ export function buildBlueprintRuntimeConfigPatch(params: {
112112
params.runtimeCapabilities
113113
);
114114
const workspacePath = pathPosix.join(workspaceRoot, "agents", runtimeRef);
115-
const agentDir = pathPosix.join(agentRoot, runtimeRef, "agent");
115+
const agentDir = agentRoot
116+
? pathPosix.join(agentRoot, runtimeRef, "agent")
117+
: null;
116118

117119
return {
118120
id: runtimeRef,
119121
name: runtimeRef,
120122
workspace: workspacePath,
121-
agentDir,
123+
...(agentRoot ? { agentDir } : {}),
122124
model: resolvedModel.primaryModel
123125
? {
124126
primary: resolvedModel.primaryModel,

0 commit comments

Comments
 (0)