Skip to content

리포트: 진단 보고서를 저장한 뒤 Discord로 전달한다 - #17

Merged
OstenHun merged 17 commits into
developfrom
feature/donghun-report-discord-mvp
Oct 2, 2026
Merged

OstenHun merged 17 commits into
developfrom
feature/donghun-report-discord-mvp

Conversation

@OstenHun

@OstenHun OstenHun commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

요약

#14의 DiagnosisHandoff를 검증해 1차 MVP 보고서를 파일에 저장하고, 다시 읽은 보고서만 Discord /diagnose 응답으로 보냅니다. Report 모델은 제한된 입력으로 원인 가설만 작성합니다.

관련 작업: #7의 일부 구현입니다. 이 PR로 #7을 닫지 않습니다. 대상 브랜치는 develop입니다.

동작 흐름

DiagnosisHandoff → 호출 ID·순서·오류 검증 → 모델용 최소 정보 투영 → 원인 가설 → 서버의 보고서 조립·검증 → 파일 게시·재조회 → Discord 요약과 amdc-report.md 전달

  • 원시 도구 결과, 요청 원문, SQL 행, HTTP 본문, 셸 출력은 Report 모델 입력과 Discord 첨부에서 제외합니다.
  • 근거가 있을 때만 모델을 최대 한 번 호출합니다. 조회 성공을 시스템 정상으로 판정하지 않으며, 실패·잘림·근거 부족을 보고서에 남깁니다.
  • 저장 후 Discord 전송을 한 번 시도합니다. 전송 확인이 모호해도 보고서 파일을 유지하고 애플리케이션에서 다시 보내지 않습니다.

이번 PR의 범위

  • diagnosis-report/1.0.0 스키마와 검증기, Report Agent, 파일 저장소, Discord 접점, 실패 주입 테스트를 추가합니다. ajv 의존성과 Docker 이미지의 보고서 스키마도 포함합니다.
  • #11의 도구별 호출 한도와 순차 실행을 유지합니다. 한도 초과 호출도 진단 원장의 접수 순서대로 기록합니다.
  • 기존 P0의 ReportAgentInputV1과 SQLite Run/Evidence/Report 트랜잭션은 이 MVP로 대체하지 않습니다. 실제 AMDB 조회, 재시작 이후 중복 처리, 전역 실행 대기열은 이번 범위 밖입니다.

검증

Windows, Node.js 24.13.0의 격리된 통합 checkout에서 실행했습니다.

점검 결과
npm ci --ignore-scripts 통과
npm run typecheck, npm run build 통과
npm test 220개 중 219개 통과, POSIX 전용 1개 건너뜀, 실패 0개
npm run smoke:report 합성 원장과 가짜 모델로 단일 로컬 흐름 통과
Linux / Node.js 20 PR CI 통과: npm ci, npm test, npm run typecheck, npm run build

테스트는 가짜 제공자·도구·Discord 전송 계층을 사용합니다. 실제 AMDB 조회와 실제 LiteLLM·Discord 연결, Docker 실행은 이 head에서 재검증하지 않았습니다.

리뷰 포인트와 위험

  • DiagnosisHandoff의 ID·순서·참조 검증과 원시 결과가 Report 모델·Discord 경계를 넘지 않는지 확인이 필요합니다.
  • 파일 게시→재조회→Discord 전달 순서, 중복 상호작용, 모호한 전송 실패 처리를 확인해 주세요.
  • 파일 저장은 SQLite Run 상태 전이와 원자적으로 묶이지 않습니다. 자유형 진단 코멘트의 사실성과 운영 데이터 정제는 후속 검토가 필요합니다.

롤백 계획은 이 PR의 봇 연결 변경을 되돌려 이전 진단 표시 경로로 복귀하는 것입니다. 이미 저장된 보고서 파일은 보존합니다.

@OstenHun
OstenHun marked this pull request as ready for review October 2, 2026 15:13
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-02T15:21:11.449023Z b65fa48 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b65fa48208

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/report-agent/mvp-report.ts Outdated
const source = record(value, ["diagnosis_id", "request", "completion_reason", "observations"]);
const diagnosisId = string(source.diagnosis_id, 41);
if (!DIAG_ID.test(diagnosisId)) invalid();
string(source.request, MAX_REQUEST);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 허용한 증상 문자열을 보고서 단계에서 거부하지 마세요

symptom에 줄바꿈이나 탭이 포함된 경우 createReportFlow는 공백 여부와 길이만 확인한 뒤 전체 진단을 실행하지만, 원문을 담은 handoff는 여기서 제어 문자 때문에 거부됩니다. /diagnose 옵션도 최대 길이만 설정하므로 이런 입력은 접수될 수 있고, 진단 비용을 모두 사용한 뒤 보고서가 저장·전달되지 않고 일반 실패 메시지만 반환됩니다. 진단 전에 같은 제약으로 입력을 거부하거나, 보고서에 사용하지 않는 request를 정규화 또는 제외해야 합니다.

Useful? React with 👍 / 👎.

@OstenHun
OstenHun merged commit 99b0294 into develop Oct 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant