fix(ui): 머신 state 우선순위 — 가동 > 보류 (일하는 중엔 백오프 잔여여도 가동)

실측: 맥북이 드레인 처리 중인데도 백오프 잔여 때문에 카드 전체가 '보류'로 표시.
보류 칩은 일이 멈춰 있고 백오프만 쌓인 상태(sleep/불가 지속) 한정으로 강등,
보류 건수 자체는 카드의 deferred_pending 라인이 계속 표시.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
hyungi
2026-06-11 14:36:10 +09:00
parent 7031439364
commit a410f5b65c
2 changed files with 23 additions and 7 deletions
+8 -5
View File
@@ -165,13 +165,16 @@ def build_machines(
if key == "macbook" else 0
)
# state 판정 — macbook 의 done_15m 은 위에서 deep_summary stage 분 + summarize 풀
# split 분이 이미 합산돼 있고, processing 은 deep_summary 진행 중(=맥북 생성 중)을
# 포함하므로 동일 분기로 충분 (검수 보정 2026-06-11: deep 처리 중에도 active).
if key == "macbook" and deferred_pending > 0:
# state 판정 — 우선순위: 가동 > 보류 > 대기 (사용자 피드백 2026-06-11).
# 일하고 있으면(처리 중 또는 최근 15분 완료) 백오프 잔여가 있어도 "가동" —
# 보류 건수는 카드의 deferred_pending 라인이 따로 보여준다. "보류" 칩은
# 실제로 일이 멈춰 있고 백오프만 쌓인 상태(sleep/불가 지속)에서만.
if processing > 0 or done_15m > 0:
state = "active"
elif key == "macbook" and deferred_pending > 0:
state = "deferred"
else:
state = "active" if (processing > 0 or done_15m > 0) else "idle"
state = "idle"
machines.append({
"key": key,
+15 -2
View File
@@ -130,10 +130,23 @@ def test_deferred_pending_always_on_macbook_card():
# ─── state 판정 ───────────────────────────────────────────────────────────────
def test_macbook_state_deferred_wins_over_active():
def test_macbook_state_active_wins_over_deferred_while_working():
"""가동 > 보류 (사용자 피드백 2026-06-11): 일하고 있으면 백오프 잔여가 있어도 '가동'.
보류 건수는 deferred_pending 필드가 별도로 전달 — 카드 라인이 표시.
"""
stats = {"summarize": _stage(pending=1, deferred_pending=1)}
split = _split(macbook={"done_15m": 3}) # 최근 완료가 있어도 deferred 우선
split = _split(macbook={"done_15m": 3})
machines = build_machines(stats, split, [], deep_enabled=True)
mb = _machine(machines, "macbook")
assert mb["state"] == "active"
assert mb["deferred_pending"] == 1
def test_macbook_state_deferred_only_when_not_working():
"""일이 멈춰 있고(처리 0·최근 완료 0) 백오프만 쌓인 상태에서만 '보류'."""
stats = {"summarize": _stage(pending=1, deferred_pending=1)}
machines = build_machines(stats, _split(), [], deep_enabled=True)
assert _machine(machines, "macbook")["state"] == "deferred"