[AI Run] 발화문 분석과 누락 정보 API·실행 이력 구현 - #82
Merged
Merged
Conversation
AiRun, AiAttempt, Question, Candidate를 V12에 추가하고 사업장 격리 정책과 JDBC 저장소를 구현합니다. 멱등성 키는 원문 대신 SHA-256 hash를 저장하며 AI 버전과 지연 시간도 Attempt별로 추적합니다.
POST·GET·answers API를 추가하고 PLAN에서 사업장 범위 Slot을 해결한 뒤 ANALYZE로 이어지는 실행 흐름을 연결합니다. 요청과 답변 변경은 감사로그에 남기고 Runtime HTTP 호출 전후의 DB transaction을 분리합니다.
PLAN, Slot 조회, NEEDS_INFO, HR 답변, REVIEW_REQUIRED까지 세 Attempt가 남는 대표 흐름을 검증합니다. 멱등성 재요청, 타 사업장 404, 감사로그와 PostgreSQL schema 계약도 함께 확인합니다.
This was referenced Aug 4, 2026
This was referenced Aug 4, 2026
빠른 선택 태그와 Intent 코드를 instruction에 덧붙이지 않도록 문서와 테스트 Fixture를 수정합니다. 최종 Intent는 AI Runtime이 반환한 detectedIntent를 사용하는 흐름을 검증합니다.
hywznn
marked this pull request as ready for review
August 4, 2026 08:07
chaeliki
approved these changes
Aug 5, 2026
21 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
왜 필요한가요?
Refs #77
Refs #24
프론트가 자연어 업무 요청을 보내도 이를 접수·조회하거나, Agent가 요청한 DB Slot을 보충한 뒤 HR의 추가 답변을 다시 전달할 API와 영속 리소스가 없었습니다.
무엇이 바뀌나요?
POST /api/v1/ai-runs: 단일instruction과Idempotency-Key를 받아202로 접수합니다.GET /api/v1/ai-runs/{aiRunId}: 실행 상태, 분석 결과, 질문, 후보를 조회합니다.POST /api/v1/ai-runs/{aiRunId}/answers: HR 답변을 저장하고 새AiAttempt로 ANALYZE를 재호출합니다.V12:ai_run,ai_attempt,ai_question,ai_candidate와 tenant-aware FK·UNIQUE를 추가합니다.V14: PostgreSQL RLS 정책을 준비합니다.V13은 feat: 근로자 보안 링크(Worker Link) 발급, 안내, 문서제출, 응답제출 구현 #76 Worker Link가 소유합니다.409를 반환합니다.Intent 입력 계약
instruction으로 전송합니다.intentHint필드와, EXPIRY_RENEWAL같은 Intent 접미사는 사용하지 않습니다.instruction을 AI Runtime에 전달합니다.detectedIntent를 저장·반환합니다.POST /api/v1/ai-runs의 외부 API 구조는 변경되지 않습니다.{ "instruction": "응웬반안 체류연장 준비해줘" }데모 범위와 후속 작업
현재 PR은 대표 흐름을 빠르게 검증하기 위한 최소 세로 구현입니다. DB transaction을 닫은 뒤 Runtime을 호출하지만, 호출 완료 후
202를 반환하는 동기식 demo runner입니다. 서버 재시작에도 자동 복구되는 durable worker·retry·candidate decision은 #24 후속 범위로 남깁니다.실제 AI Runtime은 아직 AI #6의 최소 camelCase 계약을 구현하지 않아 현재
422를 반환합니다. Server fixture 기반 왕복은 통과했으며 AI #6 반영 후 실제 Runtime smoke test를 다시 수행합니다.검증
./gradlew clean test— BUILD SUCCESSFULinstruction전달과intentHint미전송 확인detectedIntent가 최종 Intent로 저장되는지 확인404검증브라우저 통합 검증
Idempotency-KeyCORS preflight 차단을 발견했습니다.CorsConfig허용 헤더와 OPTIONS 통합 테스트를 추가했습니다.INVALID_REQUEST_CONTRACT를 반환합니다.AiRunApiIntegrationTest와 Client 테스트로 검증했습니다.병합 전 확인