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 파일로만 읽고 코드·저장소에 두지 않는다.
This commit is contained in:
1 parent
de076a79e4
commit
f30af2a4c3
21 files changed
+2875
-1
No files matched your search
@@ -0,0 +1,13 @@
|
||||
# Builds both AI VM images into the public Artifact Registry (anonymous pull from the VM, like harness/demo-api).
|
||||
# gcloud builds submit ai --project cms-d-414903 --config ai/cloudbuild.yaml --substitutions=_TAG=$(git rev-parse --short HEAD)
|
||||
substitutions:
|
||||
_REPO: asia-northeast1-docker.pkg.dev/cms-d-414903/selfheal-public
|
||||
_TAG: dev
|
||||
steps:
|
||||
- name: gcr.io/cloud-builders/docker
|
||||
args: ["build", "--build-arg", "CMD=agent", "-t", "${_REPO}/ai-agent:${_TAG}", "."]
|
||||
- name: gcr.io/cloud-builders/docker
|
||||
args: ["build", "--build-arg", "CMD=hitl", "-t", "${_REPO}/ai-hitl:${_TAG}", "."]
|
||||
images:
|
||||
- ${_REPO}/ai-agent:${_TAG}
|
||||
- ${_REPO}/ai-hitl:${_TAG}
|
||||
Reference in new issue
Block a user