linxinhua commited on
Commit
4d6214e
·
verified ·
1 Parent(s): ab7ad8b

Deploy: perfect_answer discussion_plan retry 1->2 (3 total attempts) to fix occasional empty-plan sessions

Browse files
Files changed (1) hide show
  1. core/perfect_answer.py +14 -3
core/perfect_answer.py CHANGED
@@ -159,12 +159,23 @@ def generate_session_artifacts(argument_text, *, reasoning="medium", verbosity="
159
 
160
  arts = _call()
161
  # The discussion plan is mandatory: the host-side state machine is
162
- # disabled without it. If parsing yielded no plan, retry once.
163
- if not (arts.get("discussion_plan") or "").strip():
164
- print("[perfect_answer] discussion_plan empty; retrying once", flush=True)
 
 
 
 
 
 
 
 
 
 
165
  retry = _call()
166
  if (retry.get("discussion_plan") or "").strip():
167
  arts = retry
 
168
  return arts
169
 
170
 
 
159
 
160
  arts = _call()
161
  # The discussion plan is mandatory: the host-side state machine is
162
+ # disabled without it. The model occasionally drops the DISCUSSION
163
+ # PLAN block (output budget exhaustion or model flakiness). Retry
164
+ # up to 2 more times — 3 total attempts. Real production case:
165
+ # session 20260601_195128_71512 had two consecutive empty attempts;
166
+ # a third would almost certainly have caught it.
167
+ MAX_RETRIES = 2
168
+ for attempt in range(1, MAX_RETRIES + 1):
169
+ if (arts.get("discussion_plan") or "").strip():
170
+ break
171
+ print(
172
+ f"[perfect_answer] discussion_plan empty; retry {attempt}/{MAX_RETRIES}",
173
+ flush=True,
174
+ )
175
  retry = _call()
176
  if (retry.get("discussion_plan") or "").strip():
177
  arts = retry
178
+ break
179
  return arts
180
 
181