fix: trace codex stdio lifecycle

This commit is contained in:
lyon
2026-06-20 15:32:46 +08:00
parent da2e9807bc
commit e53e7c2c3c
9 changed files with 423 additions and 28 deletions
+4
View File
@@ -198,6 +198,7 @@ export async function createKubernetesRunnerJob(options: { store: AgentRunStore;
mutation: true,
runId: run.id,
commandId,
runnerJobId: render.runnerJobId,
attemptId: render.attemptId,
runnerId: render.runnerId,
namespace: render.namespace,
@@ -213,6 +214,7 @@ export async function createKubernetesRunnerJob(options: { store: AgentRunStore;
runner: {
runId: run.id,
commandId,
runnerJobId: render.runnerJobId,
attemptId: render.attemptId,
runnerId: render.runnerId,
backendProfile: run.backendProfile,
@@ -250,6 +252,7 @@ export async function createKubernetesRunnerJob(options: { store: AgentRunStore;
},
} satisfies JsonRecord;
const saved = await options.store.saveRunnerJob({
id: render.runnerJobId,
runId: run.id,
commandId,
idempotencyKey: idempotencyKey ?? null,
@@ -267,6 +270,7 @@ export async function createKubernetesRunnerJob(options: { store: AgentRunStore;
await options.store.appendEvent(run.id, "backend_status", {
phase: "runner-job-created",
commandId,
runnerJobId: saved.id,
attemptId: saved.attemptId,
runnerId: saved.runnerId,
namespace: saved.namespace,
+1 -1
View File
@@ -571,7 +571,7 @@ CREATE TABLE IF NOT EXISTS agentrun_schema_migrations (
}
}
const at = nowIso();
const record: RunnerJobRecord = { ...input, id: newId("rjob"), idempotencyKey: input.idempotencyKey ?? null, serviceAccountName: input.serviceAccountName ?? null, createdAt: at, updatedAt: at };
const record: RunnerJobRecord = { ...input, id: input.id ?? newId("rjob"), idempotencyKey: input.idempotencyKey ?? null, serviceAccountName: input.serviceAccountName ?? null, createdAt: at, updatedAt: at };
const inserted = await client.query(
`INSERT INTO agentrun_runner_jobs (id, run_id, command_id, idempotency_key, payload_hash, attempt_id, runner_id, namespace, job_name, manager_url, image, source_commit, service_account_name, result, created_at, updated_at)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14::jsonb, $15, $16)
+2 -1
View File
@@ -89,6 +89,7 @@ export interface UpdateQueueTaskAttemptInput {
}
export interface SaveRunnerJobInput {
id?: string;
runId: string;
commandId: string;
idempotencyKey?: string | null;
@@ -213,7 +214,7 @@ export class MemoryAgentRunStore implements AgentRunStore {
if (existing) return existing;
}
const at = nowIso();
const record: RunnerJobRecord = { ...input, id: newId("rjob"), idempotencyKey: input.idempotencyKey ?? null, serviceAccountName: input.serviceAccountName ?? null, createdAt: at, updatedAt: at };
const record: RunnerJobRecord = { ...input, id: input.id ?? newId("rjob"), idempotencyKey: input.idempotencyKey ?? null, serviceAccountName: input.serviceAccountName ?? null, createdAt: at, updatedAt: at };
this.runnerJobs.set(record.id, record);
return record;
}