> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codecobra.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Fix Ci

> Compose the agent's fix-CI prompt for the given PR — does NOT
send it. The frontend takes the prompt and calls the normal
sendMessage flow so the chat UI reacts as if the user typed it.

The composition is server-side because we re-fetch the current
failing-check names from GitHub right before building the prompt;
that keeps the model's context fresh and avoids the frontend
duplicating the github_service round-trip + failure aggregation
logic. The user message that lands in chat IS the prompt below —
so the user can read exactly what was asked, and any follow-up
turns can refer to it like any other message.



## OpenAPI

````yaml /openapi.json post /api/tasks/{task_id}/prs/{pr_id}/fix-ci
openapi: 3.1.0
info:
  description: >-
    Public CodeCobra API. Authenticate by sending a personal API key in the
    `Authorization: Bearer <key>` header. Generate keys from Settings → API keys
    in the CodeCobra dashboard.
  title: CodeCobra Public API
  version: 1.0.0
servers: []
security: []
paths:
  /api/tasks/{task_id}/prs/{pr_id}/fix-ci:
    post:
      tags:
        - public
      summary: Fix Ci
      description: |-
        Compose the agent's fix-CI prompt for the given PR — does NOT
        send it. The frontend takes the prompt and calls the normal
        sendMessage flow so the chat UI reacts as if the user typed it.

        The composition is server-side because we re-fetch the current
        failing-check names from GitHub right before building the prompt;
        that keeps the model's context fresh and avoids the frontend
        duplicating the github_service round-trip + failure aggregation
        logic. The user message that lands in chat IS the prompt below —
        so the user can read exactly what was asked, and any follow-up
        turns can refer to it like any other message.
      operationId: fix_ci_api_tasks__task_id__prs__pr_id__fix_ci_post
      parameters:
        - in: path
          name: task_id
          required: true
          schema:
            format: uuid
            title: Task Id
            type: string
        - in: path
          name: pr_id
          required: true
          schema:
            format: uuid
            title: Pr Id
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FixCiPromptResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - HTTPBearer: []
components:
  schemas:
    FixCiPromptResponse:
      description: |-
        Server-composed fix-CI prompt for the frontend to send as a
        system-event chat message via the existing useTaskStream.sendMessage
        flow. Returning the prompt (rather than streaming the message
        server-side) lets the chat UI render the optimistic chip, stream the
        assistant chunks live, and persist the exchange via the same code
        path as a hand-typed message — no separate "did the chat update?"
        plumbing for synthetic messages.

        `display` is the short chip text the chat should SHOW (persisted as
        the message content via TaskMessageCreate.display_content); `prompt`
        is the full instruction only the agent receives. `kind` is always
        "system_event" — echoed so the frontend forwards it verbatim.
      properties:
        display:
          default: ''
          title: Display
          type: string
        kind:
          default: system_event
          title: Kind
          type: string
        prompt:
          title: Prompt
          type: string
      required:
        - prompt
      title: FixCiPromptResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    HTTPBearer:
      scheme: bearer
      type: http

````