Skip to content

Requeue Generated Code

Target migration note: this endpoint must not re-trigger guinness-ai-v2/apps/des2code. Des2Code is re-triggered through the Des2Code API or MCP v2, and completion is delivered by the AI status webhook.

Method

REST method is adopted.

HTTP Method

POST: Requeue failed generated code

Naming Convention

To unify the naming of query parameters and nodes and improve readability, snake_case is used for URIs and JSON nodes in requests.

Request and Response

Headers

Meta information is set in HTTP headers, not in the response body.

Request Headers

  • Authorization
  • Content-Type
  • Accept
  • Accept-language

Response Headers

  • Content-Type

Requeue Generated Code

URI

POST /v1/organizations/{organization_id}/projects/{project_id}/generated_codes/{code_id}/requeue

Path Parameters

Name Type Required Description
organization_id string Required Organization UUID
project_id string Required Project UUID
code_id string Required Generated code UUID

Request Body

No request body is required.

Response

The response is JSON.

{
  "message": "Code generation requeued successfully",
  "id": "generated-code-uuid",
  "status": 0
}

Response Fields

Name Type Description
message string Success message
id string Generated code UUID
status number New status (0: pending)

Authentication

Authentication is performed using JSON Web Tokens (JWT) issued by Amazon Cognito.

Error Handling

The status codes for error handling are as follows.

Description Status Code Status Name
Missing credentials 401 Unauthorized
Insufficient permissions 403 Forbidden
Generated code, project, or organization not found 404 Not Found
Internal server error 500 Internal Server Error

Processing Flow

  1. Extract organization ID, project ID, and code ID from path parameters
  2. Verify the user has access to the project
  3. Verify the generated code belongs to the specified project
  4. Reset the status to 0 (pending)
  5. Re-trigger only the retained legacy generated-code workflow; do not send to the des2code queue
  6. Return success message

Detailed Flowchart

flowchart TD
    Start([POST requeue]) --> Auth[Auth & Parameter Extraction]
    Auth --> Service[Service Layer]
    Service --> AccessCheck[Access Check]
    AccessCheck --> HasAccess{Write permission?}
    HasAccess -->|No| Err404[404 Not Found]
    HasAccess -->|Yes| CheckExist[Check existing]
    CheckExist --> Exists{Exists?}
    Exists -->|No| Err404
    Exists -->|Yes| ResetStatus[Update status=0<br/>pending]
    ResetStatus --> TriggerProcess[Re-trigger retained legacy workflow]
    TriggerProcess --> Success[200 OK<br/>Requeued successfully]

Purpose

This endpoint is used only if the legacy generated-code workflow is retained. The status is reset to 0 (pending) and that workflow attempts processing again. It is not part of the target guinness-ai-v2 Des2Code path.