fix: log blackout recovery executions to DB (#324) #339

Merged
jihoson merged 1 commits from feature/issue-324-blackout-recovery-trade-log into feature/v3-session-policy-stream 2026-02-28 18:22:12 +09:00
Collaborator

Summary

  • Record blackout recovery executions via log_trade so recovered orders are persisted in trades
  • Tag rationale with [blackout-recovery] and store runtime session_id
  • Add test assertion for DB persistence of recovered order

Validation

  • pytest -q tests/test_main.py -k "process_blackout_recovery_executes_valid_intents or process_blackout_recovery_drops_policy_rejected_intent"
## Summary - Record blackout recovery executions via `log_trade` so recovered orders are persisted in `trades` - Tag rationale with `[blackout-recovery]` and store runtime session_id - Add test assertion for DB persistence of recovered order ## Validation - pytest -q tests/test_main.py -k "process_blackout_recovery_executes_valid_intents or process_blackout_recovery_drops_policy_rejected_intent"
agentson added 1 commit 2026-02-28 14:39:35 +09:00
fix: persist blackout recovery executions to trades log (#324)
Some checks are pending
Gitea CI / test (push) Waiting to run
Gitea CI / test (pull_request) Waiting to run
5c107d2435
Author
Collaborator

Ticket Maturity Update (2026-02-28)

  • Implemented: done
  • Integrated: done
  • Observed: done (targeted test commands executed and passing)
  • Accepted: pending (reviewer + runtime verifier approval required)

Coverage Matrix:

Stage Status
Implemented PASS
Integrated PASS
Observed PASS
Accepted NOT_OBSERVED
## Ticket Maturity Update (2026-02-28) - Implemented: done - Integrated: done - Observed: done (targeted test commands executed and passing) - Accepted: pending (reviewer + runtime verifier approval required) Coverage Matrix: | Stage | Status | | --- | --- | | Implemented | PASS | | Integrated | PASS | | Observed | PASS | | Accepted | NOT_OBSERVED |
agentson reviewed 2026-02-28 16:15:56 +09:00
agentson left a comment
Author
Collaborator

Review: PR #339 — fix: log blackout recovery executions to DB (#324)

플랜 일치: ACT-07 정확히 일치

  • 복구 주문 실행 후 log_trade() 호출
  • rationale에 [blackout-recovery] prefix 추가
  • session_id 전달

코드 품질: 양호

  • 위치: accepted 확인 후(성공 시에만) log_trade 호출 — 올바른 타이밍
  • confidence=0: 복구 주문은 AI 의사결정이 아니므로 0이 적절
  • pnl=0.0: 복구 주문 자체에는 PnL 없음 — 올바름
  • session_id: get_session_info(market).session_id 로 런타임 세션 사용

테스트: 충분

  • 기존 test_process_blackout_recovery_executes_valid_intents에 DB 기록 검증 추가
  • action, quantity, session_id, rationale prefix 모두 검증

우려사항 (minor)

  • decision_id 미전달 — 복구 주문에는 원래 의사결정이 없으므로 괜찮으나, 향후 추적용으로 원본 intent의 참조 ID 저장 고려

결론: LGTM

## Review: PR #339 — fix: log blackout recovery executions to DB (#324) ### 플랜 일치: ✅ ACT-07 정확히 일치 - 복구 주문 실행 후 `log_trade()` 호출 - rationale에 `[blackout-recovery]` prefix 추가 - session_id 전달 ### 코드 품질: ✅ 양호 - **위치**: `accepted` 확인 후(성공 시에만) log_trade 호출 — 올바른 타이밍 - **confidence=0**: 복구 주문은 AI 의사결정이 아니므로 0이 적절 - **pnl=0.0**: 복구 주문 자체에는 PnL 없음 — 올바름 - **session_id**: `get_session_info(market).session_id` 로 런타임 세션 사용 ### 테스트: ✅ 충분 - 기존 `test_process_blackout_recovery_executes_valid_intents`에 DB 기록 검증 추가 - action, quantity, session_id, rationale prefix 모두 검증 ### 우려사항 (minor) - `decision_id` 미전달 — 복구 주문에는 원래 의사결정이 없으므로 괜찮으나, 향후 추적용으로 원본 intent의 참조 ID 저장 고려 ### 결론: **LGTM** ✅
Author
Collaborator

권장사항(복구 주문 추적성 강화) 확인했습니다.

현재 PR 범위에서는 blackout 복구 주문이 AI decision에서 파생되지 않아 decision_id를 임의 생성/주입하면 기존 decision-outcome 체인 의미를 오염시킬 수 있어, 이번 변경에서는 rationale=[blackout-recovery] + session_id + 주문 메타 기록으로 추적성을 확보한 상태로 유지했습니다.

후속 개선으로는 복구 큐 모델에 별도 recovery_id(또는 origin_intent_id)를 도입해 trades와 1:1 연결하는 방식이 가장 안전합니다.

권장사항(복구 주문 추적성 강화) 확인했습니다. 현재 PR 범위에서는 `blackout` 복구 주문이 AI decision에서 파생되지 않아 `decision_id`를 임의 생성/주입하면 기존 decision-outcome 체인 의미를 오염시킬 수 있어, 이번 변경에서는 `rationale=[blackout-recovery]` + `session_id` + 주문 메타 기록으로 추적성을 확보한 상태로 유지했습니다. 후속 개선으로는 복구 큐 모델에 별도 `recovery_id`(또는 `origin_intent_id`)를 도입해 trades와 1:1 연결하는 방식이 가장 안전합니다.
agentson reviewed 2026-02-28 17:42:34 +09:00
agentson left a comment
Author
Collaborator

Re-review: PR #339 — fix: log blackout recovery executions to DB (#324)

이전 리뷰에서 LGTM이었고, 변경 없음. 머지 가능 상태 유지.

결론: LGTM

## Re-review: PR #339 — fix: log blackout recovery executions to DB (#324) 이전 리뷰에서 LGTM이었고, 변경 없음. 머지 가능 상태 유지. ### 결론: **LGTM** ✅
jihoson merged commit 33b97f21ac into feature/v3-session-policy-stream 2026-02-28 18:22:12 +09:00
jihoson deleted branch feature/issue-324-blackout-recovery-trade-log 2026-02-28 18:22:12 +09:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jihoson/The-Ouroboros#339