MCPcopy Create free account
hub / github.com/RightNow-AI/autokernel / _should_move_on

Function _should_move_on

orchestrate.py:302–335  ·  view source on GitHub ↗

Evaluate move-on criteria for the current kernel. Returns (should_move, reason).

(kernel: dict)

Source from the content-addressed store, hash-verified

300
301
302def _should_move_on(kernel: dict) -> tuple[bool, str]:
303 """
304 Evaluate move-on criteria for the current kernel.
305 Returns (should_move, reason).
306 """
307 consec = kernel.get("consecutive_reverts", 0)
308 if consec >= MOVE_ON_CRITERIA["consecutive_reverts"]:
309 return True, (
310 f"Plateau detected: {consec} consecutive reverts "
311 f"(threshold: {MOVE_ON_CRITERIA['consecutive_reverts']})"
312 )
313
314 pct_peak = kernel.get("pct_peak")
315 if pct_peak is not None and pct_peak >= MOVE_ON_CRITERIA["pct_peak_threshold"]:
316 return True, (
317 f"Near theoretical peak: {pct_peak:.1f}% of peak "
318 f"(threshold: {MOVE_ON_CRITERIA['pct_peak_threshold']:.0f}%)"
319 )
320
321 minutes = kernel.get("time_spent_minutes", 0)
322 if minutes >= MOVE_ON_CRITERIA["max_minutes_per_kernel"]:
323 return True, (
324 f"Time budget exhausted: {minutes:.0f} min "
325 f"(max: {MOVE_ON_CRITERIA['max_minutes_per_kernel']} min)"
326 )
327
328 speedup = kernel.get("speedup")
329 if speedup is not None and speedup >= MOVE_ON_CRITERIA["speedup_threshold"]:
330 return True, (
331 f"Strong speedup achieved: {speedup:.2f}x "
332 f"(threshold: {MOVE_ON_CRITERIA['speedup_threshold']:.1f}x)"
333 )
334
335 return False, "Current kernel still has optimization headroom"
336
337
338def _find_next_pending(kernels: list[dict], current_idx: int) -> int | None:

Callers 1

cmd_nextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected