fix: restore codex-api via pod-local forwarder
This commit is contained in:
@@ -21,6 +21,7 @@ async function git(repoRoot, args) {
|
||||
async function makeFixture({
|
||||
serviceId = "hwlab-cloud-api",
|
||||
commitId = "abc1234",
|
||||
deployImageTag = commitId,
|
||||
catalogCommitId = commitId,
|
||||
catalogServiceCommitId = catalogCommitId,
|
||||
catalogImageTag = catalogServiceCommitId.slice(0, 7),
|
||||
@@ -46,19 +47,27 @@ async function makeFixture({
|
||||
} = {}) {
|
||||
const root = await mkdtemp(path.join(os.tmpdir(), "hwlab-desired-state-"));
|
||||
await mkdir(path.join(root, "deploy/k8s/base"), { recursive: true });
|
||||
const image = `127.0.0.1:5000/hwlab/${serviceId}:${commitId}`;
|
||||
const image = `127.0.0.1:5000/hwlab/${serviceId}:${deployImageTag}`;
|
||||
const catalogImage = `127.0.0.1:5000/hwlab/${serviceId}:${catalogImageTag}`;
|
||||
const workloadImage = `127.0.0.1:5000/hwlab/${serviceId}:${workloadTag}`;
|
||||
const providerBaseUrl = "http://172.26.26.227:17680/v1/responses";
|
||||
const providerBaseUrl = "http://127.0.0.1:49280/responses";
|
||||
const providerNoProxy = "hyueapi.com,.hyueapi.com,hyui.com,.hyui.com,127.0.0.1,localhost,::1,api.minimaxi.com,.minimaxi.com";
|
||||
const providerEnv =
|
||||
serviceId === "hwlab-cloud-api" && deployCodeAgentProviderEnv
|
||||
? {
|
||||
HWLAB_CODE_AGENT_PROVIDER: "codex-stdio",
|
||||
HWLAB_CODE_AGENT_MODEL: "gpt-5.5",
|
||||
HWLAB_CODE_AGENT_DEFAULT_PROVIDER_PROFILE: "deepseek",
|
||||
HWLAB_CODE_AGENT_DEEPSEEK_MODEL: "deepseek-chat",
|
||||
HWLAB_CODE_AGENT_DEEPSEEK_BASE_URL: "http://hwlab-deepseek-proxy.hwlab-dev.svc.cluster.local:4000/v1/responses",
|
||||
HWLAB_CODE_AGENT_CODEX_API_MODEL: "gpt-5.5",
|
||||
HWLAB_CODE_AGENT_CODEX_API_BASE_URL: providerBaseUrl,
|
||||
HWLAB_CODE_AGENT_CODEX_API_UPSTREAM_BASE_URL: "https://hyueapi.com",
|
||||
HWLAB_CODE_AGENT_CODEX_API_FORWARDER_PORT: "49280",
|
||||
HWLAB_CODE_AGENT_OPENAI_BASE_URL: providerBaseUrl,
|
||||
CODEX_HOME: "/codex-home",
|
||||
NO_PROXY: "hyueapi.com,.hyueapi.com,hyui.com,.hyui.com,127.0.0.1,localhost,::1,api.minimaxi.com,.minimaxi.com",
|
||||
no_proxy: "hyueapi.com,.hyueapi.com,hyui.com,.hyui.com,127.0.0.1,localhost,::1,api.minimaxi.com,.minimaxi.com",
|
||||
NO_PROXY: providerNoProxy,
|
||||
no_proxy: providerNoProxy,
|
||||
OPENAI_API_KEY: "secretRef:hwlab-code-agent-provider/openai-api-key"
|
||||
}
|
||||
: {};
|
||||
@@ -67,10 +76,17 @@ async function makeFixture({
|
||||
? [
|
||||
{ name: "HWLAB_CODE_AGENT_PROVIDER", value: "codex-stdio" },
|
||||
{ name: "HWLAB_CODE_AGENT_MODEL", value: "gpt-5.5" },
|
||||
{ name: "HWLAB_CODE_AGENT_DEFAULT_PROVIDER_PROFILE", value: "deepseek" },
|
||||
{ name: "HWLAB_CODE_AGENT_DEEPSEEK_MODEL", value: "deepseek-chat" },
|
||||
{ name: "HWLAB_CODE_AGENT_DEEPSEEK_BASE_URL", value: "http://hwlab-deepseek-proxy.hwlab-dev.svc.cluster.local:4000/v1/responses" },
|
||||
{ name: "HWLAB_CODE_AGENT_CODEX_API_MODEL", value: "gpt-5.5" },
|
||||
{ name: "HWLAB_CODE_AGENT_CODEX_API_BASE_URL", value: providerBaseUrl },
|
||||
{ name: "HWLAB_CODE_AGENT_CODEX_API_UPSTREAM_BASE_URL", value: "https://hyueapi.com" },
|
||||
{ name: "HWLAB_CODE_AGENT_CODEX_API_FORWARDER_PORT", value: "49280" },
|
||||
{ name: "HWLAB_CODE_AGENT_OPENAI_BASE_URL", value: providerBaseUrl },
|
||||
{ name: "CODEX_HOME", value: "/codex-home" },
|
||||
{ name: "NO_PROXY", value: "hyueapi.com,.hyueapi.com,hyui.com,.hyui.com,127.0.0.1,localhost,::1,api.minimaxi.com,.minimaxi.com" },
|
||||
{ name: "no_proxy", value: "hyueapi.com,.hyueapi.com,hyui.com,.hyui.com,127.0.0.1,localhost,::1,api.minimaxi.com,.minimaxi.com" },
|
||||
{ name: "NO_PROXY", value: providerNoProxy },
|
||||
{ name: "no_proxy", value: providerNoProxy },
|
||||
{
|
||||
name: "OPENAI_API_KEY",
|
||||
valueFrom: {
|
||||
@@ -195,7 +211,24 @@ async function makeFixture({
|
||||
]
|
||||
}
|
||||
: {})
|
||||
}
|
||||
},
|
||||
...(serviceId === "hwlab-cloud-api" && workloadCodeAgentProviderEnv
|
||||
? [
|
||||
{
|
||||
name: "hwlab-codex-api-forwarder",
|
||||
image: workloadImage,
|
||||
command: ["node", "/app/cmd/hwlab-codex-api-responses-forwarder/main.mjs"],
|
||||
ports: [{ name: "codex-api", containerPort: 49280 }],
|
||||
env: [
|
||||
{ name: "HWLAB_CODE_AGENT_CODEX_API_FORWARDER_HOST", value: "127.0.0.1" },
|
||||
{ name: "HWLAB_CODE_AGENT_CODEX_API_FORWARDER_PORT", value: "49280" },
|
||||
{ name: "HWLAB_CODE_AGENT_CODEX_API_UPSTREAM_BASE_URL", value: "https://hyueapi.com" },
|
||||
{ name: "NO_PROXY", value: providerNoProxy },
|
||||
{ name: "no_proxy", value: providerNoProxy }
|
||||
]
|
||||
}
|
||||
]
|
||||
: [])
|
||||
],
|
||||
...(serviceId === "hwlab-cloud-api" && workloadCodeAgentProviderEnv && workloadCodexHomeVolumes
|
||||
? {
|
||||
@@ -227,6 +260,29 @@ test("passes internally consistent desired-state", async () => {
|
||||
assert.deepEqual(plan.diagnostics, []);
|
||||
});
|
||||
|
||||
test("passes mixed desired-state when unchanged services reuse service-level artifact tags", async () => {
|
||||
const repoRoot = await makeFixture({
|
||||
commitId: "803ba22",
|
||||
deployImageTag: "6a84959",
|
||||
catalogCommitId: "803ba22",
|
||||
catalogServiceCommitId: "6a84959",
|
||||
catalogImageTag: "6a84959",
|
||||
deployEnvCommitId: "6a84959",
|
||||
deployEnvImageTag: "6a84959",
|
||||
workloadTag: "6a84959",
|
||||
workloadEnvCommitId: "6a84959",
|
||||
workloadEnvImageTag: "6a84959"
|
||||
});
|
||||
|
||||
const plan = await buildDesiredStatePlan({ repoRoot });
|
||||
|
||||
assert.equal(plan.status, "pass");
|
||||
assert.equal(plan.summary.desiredCommitId, "803ba22");
|
||||
assert.equal(plan.services[0].deploy.imageTag, "6a84959");
|
||||
assert.equal(plan.services[0].catalog.commitId, "6a84959");
|
||||
assert.deepEqual(plan.diagnostics, []);
|
||||
});
|
||||
|
||||
test("passes when cloud-web owns runtime identity mirrors", async () => {
|
||||
const repoRoot = await makeFixture({ serviceId: "hwlab-cloud-web" });
|
||||
const plan = await buildDesiredStatePlan({ repoRoot });
|
||||
|
||||
Reference in New Issue
Block a user