Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions test/e2e/live/rebuild-hermes-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ export interface RebuildHermesBaseReusePlan {
childEnv: NodeJS.ProcessEnv;
}

/** Supply the current Discord credential when rebuild replaces the legacy provider. */
export function buildRebuildHermesRecreateEnv(
discordBotToken: string,
baseImageEnv: NodeJS.ProcessEnv = {},
): NodeJS.ProcessEnv {
return {
...baseImageEnv,
DISCORD_BOT_TOKEN: discordBotToken,
NEMOCLAW_REBUILD_VERBOSE: "1",
};
}

/** Select the normal lane's exact phase 1 image under a test-owned local alias. */
export function planRebuildHermesBaseReuse(
staleBaseMode: boolean,
Expand Down
15 changes: 10 additions & 5 deletions test/e2e/live/rebuild-hermes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ import {
createRebuildHermesCronRestoreFixture,
hermesRuntimeExecArgs,
} from "./rebuild-hermes-cron-restore.ts";
import { buildRebuildHermesChildEnv, planRebuildHermesBaseReuse } from "./rebuild-hermes-env.ts";
import {
buildRebuildHermesChildEnv,
buildRebuildHermesRecreateEnv,
planRebuildHermesBaseReuse,
} from "./rebuild-hermes-env.ts";
import { ensureRebuildHermesHostTools, hermesApiTokenDigest } from "./rebuild-hermes-host-tools.ts";
import {
cleanupTrackedRebuildHermesImage,
Expand Down Expand Up @@ -1107,10 +1111,11 @@ test(STALE_BASE_REBUILD
);
await artifacts.writeJson("phase-5-inference-route-before-rebuild.json", routeBeforeRebuild);
progress.phase("rebuild the Hermes sandbox");
const rebuildEnv = testEnv(undefined, {
NEMOCLAW_REBUILD_VERBOSE: "1",
...baseReusePlan?.childEnv,
});
const rebuildEnv = testEnv(
undefined,
buildRebuildHermesRecreateEnv(DISCORD_FAKE_TOKEN, baseReusePlan?.childEnv),
);
expect(rebuildEnv.DISCORD_BOT_TOKEN).toBe(DISCORD_FAKE_TOKEN);
expect(rebuildEnv).not.toHaveProperty("NVIDIA_INFERENCE_API_KEY");
expect(rebuildEnv).not.toHaveProperty("COMPATIBLE_API_KEY");
expect(rebuildEnv).not.toHaveProperty("NVIDIA_API_KEY");
Expand Down
21 changes: 21 additions & 0 deletions test/e2e/support/rebuild-hermes-env.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { describe, expect, it } from "vitest";
import type { SandboxBaseImageResolutionMetadata } from "../../../src/lib/sandbox-base-image/types";
import {
buildRebuildHermesChildEnv,
buildRebuildHermesRecreateEnv,
planRebuildHermesBaseReuse,
} from "../live/rebuild-hermes-env.ts";

Expand Down Expand Up @@ -99,4 +100,24 @@ describe("rebuild-Hermes base reuse", () => {
expect(childEnv.NVIDIA_INFERENCE_API_KEY).toBeUndefined();
expect(childEnv.BUILDX_BUILDER).toBeUndefined();
});

it("forwards the Discord credential needed to replace the legacy rebuild provider (#10155)", () => {
const childEnv = buildRebuildHermesChildEnv(
{
COMPATIBLE_API_KEY: "must-not-reach-child",
NVIDIA_API_KEY: "must-not-reach-child",
NVIDIA_INFERENCE_API_KEY: "must-not-reach-child",
},
buildRebuildHermesRecreateEnv("fixture-discord-token", {
NEMOCLAW_HERMES_SANDBOX_BASE_IMAGE_REF: preparedRef,
}),
);

expect(childEnv.DISCORD_BOT_TOKEN).toBe("fixture-discord-token");
expect(childEnv.NEMOCLAW_HERMES_SANDBOX_BASE_IMAGE_REF).toBe(preparedRef);
expect(childEnv.NEMOCLAW_REBUILD_VERBOSE).toBe("1");
expect(childEnv.COMPATIBLE_API_KEY).toBeUndefined();
expect(childEnv.NVIDIA_API_KEY).toBeUndefined();
expect(childEnv.NVIDIA_INFERENCE_API_KEY).toBeUndefined();
});
});
Loading