Repository navigation
[Feat] run 명시적 취소·CANCELED 확정·상태별 사용량과 반복 요청 제한 검증 [1.84] - #239
Merged
Merged
Conversation
…meout 뒤 CANCELED, 반복 요청 제한 검증 (#224) - POST /api/ai-runs/{runId}/cancel (cancel/cases.json 판정 순서: body RUN4001 → 접근 RUN4041 → 상태) - RunCancelStore: Note → run 잠금, 조건부 PENDING→CANCELED(+보상)·RUNNING|RETRYING→CANCELING(+run.canceling) - RunCancelFinalizer: Brain cancel ack state로 정리 확인, absent는 lease 만료 뒤, cleanup-timeout 안전 확정, reserveRuntimeCleanup·RunCoordinator.release (coordinator 패키지 미수정, schema 변경 없음) - 실제 Postgres·HTTP·BrainRunClient·coordinator 테스트, docs/contracts/run-cancel.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 of 9 tasks
9 tasks done
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.
📌 관련 이슈
🏷️ PR 타입
📝 작업 내용
POST /api/ai-runs/{runId}/cancel— 1.86BrowserRunController확장 지점에 추가. 판정 순서 = browser-run-v1cancel/cases.json(401 → body 있음 RUN4001(run 조회 전) → 접근 RUN4041 → 상태). 응답ApiResponse<RunCancelResult>.RunCancelStore(NoteFOR SHARE→ runFOR UPDATE, 1.82 잠금 순서):PENDING∧attempt=0 → CANCELED+ message CANCELED +run.canceled+ 1.77 보상(PENDING_CANCELED) 한 transaction. Brain 미호출. claim(SKIP LOCKED)과 하나만 이김.→ CANCELING(+run.canceling, grant 폐기, lease 유지).already_canceling, terminal →already_terminal(멱등).RunCancelFinalizer(내부 executor, bean 아님): 취소 직후 +sweep-interval마다 CANCELING run에 Braincancel(멱등) → ack stateterminal이면 확정,absent는 run lease 만료·로컬 미실행일 때만 확정, 그 밖은cleanup-timeout(기본 2m) 뒤 안전 확정. 확정 =CANCELING → CANCELED+ message +run.canceled+ usage settle(사용자 취소는 차감 유지) →RunClaimStore.reserveRuntimeCleanup→RunCoordinator.release.recovery_count, 1.85 merge 반영 후 충돌 없음). application.yaml 변경 없음(proovy.run.cancel.*는@DefaultValue).docs/contracts/run-cancel.md.📸 스크린샷
로컬(eclipse-temurin:21-jdk 컨테이너, 격리 Postgres :24432):
--tests 'com.proovy.domain.run.cancel.*'— RunCancelPostgresTest 13/13, RunCancelCoordinatorPostgresTest 1/1 통과run.contract.*37 — 실패 0✅ 체크리스트
📎 기타 참고사항
후속 계약 메모
POST /api/ai-runs/{runId}/cancel(body 없음). 실제 Brain cancel 왕복·wind-down 실측과cleanup-timeout확인.asset_deleting취소는RunCancelStore.cancelPending/markCanceling(cause)재사용 가능. Brain runtimecleanup호출은 S13.proovy.run.cancel.cleanup-timeout2m ·sweep-interval2s, 1.79 rate limit 20건/1분.반복 요청 제한 — 후속 태스크(S14 수치와 함께) (사용자 결정)
이 PR 범위는 1.79 RUN4291 재사용(20건/1분)뿐이다. 새 requestId·취소/실패/clarification으로 순사용량 0이 된 run도 세고(우회 불가), replay는 세지 않고, 다른 사용자에 영향이 없다(테스트로 고정). task 84 문구 대비 남은 차이는 후속 태스크로 미룬다:
run_request_bindings) 기준으로 세는 추가 상한(같은 입력 반복만 제한, 보완 요청은 fingerprint가 달라 제외, code는 RUN4291). 창·건수는 S14에서 기존 수치와 함께 확정.1.85 결정표 중 1.84 소유 항목 (
docs/contracts/run-cancel.md"1.85 회수 결정표 중 1.84 소유 항목")RunCancelFinalizer만 부르고 대상은 CANCELING commit 뒤의status='CANCELING'행뿐, CANCELING→RUNNING 전이 없음. 보이면 Server 밖 cancel 신호이고 deadline sweep이 끝냄. 코드 변경 없음.CancelCause에 Server 실패 값이 없어 계약 추가가 먼저. 후속(S13): 실패 직전 best-effortBrainRunClient.cancel후 응답과 무관하게failByServer.🤖 Generated with Claude Code