nomadcode/agent-task/m-plane-work-item-webhook-intake/03+02_idempotency/CODE_REVIEW-cloud-G06.md
toki f23ba78eba feat: plane webhook intake & protosocket consumer wire readiness
- Add Plane webhook handler for issue events (created, state, assignees)
- Add Plane webhook integration tests with testdata fixtures
- Add Gito Protosocket consumer wire readiness milestone
- Add Plane work item webhook intake milestone
- Add agent-task for plane-work-item-webhook-intake (trigger dispatch, idempotency, live smoke)
- Update service config, router, handlers for Plane webhook endpoints
- Add SOPS env setup script and secrets configuration
- Update agent-ops domain rules and phase roadmap
2026-06-14 20:37:48 +09:00

6 KiB

Code Review Reference - WEBHOOK_IDEMPOTENCY

[IMPLEMENTING AGENT - READ FIRST] Filling in this file is the mandatory final step of implementation. The task is NOT complete until every implementation-owned section below is filled in. Complete the 구현 체크리스트; the final checklist item is mandatory before saving. Fill implementation-owned sections, then stop with active files in place and report ready for review. If implementation is blocked by a user-only decision, user-owned external environment prerequisite, or scope conflict, fill 사용자 리뷰 요청 with evidence and stop with active files in place; code-review decides whether to write USER_REVIEW.md. Do not ask the user directly, present choices in chat, or call request_user_input during implementation. Finalization is review-agent-only.

개요

date=2026-06-14 task=m-plane-work-item-webhook-intake/03+02_idempotency, plan=0, tag=WEBHOOK_IDEMPOTENCY

Roadmap Targets

  • Milestone: agent-roadmap/phase/agent-ops-mcp-control-plane/milestones/plane-work-item-webhook-intake.md
  • Task ids:
    • loop-idempotency: duplicate webhook, provider retry, NomadCode self actor event를 중복 creation task 없이 처리한다.
  • Completion mode: check-on-pass

이 파일을 읽는 리뷰 에이전트에게

[REVIEW AGENT ONLY] 구현 결과를 실제 소스와 대조하고, PASS이면 code-review 절차에 따라 log/complete/archive를 처리한다. 구현 에이전트는 이 섹션을 실행하지 않는다.

구현 항목별 완료 여부

항목 완료 여부
[WEBHOOK_IDEMPOTENCY-1] Storage Idempotency Boundary [ ]
[WEBHOOK_IDEMPOTENCY-2] Workflow And Pipeline Semantics [ ]
[WEBHOOK_IDEMPOTENCY-3] Webhook Duplicate/Self Tests [ ]

구현 체크리스트

  • Plane-origin task idempotency key를 external provider/id로 고정하고 DB unique/index 또는 upsert semantics를 추가한다.
  • duplicate webhook/provider retry가 기존 task를 반환하거나 ignored 처리되어 새 task, workspace provision, slot reservation을 만들지 않도록 workflow/workitempipeline 경계를 조정한다. 검증: 같은 provider/work item/revision 재처리와 self actor 입력이 task 중복 생성으로 이어지지 않는다.
  • storage/workflow/workitempipeline/http tests를 추가해 duplicate external ref, duplicate webhook dispatch, self actor ignored를 검증한다.
  • CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.

코드리뷰 전용 체크리스트

[REVIEW AGENT ONLY] 이 체크리스트는 코드리뷰 에이전트만 사용한다.

  • 코드리뷰 결과PASS, WARN, FAIL 중 하나의 판정을 append한다.
  • active CODE_REVIEW-*-G??.mdPLAN-*-G??.md.log로 아카이브한다.
  • PASS이면 complete.log를 작성하고 active task 디렉터리를 agent-task/archive/YYYY/MM/m-plane-work-item-webhook-intake/03+02_idempotency/로 이동한다.
  • PASS이고 task group이 m-plane-work-item-webhook-intake이므로 완료 이벤트 메타데이터를 보고한다. roadmap 수정은 런타임 책임이다.

계획 대비 변경 사항

구현 에이전트가 계획과 다르게 구현한 부분을 이유와 함께 기록한다.

주요 설계 결정

구현 에이전트가 주요 설계 결정 사항을 기록한다.

사용자 리뷰 요청

기본값은 없음이다. 구현 중 사용자 결정, 사용자 소유 외부 환경/secret/서비스 준비, 또는 계획 범위 변경 없이는 안전하게 진행할 수 없으면 아래 항목을 실제 내용으로 교체하고, 구현을 중단한 뒤 active 파일을 그대로 둔 채 리뷰를 요청한다. 구현 에이전트는 사용자에게 직접 질문하거나 선택지를 제시하거나 request_user_input을 호출하지 않는다. 후속 에이전트가 명령 재실행이나 산출물 수집으로 해소할 수 있는 검증 증거 공백만으로는 사용자 리뷰 요청을 작성하지 않는다.

  • 상태: 없음
  • 사유 유형: 없음
  • 결정 필요: 없음
  • 차단 근거: 없음
  • 실행한 검증/명령: 없음
  • 자동 후속 불가 이유: 없음
  • 재개 조건: 없음

리뷰어를 위한 체크포인트

  • Duplicate prevention happens before workspace provision/slot reservation, or tests prove no duplicate side effect.
  • DB unique/upsert semantics do not break tasks without external refs.
  • Generated sqlc code matches queries/tasks.sql.

검증 결과

구현 에이전트가 각 중간 검증 및 최종 검증 명령 실행 후 출력을 여기에 붙여 넣는다.

WEBHOOK_IDEMPOTENCY-1 중간 검증

$ cd services/core && go run github.com/sqlc-dev/sqlc/cmd/sqlc@v1.31.1 generate
(output)

WEBHOOK_IDEMPOTENCY-2 중간 검증

$ cd services/core && go test -count=1 ./internal/workflow ./internal/workitempipeline
(output)

WEBHOOK_IDEMPOTENCY-3 중간 검증

$ cd services/core && go test -count=1 ./internal/http ./internal/workitempipeline
(output)

최종 검증

$ cd services/core && go run github.com/sqlc-dev/sqlc/cmd/sqlc@v1.31.1 generate
(output)
$ cd services/core && gofmt -w internal/db/tasks.sql.go internal/storage/store.go internal/workflow/service.go internal/workflow/service_test.go internal/workitempipeline/service.go internal/workitempipeline/service_test.go internal/http/plane_webhook_test.go
(output)
$ cd services/core && go test -count=1 ./internal/storage ./internal/workflow ./internal/workitempipeline ./internal/http
(output)
$ tar -C services/core -czf - . | ssh toki@toki-labs.com 'mkdir -p ~/agent-work/nomadcode/services/core && tar -C ~/agent-work/nomadcode/services/core -xzf -'
(output)
$ ssh toki@toki-labs.com 'zsh -lc "cd ~/agent-work/nomadcode/services/core && go test -count=1 ./..."'
(output)