From c193e7b5704e4a2d96ce95adadae0ed1231a29c6 Mon Sep 17 00:00:00 2001 From: tzhouam Date: Fri, 18 Sep 2026 23:28:20 +0800 Subject: [PATCH 1/2] rebase: raise the module agent turn budget to 400 A flash-class module agent needs roughly 2.3x the turns of the pro tier on the same module (140+ turns vs 62), most of it shell exploration before the first edit. At the old ceiling of 150 the agent loop was truncated and RESTARTED from scratch, discarding its accumulated context -- one module burned 63 minutes across three truncated loops without finishing. 400 lets a loop reach a conclusion instead of being cut off mid-investigation. Exhausting the budget was never fatal (the engine restarts the loop rather than failing the module), so this is a throughput fix, not a correctness one. Co-Authored-By: Claude Opus 5 (1M context) --- src/infermatrix_copilot/rebase_engine/module_rebase.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/infermatrix_copilot/rebase_engine/module_rebase.py b/src/infermatrix_copilot/rebase_engine/module_rebase.py index e19508be..acaa8961 100644 --- a/src/infermatrix_copilot/rebase_engine/module_rebase.py +++ b/src/infermatrix_copilot/rebase_engine/module_rebase.py @@ -36,7 +36,14 @@ class ModuleRunConfig: last_rebase_vllm_commit: str = "" cuda_devices: str = "0,1" hf_home: str = "/model" - max_turns: int = 150 + # Raised from 150 for the v0.30.0 campaign: a flash-class module agent + # needs ~2.3x the turns of the pro tier on the same module (140+ vs 62), + # mostly shell exploration before the first edit. Exhausting the budget + # is NOT fatal — the engine restarts the agent loop — but a restart + # discards accumulated context, so too low a ceiling makes the agent + # re-explore from scratch. Bounds the in-process loop; a harness session + # is bounded by `harness_timeout_s` instead (see below). + max_turns: int = 400 # Harness backend selection (doc/features/provider-registry.md). "api" # keeps the in-process Anthropic tool-use loop; any other provider id # delegates the whole module step to that harness, with the SAME 20-tool From d90deb6e29dd08f115d91126281f37256656c10f Mon Sep 17 00:00:00 2001 From: tzhouam Date: Sat, 19 Sep 2026 00:35:47 +0800 Subject: [PATCH 2/2] doc(spec): re-verify rebase_engine for the 400-turn module budget check_spec_freshness --strict flagged rebase_engine as STALE after the max_turns change. Records why the number matters: exhausting the budget restarts the agent loop rather than failing the module, so too low a ceiling makes the agent repeatedly re-explore from scratch. Co-Authored-By: Claude Opus 5 (1M context) --- doc/architecture/SPEC/rebase_engine.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/architecture/SPEC/rebase_engine.md b/doc/architecture/SPEC/rebase_engine.md index 59361969..66f834ea 100644 --- a/doc/architecture/SPEC/rebase_engine.md +++ b/doc/architecture/SPEC/rebase_engine.md @@ -137,3 +137,10 @@ choke-point 编号(agent_loop/rebase_tools 写"C5")落后于 `_CONSTRAINTS.m `module_rebase` 既可跑进程内 agent 循环,也可把一个 module 交给 harness provider;两条路径共用同一 prompt、同一工具面与同一 plan gate。 + +## module agent 轮次预算(2026-09-19) + +`RebaseModuleConfig.max_turns` = 400。耗尽预算不致命:引擎会**重启** agent +循环而不是判 module 失败——但重启会丢掉已积累的上下文,所以预算过低时 +agent 会反复从头探索。flash 级模型在同一 module 上约需 pro 级 2.3 倍轮次 +(140+ vs 62),150 的旧上限会被截断三次仍未完成。