Files
seon f30af2a4c3 feat(ai): add AI VM services (diagnosis agent, pgvector RAG, Discord HITL bot) and harness approval endpoints
실험 설계서 6장(WP-12)의 AI VM 2층 구현.
- cmd/agent: 하네스 /diagnose 수신 → OpenAI Responses API 함수 호출 루프(읽기 전용 도구 7종:
  query_metrics, query_logs, get_probe_status, get_k8s, get_gcp_instances, get_aws_state,
  search_runbooks) → strict 스키마 submit_diagnosis(6.3) → 하네스 /proposals 등록 + HITL 게시,
  또는 신뢰도 0.5 미만·escalate 시 3층 큐 에스컬레이션. 세션·프롬프트 버전·러너북 벡터는
  pgvector(ai 스키마)에 저장. 라벨·조치 enum은 하네스 /scenarios·/actions/catalog에서 갱신.
- cmd/hitl: Discord Gateway 봇(intents GUILDS만). 승인/거부 버튼(custom_id approve:/reject:<token>),
  3초 내 DEFERRED_UPDATE_MESSAGE, 승인 시 하네스 승인 → /actions/execute → 원 메시지 편집,
  15분 무응답 시 에스컬레이션 채널로 이동. 재기동 시 미결 제안 타이머 복원.
- harness: POST /proposals/{token}/approve, /reject 추가. 제안은 진단 시점에 등록하고 승인은
  버튼 시점에 기록해 MTTA(승인-제안)가 실제 대기 시간이 되도록 함.
OpenAI·Discord 토큰은 Secret Manager 파일로만 읽고 코드·저장소에 두지 않는다.
2026-10-08 01:36:10 +09:00

19 lines
1.3 KiB
Markdown

# selfheal-lab-apps
Application sources for the self-healing verification lab (VM + container mixed environment).
Infrastructure: `seon-labs/selfheal-lab-terraform`. Runtime configuration (compose, manifests):
`selfheal-lab/selfheal-lab-gitops`. This repository is public and contains no secrets.
| Directory | Runs on | Image |
|---|---|---|
| `legacy-api/` | GCP MIG instances (docker compose) | Artifact Registry `asia-northeast1-docker.pkg.dev/cms-d-414903/selfheal/legacy-api:<git sha>` |
| `demo-app/` | AWS Kubernetes (Argo CD, namespace demo) | Public Artifact Registry `asia-northeast1-docker.pkg.dev/cms-d-414903/selfheal-public/demo-api:<git sha>` (anonymous pull; kubeadm nodes have no cloud credentials) |
| `harness/` | GCP harness VM (docker compose) | Public Artifact Registry `selfheal-public/harness:<git sha>` |
| `ai/` | GCP AI VM (docker compose): `cmd/agent` (diagnosis, experiment design 6.2-6.4) and `cmd/hitl` (Discord approval bot, 6.5-6.6) | Public Artifact Registry `selfheal-public/ai-agent:<git sha>`, `selfheal-public/ai-hitl:<git sha>` (`gcloud builds submit ai --config ai/cloudbuild.yaml --substitutions=_TAG=<git sha>`) |
Build (Cloud Build, from the repository root):
```
gcloud builds submit legacy-api --project cms-d-414903 --tag asia-northeast1-docker.pkg.dev/cms-d-414903/selfheal/legacy-api:$(git rev-parse --short HEAD)
```