feat(backend): add AIGC generation job API skeleton#10
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1363a59a8e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| job.status = match req.decision { | ||
| GenerationReviewDecision::Approved => GenerationJobStatus::PendingApproval, | ||
| GenerationReviewDecision::NeedsChanges => GenerationJobStatus::PendingReview, | ||
| GenerationReviewDecision::Rejected => GenerationJobStatus::Rejected, | ||
| }; |
There was a problem hiding this comment.
Mark artifacts rejected when review rejects a job
In review_job, a GenerationReviewDecision::Rejected moves the job to GenerationJobStatus::Rejected but never updates generated artifact statuses, so artifacts can remain draft/preview after rejection. This creates an inconsistent state for callers of /v1/generation/jobs/{job_id}/artifacts and can let downstream consumers treat outputs as still usable, unlike the /reject path which does call set_generated_artifact_status.
Useful? React with 👍 / 👎.
| target_type: "generation_job".to_owned(), | ||
| target_id: job.id.to_string(), |
There was a problem hiding this comment.
Emit artifact/stage audit events with matching target types
The shared audit_job helper hardcodes target_type to generation_job for all generation audit events, including GenerationArtifactCreated and GenerationStageCompleted. This prevents consumers from retrieving those events via target_type=generation_artifact or target_type=generation_stage, even though the API now advertises those filters, so audit filtering by target type is effectively broken for non-job generation events.
Useful? React with 👍 / 👎.
Summary
This PR adds the backend skeleton for ArchIToken AI-native AIGC multimodal generation and conversion jobs.
Scope
Adds Generation API endpoints:
POST /v1/generation/jobsGET /v1/generation/jobsGET /v1/generation/jobs/{job_id}POST /v1/generation/jobs/{job_id}/planPOST /v1/generation/jobs/{job_id}/runPOST /v1/generation/jobs/{job_id}/reviewPOST /v1/generation/jobs/{job_id}/approvePOST /v1/generation/jobs/{job_id}/rejectGET /v1/generation/jobs/{job_id}/artifactsAdds in-memory
module_generationservice.Covers 29 AIGC conversion modes:
Implements deterministic mock pipeline:
Emits audit events for generation stages.
Adds OpenAPI schemas for:
GenerationJobGenerationInputGenerationOutputGenerationModeArtifactArtifactKindSkillSpecMcpToolSpecModelRouteGenerationStageGenerationReviewGenerationTraceGenerationJobStatusBoundaries
Verification
cargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warningscargo test --all-targets --all-featurescargo build --release --bin insomeos-gatewaynpx --yes @redocly/cli@2.30.0 lint 04-backend/openapi.yamlnpx --yes @openapitools/openapi-generator-cli@2.23.0 generate -i 04-backend/openapi.yaml -g typescript-fetch -o /tmp/architoken-sdk-tsgit diff --check