fix: add aipod imageRef work-ready runner reuse

This commit is contained in:
AgentRun Codex
2026-06-11 01:21:56 +08:00
parent 59272f8edb
commit 5a6e5a4bbd
22 changed files with 598 additions and 32 deletions
+14 -1
View File
@@ -39,6 +39,12 @@ process.exit(1);
`);
await chmod(fakeKubectl, 0o755);
const store = new MemoryAgentRunStore();
const aipodImageRef = {
kind: "env-image-dockerfile",
repoUrl: "git@github.com:pikasTech/agentrun.git",
commitId: "59272f8edb4e23d805b7b9da0050ec40cfc0233d",
dockerfilePath: "deploy/container/Containerfile",
};
const server = await startManagerServer({
port: 0,
host: "127.0.0.1",
@@ -48,6 +54,7 @@ process.exit(1);
namespace: "agentrun-v01",
managerUrl: "http://agentrun-mgr.agentrun-v01.svc.cluster.local:8080",
image: "127.0.0.1:5000/agentrun/agentrun-mgr@sha256:1111111111111111111111111111111111111111111111111111111111111111",
envIdentity: "selftest-env-identity",
kubectlCommand: fakeKubectl,
unideskSshEndpointEnv: { name: "UNIDESK_MAIN_SERVER_IP", value: "https://unidesk.default.example.test" },
},
@@ -94,7 +101,7 @@ process.exit(1);
resourceBundleRef: null,
payload: { prompt: "queue dispatch hello" },
references: [{ kind: "issue", url: "https://github.com/pikasTech/agentrun/issues/39" }],
metadata: { source: "queue-q2-self-test" },
metadata: { source: "queue-q2-self-test", aipodImageRef },
idempotencyKey: "queue-q2-dispatch-self-test",
}) as QueueTaskRecord;
const dispatchPlan = await runCliJson(context, server.baseUrl, ["queue", "dispatch", String(created.id), "--dry-run", "--attempt-id", "attempt_queue_q2_cli_dryrun"]);
@@ -111,6 +118,12 @@ process.exit(1);
const dispatched = await client.post(`/api/v1/queue/tasks/${created.id}/dispatch`, { attemptId: "attempt_queue_q2_selftest" }) as QueueDispatchResult;
assert.equal(dispatched.action, "queue-dispatch");
assert.equal(dispatched.mutation, true);
assert.equal(((dispatched.envImage as JsonRecord).status), "runtime-default-reused");
assert.equal(((dispatched.envImage as JsonRecord).digestPinned), true);
assert.equal(((dispatched.runnerJob as JsonRecord).image), "127.0.0.1:5000/agentrun/agentrun-mgr@sha256:1111111111111111111111111111111111111111111111111111111111111111");
assert.equal(((((dispatched.runnerJob as JsonRecord).envImage as JsonRecord).imageRef as JsonRecord).dockerfilePath), "deploy/container/Containerfile");
assert.equal(((dispatched.workReady as JsonRecord).valuesPrinted), false);
assert.ok((((dispatched.workReady as JsonRecord).requiredImageTools as string[]) ?? []).includes("npm"));
assert.equal(dispatched.latestAttempt.attemptId, "attempt_queue_q2_selftest");
assert.equal(dispatched.latestAttempt.runId, dispatched.run.id);
assert.equal(dispatched.latestAttempt.commandId, dispatched.command.id);