SWITCHBOARD 2026-04-21: fix _load_prompt_override (include YT narrative) + fallback_uniform collision bypass (unblocks selfhost-gemma3/dolphin3 stuck at 0 bets)

#1
Files changed (1) hide show
  1. app.py +28 -6
app.py CHANGED
@@ -155,10 +155,18 @@ def _load_prompt_override(fleet: str = "nba") -> str:
155
  continue
156
  with open(p) as fh:
157
  ov = _json.load(fh)
158
- rule = (ov.get(fleet) or {}).get("current_text") or ""
 
 
 
 
 
159
  if rule:
160
- v = (ov.get(fleet) or {}).get("current_version") or "?"
161
- return f"\n=== PROMPT MUTATOR OVERRIDE ({v}) ===\n{rule}\n=== END OVERRIDE ===\n"
 
 
 
162
  except Exception:
163
  continue
164
  return ""
@@ -2671,10 +2679,12 @@ def build_common_knowledge_block(day_date: str, state: Dict, agent_logs: Dict,
2671
  else:
2672
  for a in allocs:
2673
  outcome = "W" if a["won"] else "L"
 
 
2674
  lines.append(
2675
  f" {name}: {a['game']} {a['category']} "
2676
- f"${a.get('stake', 0):.1f} edge={a['edge']:.3f}→{outcome} "
2677
- f"pnl={a.get('profit', 0):+.1f}")
2678
  if strat:
2679
  lines.append(f" Strategy: \"{strat}\"")
2680
 
@@ -3421,8 +3431,20 @@ def run_experiment(progress=gr.Progress(track_tqdm=False)):
3421
  # 2026-04-19 collision limiter: if >=COLLISION_MAX_AGENTS
3422
  # already picked this (game_idx, category) today, skip.
3423
  # Forces structural divergence at the allocation level.
 
 
 
 
 
 
 
 
3424
  coll_key = (alloc["game_idx"], cat)
3425
- if day_collisions.get(coll_key, 0) >= COLLISION_MAX_AGENTS:
 
 
 
 
3426
  continue
3427
  # Tiered sizing: Kelly aggression × LLM pct, floor at bet_floor, cap at bet_cap.
3428
  sized_pct = (alloc["pct"] or 0.0) * KELLY_MULT
 
155
  continue
156
  with open(p) as fh:
157
  ov = _json.load(fh)
158
+ section = (ov.get(fleet) or {})
159
+ rule = section.get("current_text") or ""
160
+ narrative = section.get("market_narrative") or ""
161
+ mvc = section.get("manual_videos_count") or 0
162
+ v = section.get("current_version") or "?"
163
+ out = ""
164
  if rule:
165
+ out += f"\n=== PROMPT MUTATOR OVERRIDE ({v}) ===\n{rule}\n=== END OVERRIDE ===\n"
166
+ if narrative:
167
+ out += f"\n=== YOUTUBE MARKET NARRATIVE ({mvc} tracked videos, 22 channels) ===\n{narrative}\n=== END NARRATIVE ===\n"
168
+ if out:
169
+ return out
170
  except Exception:
171
  continue
172
  return ""
 
2679
  else:
2680
  for a in allocs:
2681
  outcome = "W" if a["won"] else "L"
2682
+ _rat = (a.get('rationale') or '')[:60]
2683
+ _rat_sfx = f' [{_rat}]' if _rat else ''
2684
  lines.append(
2685
  f" {name}: {a['game']} {a['category']} "
2686
+ f"${a.get('stake', 0):.1f} edge={a.get('edge', 0):.3f}→{outcome} "
2687
+ f"pnl={a.get('profit', 0):+.1f}{_rat_sfx}")
2688
  if strat:
2689
  lines.append(f" Strategy: \"{strat}\"")
2690
 
 
3431
  # 2026-04-19 collision limiter: if >=COLLISION_MAX_AGENTS
3432
  # already picked this (game_idx, category) today, skip.
3433
  # Forces structural divergence at the allocation level.
3434
+ # 2026-04-21 exception: fallback_uniform allocations are NOT
3435
+ # agent-chosen (LLM outage → system-emitted top-3 ML edges).
3436
+ # Collision gate would wipe 14/17 agents' allocations when the
3437
+ # whole fleet hits the fallback on a small-game-day (2-4 games),
3438
+ # which is exactly what happened to selfhost-gemma3/dolphin3
3439
+ # (0 bets in 17 days). Bypass the gate for fallback allocs so
3440
+ # every agent still trades — groupthink concern doesn't apply
3441
+ # when the LLM wasn't the decision-maker.
3442
  coll_key = (alloc["game_idx"], cat)
3443
+ _is_fallback_alloc = (
3444
+ parsed.get("fallback_used") is True
3445
+ or alloc.get("provider_status") == "fallback_uniform"
3446
+ )
3447
+ if (not _is_fallback_alloc) and day_collisions.get(coll_key, 0) >= COLLISION_MAX_AGENTS:
3448
  continue
3449
  # Tiered sizing: Kelly aggression × LLM pct, floor at bet_floor, cap at bet_cap.
3450
  sized_pct = (alloc["pct"] or 0.0) * KELLY_MULT