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

# Feedback do Desenvolvedor

> Submete feedback humano sobre um postmortem — permite ao desenvolvedor avaliar a precisao da remediação, sobrescrever a root cause e adicionar comentarios

<ParamField path="name" type="string" required>
  Nome único do postmortem (ex.: `PM-20260319-001`)
</ParamField>

<ParamField query="namespace" type="string" default="default">
  Namespace Kubernetes
</ParamField>

<ParamField body="providedBy" type="string" required>
  Identificador de quem está fornecendo o feedback (ex.: email ou nome de usuário). Máximo 253 caracteres.
</ParamField>

<ParamField body="remediationAccuracy" type="integer" required>
  Nota de 1 a 5 para a precisao da remediação automática da IA

  * **1** — Completamente errada, não resolveu nada
  * **2** — Parcialmente correta, mas com problemas significativos
  * **3** — Razoavel, resolveu mas com ajustes manuais
  * **4** — Boa, resolveu com observações menores
  * **5** — Excelente, remediação perfeita
</ParamField>

<ParamField body="overrideRootCause" type="string">
  Causa raiz fornecida pelo humano (sobrescreve a análise da IA). Deixe vazio para manter a root cause original. Máximo 4096 caracteres.
</ParamField>

<ParamField body="comments" type="string">
  Comentarios adicionais sobre o postmortem ou a remediação. Máximo 4096 caracteres.
</ParamField>

## Quando Usar

Após revisar um postmortem na Dashboard, o desenvolvedor pode fornecer feedback estruturado:

1. **Avaliar a remediação** — classificar de 1 a 5 a precisao da ação automatica
2. **Corrigir root cause** — sobrescrever a causa raiz se a IA errou ou foi imprecisa
3. **Adicionar contexto** — comentarios com informações que a IA não tinha acesso

O feedback e exibido diretamente na Dashboard e fica persistido no status do PostMortem CR.

<Note>
  Requer role `operator` ou superior. O campo `providedBy` e obrigatório para rastreabilidade.
  Submeter feedback novamente sobrescreve o feedback anterior. Em caso de conflito concorrente, a API retorna `409 Conflict`.
</Note>

<ResponseExample>
  ```json Response 200 theme={"system"}
  {
    "apiVersion": "v1",
    "kind": "PostMortem",
    "resourceMeta": {
      "name": "PM-20260319-001",
      "namespace": "production"
    },
    "status": {
      "state": "InReview",
      "feedback": {
        "overrideRootCause": "Leak causado por goroutine não cancelada no webhook handler, não pelo response body",
        "remediationAccuracy": 4,
        "comments": "Boa análise. Sugerir AdjustResources antes de restart na proxima vez.",
        "providedBy": "sre@empresa.com",
        "providedAt": "2026-03-19T09:00:00Z"
      }
    }
  }
  ```
</ResponseExample>

<ResponseExample>
  ```json Response 400 theme={"system"}
  {
    "apiVersion": "v1",
    "kind": "Error",
    "error": "remediationAccuracy must be between 1 and 5",
    "code": 400
  }
  ```
</ResponseExample>

<ResponseExample>
  ```json Response 409 theme={"system"}
  {
    "apiVersion": "v1",
    "kind": "Error",
    "error": "postmortem was modified concurrently, please retry",
    "code": 409
  }
  ```
</ResponseExample>


## OpenAPI

````yaml POST /postmortems/{name}/feedback
openapi: 3.1.0
info:
  title: ChatCLI AIOps Platform API
  description: >-
    REST API for the ChatCLI AIOps Platform — incidents, SLOs, runbooks,
    approvals, postmortems, analytics, audit, federation and health.


    The playground below uses **editable server variables** so you can point
    requests at your own self-hosted instance. Adjust `host`, `port` and
    `basePath` to match your deployment, then click **Try it**.
  version: 1.0.0
  contact:
    name: ChatCLI
    url: https://github.com/diillson/chatcli
  license:
    name: Apache-2.0
    identifier: Apache-2.0
servers:
  - url: http://{host}:{port}/{basePath}
    description: >-
      Self-hosted ChatCLI AIOps Platform — adjust host, port and basePath to
      match your deployment.
    variables:
      host:
        default: localhost
        description: >-
          Hostname or IP of your ChatCLI operator. For Kubernetes, use the
          Service DNS (e.g. chatcli-api.chatcli-system.svc) or your Ingress
          host.
      port:
        default: '8090'
        description: >-
          Port the API listens on. Default is 8090; configurable via Helm value
          `apiPort` or env var CHATCLI_API_PORT.
      basePath:
        default: api/v1
        description: >-
          API base path. Always `api/v1` unless you have a custom proxy rewrite
          in front of the operator.
security:
  - ApiKeyAuth: []
tags:
  - name: Incidents
    description: >-
      Incident lifecycle: list, fetch, acknowledge, resolve, snooze, timeline
      and remediation views.
  - name: Runbooks
    description: Remediation runbooks (list, create, update, delete).
  - name: SLOs
    description: Service Level Objectives and error budgets.
  - name: Approvals
    description: Approval workflow for risky remediations.
  - name: Postmortems
    description: Auto-generated postmortems with review, feedback and close.
  - name: Remediations
    description: Remediation plans and agentic execution history.
  - name: AI Insights
    description: AI root-cause analysis and recommendations per incident.
  - name: Analytics
    description: 'Operational analytics: MTTD, MTTR, trends, capacity, compliance.'
  - name: Audit
    description: Immutable audit log and exports.
  - name: Federation
    description: 'Multi-cluster federation: clusters, status and cross-cluster correlations.'
  - name: Health
    description: Liveness and readiness probes.
paths:
  /postmortems/{name}/feedback:
    post:
      tags:
        - Postmortems
      summary: Postmortem Feedback
      description: >-
        Submits human feedback on a postmortem — lets the developer rate
        remediation accuracy, override the root cause and add comments.
      operationId: feedbackPostmortem
      parameters:
        - name: name
          in: path
          required: true
          description: Unique postmortem name.
          schema:
            type: string
            example: PM-20260319-001
        - name: namespace
          in: query
          required: false
          description: Kubernetes namespace.
          schema:
            type: string
            default: default
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - providedBy
                - remediationAccuracy
              properties:
                providedBy:
                  type: string
                  maxLength: 253
                  description: Identifier of the feedback author. Max 253 chars.
                  example: sre@empresa.com
                remediationAccuracy:
                  type: integer
                  minimum: 1
                  maximum: 5
                  description: Score 1-5 for AI remediation accuracy.
                  example: 4
                overrideRootCause:
                  type: string
                  maxLength: 4096
                  description: >-
                    Human-provided root cause overriding AI analysis. Max 4096
                    chars.
                comments:
                  type: string
                  maxLength: 4096
                  description: Additional comments. Max 4096 chars.
            example:
              providedBy: sre@empresa.com
              remediationAccuracy: 4
              overrideRootCause: >-
                Leak caused by uncancelled goroutine in webhook handler, not the
                response body.
              comments: Good analysis. Suggest AdjustResources before restart next time.
      responses:
        '200':
          description: Feedback recorded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostMortem'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    PostMortem:
      type: object
      properties:
        apiVersion:
          type: string
          example: v1
        kind:
          type: string
          example: PostMortem
        metadata:
          type: object
          properties:
            name:
              type: string
            namespace:
              type: string
            incident:
              type: string
            createdAt:
              type: string
              format: date-time
            author:
              type: string
            reviewedBy:
              type: string
        resourceMeta:
          type: object
          description: Used by some endpoints in place of metadata.
          properties:
            name:
              type: string
            namespace:
              type: string
        report:
          type: object
          properties:
            title:
              type: string
            severity:
              type: string
            duration:
              type: string
            detectedAt:
              type: string
              format: date-time
            resolvedAt:
              type: string
              format: date-time
            summary:
              type: string
            impact:
              type: object
              additionalProperties: true
            rootCause:
              type: object
              properties:
                description:
                  type: string
                category:
                  type: string
                confidence:
                  type: number
            timeline:
              type: array
              items:
                type: object
                properties:
                  time:
                    type: string
                    format: date-time
                  event:
                    type: string
            remediationApplied:
              type: object
              additionalProperties: true
            actionItems:
              type: array
              items:
                type: object
                properties:
                  priority:
                    type: string
                  description:
                    type: string
                  assignee:
                    type: string
                  status:
                    type: string
                  dueDate:
                    type: string
                    format: date
            lessonsLearned:
              type: array
              items:
                type: string
            metricSnapshots:
              type: array
              items:
                type: object
                additionalProperties: true
            blastRadius:
              type: array
              items:
                type: object
                additionalProperties: true
            gitCorrelation:
              type: object
              additionalProperties: true
            trending:
              type: object
              additionalProperties: true
            gitOpsContext:
              type: string
            logAnalysisSummary:
              type: string
            cascadeChain:
              type: array
              items:
                type: string
            feedback:
              $ref: '#/components/schemas/PostMortemFeedback'
            chaosInduced:
              type: boolean
              description: >-
                True when this PostMortem belongs to a chaos drill (parent Issue
                carried platform.chatcli.io/source=chaos-experiment). GAP-04
                fix.
            chaosExperiment:
              type: string
              description: >-
                Name of the ChaosExperiment CR correlated with the incident.
                GAP-04 fix.
        status:
          type: object
          properties:
            state:
              type: string
              enum:
                - Open
                - InReview
                - Closed
            reviewer:
              type: string
            reviewStartedAt:
              type: string
              format: date-time
            closedAt:
              type: string
              format: date-time
            notes:
              type: string
            feedback:
              $ref: '#/components/schemas/PostMortemFeedback'
            requiresHumanAction:
              type: boolean
              description: >-
                True when the parent Issue was only Contained (workload
                silenced, root cause not fixed). PostMortemReconciler will not
                allow Closed transition while this is true and the
                human-action-acknowledged annotation is absent. GAP-07 fix moved
                this field from Spec to Status (correct K8s convention for
                controller-derived facts) — 1.122.x clients that wrote to Spec
                now read null until they upgrade.
            requiredAction:
              type: string
              description: >-
                Concrete follow-up action a human must take (e.g., 'restore
                deployment replicas after fixing root cause'). Set together with
                requiresHumanAction. GAP-07 fix moved this from Spec to Status.
    PostMortemFeedback:
      type: object
      properties:
        overrideRootCause:
          type: string
        remediationAccuracy:
          type: integer
          minimum: 1
          maximum: 5
        comments:
          type: string
        providedBy:
          type: string
        providedAt:
          type: string
          format: date-time
    Error:
      type: object
      required:
        - apiVersion
        - kind
        - error
      properties:
        apiVersion:
          type: string
          example: v1
        kind:
          type: string
          example: Error
        error:
          oneOf:
            - type: object
              required:
                - code
                - message
              properties:
                code:
                  type: integer
                  example: 404
                message:
                  type: string
                  example: Resource not found
                details:
                  type: string
            - type: string
        code:
          type: integer
          description: Top-level code (only used by some endpoints).
          example: 400
  responses:
    BadRequest:
      description: Invalid request payload or parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid API token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: Conflict with current state of the resource
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Rate limit exceeded for this token's role
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Bearer token issued by the operator. Format: `Authorization: Bearer
        <token>`.

````