合并 codex/mcp-runtime-reliability: 运行可靠性、局状态与决策交接

Browse Source
与 main 上的审查修复及 2131f89 (story-test) 合并, 冲突处理:
- mcp_session: 保留超时/取消客户端, 补回 raise_on_error
- 执行器: 局状态改用 run_state (run_id 绑定), 取代完成后归档 context;
  Jev 请求统一经 jev_client.request_answer (支持 baseUrl/curl, 返回置信度与概率);
  保留截图解码缓存、地图模板缓存、按坐标点按钮、use_last_error 单实例互斥;
  刷新计数与开战标记只在动作成功后更新
- battle_batch: 取消/预算框架 + 只在看到胜率按钮时点胜率再回车;
  回合标签改为包含匹配 (OCR 常输出 'wave1')
- 文档采用 reliability 版本 (已是仓库相对路径), 注明 jev_client
- 测试: 互斥量桩改为 WinDLL/get_last_error, 战斗批次测试按胜率语义重写,
  Jev 测试改为对 jev_client 打桩, 生命周期测试改为轮询; 145 项通过

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
yws
2026-10-03 03:12:48 +00:00
co-authored by Claude Opus 5.5
24 changed files with 2014 additions and 194 deletions
+12 -3
View File
@@ -54,13 +54,15 @@ def _post(cfg, body):
return json.loads(content)
def request_decision(cfg, state, criteria, instructions):
def request_answer(cfg, state, criteria, instructions):
"""返回 {'choice', 'latency_ms', 'confidence', 'probabilities', 'model'}; 候选之外的结果会被拒绝。"""
if not cfg.get('apiKey'):
raise ValueError('Jev API key is required')
if not criteria:
raise ValueError('Jev requires permitted choices')
model = cfg.get('model', 'jev-1.13-free')
body = {
'model': cfg.get('model', 'jev-1.13-free'),
'model': model,
'state': state,
'questions': {'action': {'type': 'choice', 'instructions': instructions,
'criteria': criteria}},
@@ -82,7 +84,14 @@ def request_decision(cfg, state, criteria, instructions):
choice = answer.get('choice')
if answer.get('type') != 'choice' or choice not in criteria:
raise ValueError('Jev returned an unsupported candidate')
return choice, round((time.monotonic() - started) * 1000)
return {'choice': choice, 'latency_ms': round((time.monotonic() - started) * 1000),
'confidence': answer.get('confidence'), 'probabilities': answer.get('probabilities'),
'model': result.get('model') or model}
def request_decision(cfg, state, criteria, instructions):
answer = request_answer(cfg, state, criteria, instructions)
return answer['choice'], answer['latency_ms']
def main():