2443 次 UnboundLocalError 是怎麼藏住的
V34 的 NOOA v3 拿到 2.24 但仍低於 V24 的 2.56。我假設更通用的 module 架構(6 個 modules 涵蓋 explore/hypothesize/verify/transfer/reflect)會勝過 NOOA 的狹窄 memory+supervisor 設計。V35.1 加了 6 個 modules,但 step_env 有個 closure scope bug:_v35_last_level 缺少 nonlocal 宣告,導致 2443 個 UnboundLocalError。LB 1.59,比 V34 -0.65。
V34 仍低於 V24 的判斷
V34 的 NOOA v3 拿到 2.24 但仍低於 V24 的 2.56。我假設更通用的 module 架構(6 個 modules 涵蓋 explore/hypothesize/verify/transfer/reflect)會勝過 NOOA 的狹窄 memory+supervisor 設計。
V35.1 加了 6 個 modules:
- M1. ReasoningMemory:儲存學習過程,不是答案
- M2. ExplorationTracker:系統化動作測試
- M3. HypothesisEngine:form + verify + 3-miss abandon
- M4. TransferMechanism:level N → N+1 mechanic transfer
- M5. ReflectionRecovery:stuck → reflect on 4 capabilities
預期 LB 3.0+。結果 LB 1.59,比 V34 -0.65。
6 個 modules 的設計
6 個 modules 接進 step_env,包 solver 的 step 函式。每個 module hook 進 observation-reasoning-action loop:
def step_env(...):
if some_condition:
_v35_last_level = current_level # 指派讓它變 local
# ...後面...
if _v35_last_level != current_level: # branch 沒走時 UnboundLocalError
...
Bug:_v35_last_level 在 if branch 內被指派。Python 把它當 local 變數。如果 branch 沒走,變數從未指派,後面的存取 raise UnboundLocalError。
修法:在 step_env 頂部加 nonlocal _v35_last_level。但 V35.1 沒有這個修復。

step_env wrap 的 closure bug
| 參數 | V34 | V35.1 | 理由 |
|---|---|---|---|
| modules | NOOA v3 | 6 個 custom modules | General intelligence |
| step_env wrap | NOOA wrap | V35 wrap(有 bug) | Closure scope bug |
| MULTIMODAL_UPSCALE | 8 | 8 | 未變 |
| FP8 KV cache | enabled | enabled | 未變 |
| model | Qwen3.8-27B-FP8 | Qwen3.8-27B-FP8 | 未變 |
-0.65 vs V34
- Local mean: 未量測
- Baseline(上一版): V34 LB 2.24
- Local delta: n/a
- LB score: 1.59
modules instantiated 但 step_env BROKEN
| Patch | 是否 fire? | Marker |
|---|---|---|
| FP8 KV cache | yes | ENABLE_FP8_KV=True |
| MULTIMODAL_UPSCALE=8 | yes | Patched MULTIMODAL_UPSCALE to 8 |
| Qwen3.8 model | yes | qwen3-8-27b-fp8-hf-snapshot |
| writable bundle copy | yes | refreshing writable bundle copy |
| reasoning effort cap | yes | reasoning_effort |
| noop guard verified | yes | hard_noop_guard = True |
| temperature set | yes | temperature’: 0.0 |
| context window set | yes | ANALYZER_CONTEXT_WINDOW = 32768 |
| vLLM server started | yes | vLLM server ready |
| 6 modules instantiated | yes | v35.2: 6 modules instantiated |
| step_env wrap | BROKEN | 2443 UnboundLocalError in step_env |
為什麼這個 bug 難抓
LB 1.59,比 V34 的 2.24 -0.65。Kernel 完成(LB 回真實分數),但每次 step_env call 都崩潰,raise UnboundLocalError: cannot access local variable '_v35_last_level'。

各遊戲的錯誤計數:
- sb26:1226 個錯誤
- bp35:481 個錯誤
- ft09:238 個錯誤
- g50t:209 個錯誤
- sk48:170 個錯誤
- r11l:115 個錯誤
總計 2443 個 UnboundLocalError 在 step_env。每個例外都被 try/except 接住,所以 kernel 沒崩潰。但每個 step 都退回預設 solver 行為,繞過 6 個 modules。
這是最陰險的失敗方式:kernel 完成、提交、回真實 LB 分數。沒有 patch 驗證的話,會以為 6 個 modules 造成退步。實際上 6 個 modules 從未執行任何 step。
這個 bug 難抓有三個原因:
Kernel 沒崩潰(例外被接住)。 stdout 是 624 KB(V24 的 134 KB),滿是錯誤雜訊。 LB 回真實分數(1.59),所以提交看起來「成功」。
偵測方式:grep stdout 找 UnboundLocalError。V35.1 有 2443 hits。
V35.2 修 nonlocal
V35.2:用 nonlocal _v35_last_level 修 closure scope bug。用相同 config 重跑,隔離 bug 的影響。