Task 007 add agent job admin runner follow-up

This commit is contained in:
2026-05-21 19:33:24 +03:00
parent 4fd837349f
commit 8aa92ea728
16 changed files with 826 additions and 29 deletions
+419 -23
View File
@@ -19,6 +19,23 @@
"title": "AgentJobErrorCategory",
"type": "string"
},
"AgentJobListResponse": {
"additionalProperties": false,
"properties": {
"jobs": {
"items": {
"$ref": "#/components/schemas/AgentJobSummary"
},
"title": "Jobs",
"type": "array"
}
},
"required": [
"jobs"
],
"title": "AgentJobListResponse",
"type": "object"
},
"AgentJobOutput": {
"additionalProperties": false,
"properties": {
@@ -74,6 +91,19 @@
"title": "AgentJobOutput",
"type": "object"
},
"AgentJobResponse": {
"additionalProperties": false,
"properties": {
"job": {
"$ref": "#/components/schemas/AgentJobSummary"
}
},
"required": [
"job"
],
"title": "AgentJobResponse",
"type": "object"
},
"AgentJobStatus": {
"enum": [
"QUEUED",
@@ -94,9 +124,36 @@
"type": "string"
},
"article_id": {
"format": "uuid",
"title": "Article Id",
"type": "string"
"anyOf": [
{
"format": "uuid",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Article Id"
},
"attempt": {
"default": 1,
"minimum": 1,
"title": "Attempt",
"type": "integer"
},
"duration_ms": {
"anyOf": [
{
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Duration Ms"
},
"error_category": {
"anyOf": [
@@ -121,6 +178,18 @@
"default": null,
"title": "Error Message"
},
"exit_code": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Exit Code"
},
"finished_at": {
"anyOf": [
{
@@ -156,6 +225,24 @@
"title": "Output Files",
"type": "array"
},
"parent_job_id": {
"anyOf": [
{
"format": "uuid",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Parent Job Id"
},
"queued_at": {
"format": "date-time",
"title": "Queued At",
"type": "string"
},
"started_at": {
"anyOf": [
{
@@ -172,6 +259,16 @@
"status": {
"$ref": "#/components/schemas/AgentJobStatus"
},
"stderr": {
"default": "",
"title": "Stderr",
"type": "string"
},
"stdout": {
"default": "",
"title": "Stdout",
"type": "string"
},
"workspace_path": {
"anyOf": [
{
@@ -187,14 +284,27 @@
},
"required": [
"id",
"article_id",
"job_type",
"agent_profile",
"status"
"status",
"queued_at"
],
"title": "AgentJobSummary",
"type": "object"
},
"AgentJobTestCodexRequest": {
"additionalProperties": false,
"properties": {
"fake_result": {
"default": "valid",
"pattern": "^(valid|invalid_schema)$",
"title": "Fake Result",
"type": "string"
}
},
"title": "AgentJobTestCodexRequest",
"type": "object"
},
"AgentJobType": {
"enum": [
"BOUNDARY_QUESTIONS",
@@ -1563,16 +1673,6 @@
"ScriptConfigVersionSummary": {
"additionalProperties": false,
"properties": {
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"created_by": {
"format": "uuid",
"title": "Created By",
"type": "string"
},
"activated_at": {
"anyOf": [
{
@@ -1583,8 +1683,19 @@
"type": "null"
}
],
"default": null,
"title": "Activated At"
},
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"created_by": {
"format": "uuid",
"title": "Created By",
"type": "string"
},
"diff": {
"additionalProperties": true,
"title": "Diff",
@@ -1600,14 +1711,6 @@
"title": "Publishing Yaml Hash",
"type": "string"
},
"status": {
"$ref": "#/components/schemas/ScriptConfigVersionStatus"
},
"target_site_id": {
"format": "uuid",
"title": "Target Site Id",
"type": "string"
},
"rollback_target_version_id": {
"anyOf": [
{
@@ -1618,8 +1721,17 @@
"type": "null"
}
],
"default": null,
"title": "Rollback Target Version Id"
},
"status": {
"$ref": "#/components/schemas/ScriptConfigVersionStatus"
},
"target_site_id": {
"format": "uuid",
"title": "Target Site Id",
"type": "string"
},
"transform_script_hash": {
"minLength": 1,
"title": "Transform Script Hash",
@@ -2116,6 +2228,290 @@
},
"openapi": "3.1.0",
"paths": {
"/api/agent-jobs": {
"get": {
"operationId": "get_agent_jobs_api_agent_jobs_get",
"parameters": [
{
"in": "header",
"name": "X-Demo-User-Email",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Demo-User-Email"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentJobListResponse"
}
}
},
"description": "Successful Response"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Get Agent Jobs",
"tags": [
"agent-jobs"
]
}
},
"/api/agent-jobs/test-codex": {
"post": {
"operationId": "post_test_codex_job_api_agent_jobs_test_codex_post",
"parameters": [
{
"in": "header",
"name": "X-Demo-User-Email",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Demo-User-Email"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentJobTestCodexRequest"
}
}
}
},
"responses": {
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentJobResponse"
}
}
},
"description": "Successful Response"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Post Test Codex Job",
"tags": [
"agent-jobs"
]
}
},
"/api/agent-jobs/{job_id}": {
"get": {
"operationId": "get_agent_job_route_api_agent_jobs__job_id__get",
"parameters": [
{
"in": "path",
"name": "job_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Job Id",
"type": "string"
}
},
{
"in": "header",
"name": "X-Demo-User-Email",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Demo-User-Email"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentJobResponse"
}
}
},
"description": "Successful Response"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Get Agent Job Route",
"tags": [
"agent-jobs"
]
}
},
"/api/agent-jobs/{job_id}/cancel": {
"post": {
"operationId": "post_cancel_agent_job_api_agent_jobs__job_id__cancel_post",
"parameters": [
{
"in": "path",
"name": "job_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Job Id",
"type": "string"
}
},
{
"in": "header",
"name": "X-Demo-User-Email",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Demo-User-Email"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentJobResponse"
}
}
},
"description": "Successful Response"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Post Cancel Agent Job",
"tags": [
"agent-jobs"
]
}
},
"/api/agent-jobs/{job_id}/retry": {
"post": {
"operationId": "post_retry_agent_job_api_agent_jobs__job_id__retry_post",
"parameters": [
{
"in": "path",
"name": "job_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Job Id",
"type": "string"
}
},
{
"in": "header",
"name": "X-Demo-User-Email",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Demo-User-Email"
}
}
],
"responses": {
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentJobResponse"
}
}
},
"description": "Successful Response"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Post Retry Agent Job",
"tags": [
"agent-jobs"
]
}
},
"/api/articles": {
"get": {
"operationId": "list_articles_route_api_articles_get",
+23 -4
View File
@@ -3,6 +3,10 @@
export type AgentJobErrorCategory = "FAILED_SCHEMA_VALIDATION" | "CLI_EXIT_CODE_FAILURE" | "TIMEOUT" | "MISSING_OUTPUT_FILE" | "UNSUPPORTED_CLAIMS_FOUND" | "SOURCE_RETRIEVAL_FAILED" | "RESEARCH_ARTIFACT_UPLOAD_FAILED" | "PUBLISH_DRY_RUN_FAILED" | "GIT_CHECKOUT_FAILED" | "GIT_COMMIT_FAILED" | "GIT_PUSH_NON_FAST_FORWARD" | "PUBLISH_VERIFICATION_FAILED";
export type AgentJobListResponse = {
jobs: AgentJobSummary[];
};
export type AgentJobOutput = {
artifacts?: ResearchArtifactSummary[];
error_category?: AgentJobErrorCategory | null;
@@ -12,23 +16,38 @@ export type AgentJobOutput = {
status: AgentJobStatus;
};
export type AgentJobResponse = {
job: AgentJobSummary;
};
export type AgentJobStatus = "QUEUED" | "RUNNING" | "SUCCEEDED" | "FAILED" | "CANCELLED";
export type AgentJobSummary = {
agent_profile: string;
article_id: string;
article_id?: string | null;
attempt?: number;
duration_ms?: number | null;
error_category?: AgentJobErrorCategory | null;
error_message?: string | null;
exit_code?: number | null;
finished_at?: string | null;
id: string;
input_files?: RunnerFileRef[];
job_type: AgentJobType;
output_files?: RunnerFileRef[];
parent_job_id?: string | null;
queued_at: string;
started_at?: string | null;
status: AgentJobStatus;
stderr?: string;
stdout?: string;
workspace_path?: string | null;
};
export type AgentJobTestCodexRequest = {
fake_result?: string;
};
export type AgentJobType = "BOUNDARY_QUESTIONS" | "PLAN_GENERATION" | "RESEARCH" | "EVIDENCE_MATRIX" | "SECTION_SCAFFOLD" | "DRAFT_ASSEMBLY" | "SEO_REVIEW" | "LANGUAGE_REVIEW" | "PUBLISH_DRY_RUN" | "PUBLISH_COMMIT" | "TEST_CODEX";
export type ArticleCreateRequest = {
@@ -266,15 +285,15 @@ export type ScriptConfigVersionResponse = {
export type ScriptConfigVersionStatus = "DRAFT" | "ACTIVE" | "DEPRECATED";
export type ScriptConfigVersionSummary = {
activated_at?: string | null;
created_at: string;
created_by: string;
activated_at?: string | null;
diff: Record<string, unknown>;
diff?: Record<string, unknown>;
id: string;
publishing_yaml_hash: string;
rollback_target_version_id?: string | null;
status: ScriptConfigVersionStatus;
target_site_id: string;
rollback_target_version_id?: string | null;
transform_script_hash: string;
version: number;
};