bugx-cli 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/README.md +190 -186
  2. package/core/README.md +2 -2
  3. package/core/agent/README.md +2 -1
  4. package/core/agent/agent_artifacts.py +8 -6
  5. package/core/agent/agent_eval.py +136 -54
  6. package/core/agent/agent_execution.py +218 -52
  7. package/core/agent/agent_orchestrator.py +14 -8
  8. package/core/agent/agent_targets.py +8 -2
  9. package/core/agent/feature_baseline.py +150 -0
  10. package/core/assets/axe-core/LICENSE-3RD-PARTY.txt +66 -0
  11. package/core/assets/axe-core/LICENSE.txt +362 -0
  12. package/core/assets/axe-core/UPSTREAM.md +10 -0
  13. package/core/assets/axe-core/axe.min.js +12 -0
  14. package/core/assets/bugx-hero-en.svg +74 -0
  15. package/core/assets/bugx-hero-zh.svg +74 -0
  16. package/core/assets/codex.png +0 -0
  17. package/core/assets/dsh.png +0 -0
  18. package/core/assets/webui-chatgpt.jpg +0 -0
  19. package/core/assets/webui-session.jpg +0 -0
  20. package/core/assets/webui-skills.jpg +0 -0
  21. package/core/assets/webui-studio.jpg +0 -0
  22. package/core/assets/webui-zcode.jpg +0 -0
  23. package/core/assets/zcode.png +0 -0
  24. package/core/autonomous_cve/SPEC.md +1 -1
  25. package/core/autonomous_cve/attack_graph_store.py +152 -106
  26. package/core/autonomous_cve/behavior_graph.py +8 -2
  27. package/core/autonomous_cve/verifier.py +4 -1
  28. package/core/bugx.md +1 -1
  29. package/core/bugx_paths.py +43 -8
  30. package/core/cli-help.txt +66 -0
  31. package/core/cloud_sync/SPEC.md +1 -1
  32. package/core/cloud_sync/cloud_client.py +25 -6
  33. package/core/cloud_sync/cloud_onboard.py +42 -1
  34. package/core/cloud_sync/flywheel_client.py +16 -7
  35. package/core/cloud_sync/network_transport.py +24 -3
  36. package/core/cloud_sync/sensitive_filter.py +2 -2
  37. package/core/cloud_sync/sync_push.py +12 -10
  38. package/core/contracts/AGENT_GUIDE.md +6 -9
  39. package/core/contracts/README.md +2 -2
  40. package/core/contracts/bugx-runtime-contract.md +1 -1
  41. package/core/contracts/bugx-worker.md +1 -1
  42. package/core/contracts/engine_gap_contracts.py +86 -3
  43. package/core/coverage/coverage_discovery.py +599 -29
  44. package/core/coverage/coverage_evidence.py +47 -0
  45. package/core/coverage/coverage_forensics.py +9 -0
  46. package/core/coverage/coverage_validate.py +6 -1
  47. package/core/dev_harness/SPEC.md +1 -1
  48. package/core/engine-integrity.json +591 -419
  49. package/core/fuzzing/concurrency_fuzzer.py +53 -0
  50. package/core/fuzzing/differential_oracle.py +562 -27
  51. package/core/fuzzing/fuzz_input.py +109 -6
  52. package/core/fuzzing/stateful_fuzzer.py +72 -0
  53. package/core/governance/secret_redactor.py +22 -10
  54. package/core/host_acp/SPEC.md +1 -1
  55. package/core/host_acp/__init__.py +4 -4
  56. package/core/host_acp/claude.py +59 -1
  57. package/core/host_acp/cline.py +64 -1
  58. package/core/host_acp/codex.py +56 -1
  59. package/core/host_acp/dsh.py +59 -1
  60. package/core/host_acp/opencode.py +56 -1
  61. package/core/host_acp/pi.py +59 -1
  62. package/core/host_acp/zcode.py +59 -1
  63. package/core/host_runtime/SPEC.md +1 -1
  64. package/core/host_runtime/adapters.py +1 -1
  65. package/core/host_runtime/cline.py +13 -0
  66. package/core/host_runtime/host_evaluators.py +44 -4
  67. package/core/host_runtime/host_probe.py +1 -1
  68. package/core/host_runtime/host_provider_arbitrator.py +116 -62
  69. package/core/host_runtime/host_registry.py +15 -8
  70. package/core/host_runtime/mcp_registry_gate.py +12 -1
  71. package/core/host_runtime/pi.py +102 -0
  72. package/core/host_runtime/provider_facts.py +66 -0
  73. package/core/hosts/SPEC.md +1 -1
  74. package/core/hosts/__init__.py +6 -2
  75. package/core/hosts/_dsh_usage.py +1 -1
  76. package/core/hosts/base.py +32 -4
  77. package/core/hosts/claude.py +55 -0
  78. package/core/hosts/cline.py +6 -2
  79. package/core/hosts/codex.py +58 -0
  80. package/core/hosts/dsh.py +9 -1
  81. package/core/hosts/opencode.py +6 -6
  82. package/core/hosts/pi.py +159 -2
  83. package/core/infra/README.md +4 -2
  84. package/core/infra/__init__.py +2 -0
  85. package/core/infra/build_info.py +22 -3
  86. package/core/infra/client_metadata.py +1 -1
  87. package/core/infra/json_utils.py +22 -0
  88. package/core/launch_phases/README.md +2 -2
  89. package/core/launch_phases/SPEC.md +1 -1
  90. package/core/launch_phases/common.py +21 -2
  91. package/core/launch_phases/finding_confirm_phase.py +5 -1
  92. package/core/launch_phases/finding_settlement.py +188 -1
  93. package/core/launch_phases/judge_phase.py +69 -12
  94. package/core/launch_phases/orchestrator_controls.py +11 -7
  95. package/core/launch_phases/post_coverage_sync.py +9 -2
  96. package/core/launch_phases/post_phase.py +139 -3
  97. package/core/launch_phases/post_receipt.py +12 -1
  98. package/core/launch_phases/pre_phase.py +3 -3
  99. package/core/launch_phases/pre_recon_scout.py +53 -36
  100. package/core/launch_phases/pre_state_builder.py +23 -176
  101. package/core/launch_phases/round_orchestrator.py +15 -32
  102. package/core/launch_phases/session_runtime.py +56 -9
  103. package/core/launch_phases/startup_gates.py +36 -8
  104. package/core/launch_phases/startup_interaction.py +68 -12
  105. package/core/launch_phases/startup_version_gate.py +9 -3
  106. package/core/launch_phases/supervisor_bridge.py +46 -17
  107. package/core/launch_phases/supervisor_coverage.py +8 -2
  108. package/core/launch_phases/supervisor_degraded.py +1 -9
  109. package/core/launch_phases/worker_barriers.py +15 -5
  110. package/core/launch_phases/worker_orchestrator.py +105 -25
  111. package/core/ledger/README.md +1 -1
  112. package/core/ledger/SPEC.md +1 -1
  113. package/core/ledger/_facade.py +2 -1
  114. package/core/ledger/archive_ops.py +60 -2
  115. package/core/ledger/cli.py +6 -1
  116. package/core/ledger/export_ops.py +6 -1
  117. package/core/ledger/finding_confirmation.py +48 -6
  118. package/core/ledger/finding_lifecycle.py +428 -5
  119. package/core/ledger/finding_verification.py +44 -8
  120. package/core/ledger/incidents.py +10 -4
  121. package/core/ledger/patterns.py +10 -7
  122. package/core/ledger/receipt_contract.py +17 -1
  123. package/core/ledger/sync_ops.py +21 -16
  124. package/core/ledger/tool_experience.py +2 -1
  125. package/core/ledger/verify_life.py +88 -17
  126. package/core/locales/en-US.json +2 -2
  127. package/core/locales/zh-CN.json +2 -2
  128. package/core/mcp_handlers/SPEC.md +1 -1
  129. package/core/mcp_handlers/base.py +23 -3
  130. package/core/mcp_handlers/channel_lifecycle.py +85 -30
  131. package/core/mcp_handlers/retrieval_handlers.py +11 -1
  132. package/core/mcp_handlers/rpc_server.py +6 -1
  133. package/core/mcp_handlers/supervisor_handlers.py +32 -6
  134. package/core/mcp_handlers/tool_table.py +15 -0
  135. package/core/mcp_runtime_support/environment.py +0 -38
  136. package/core/mcp_runtime_support/verifier.py +0 -52
  137. package/core/metadata.txt +2 -3
  138. package/core/planning/README.md +1 -1
  139. package/core/planning/domain_router.py +4 -2
  140. package/core/planning/dynamic_flow_analyzer.py +219 -14
  141. package/core/planning/judge_pipeline.py +87 -4
  142. package/core/planning/prompt_harness.py +7 -5
  143. package/core/planning/spec_harvester.py +4 -4
  144. package/core/probes/INTERFACE.md +11 -1
  145. package/core/probes/SPEC.md +11 -1
  146. package/core/probes/__init__.py +46 -40
  147. package/core/probes/android_probe.py +177 -9
  148. package/core/probes/codebase_memory_probe.py +57 -0
  149. package/core/probes/desktop_probe.py +104 -0
  150. package/core/probes/differential_probe.py +99 -21
  151. package/core/probes/efficiency_probe.py +64 -0
  152. package/core/probes/ios_binary_probe.py +105 -1
  153. package/core/probes/memory_probe.py +66 -0
  154. package/core/probes/miniprogram_probe.py +75 -13
  155. package/core/probes/mobile_probe.py +215 -30
  156. package/core/probes/native_probe.py +88 -0
  157. package/core/probes/openwiki_probe.py +70 -0
  158. package/core/probes/pattern_probe.py +106 -0
  159. package/core/probes/platform_probe.py +81 -0
  160. package/core/probes/probe_registry.py +108 -7
  161. package/core/probes/sast_fixture_corpus.py +340 -0
  162. package/core/probes/sast_probe.py +553 -52
  163. package/core/probes/sast_rules.py +668 -28
  164. package/core/probes/sca_scanner.py +48 -0
  165. package/core/probes/ui_accessibility.py +149 -0
  166. package/core/probes/ui_audit.py +513 -0
  167. package/core/probes/ui_contract.py +273 -0
  168. package/core/probes/ui_evidence.py +212 -0
  169. package/core/probes/ui_measurements.py +314 -0
  170. package/core/probes/ui_repair.py +250 -0
  171. package/core/probes/ui_review.py +133 -0
  172. package/core/probes/ui_storybook.py +107 -0
  173. package/core/probes/ui_tokens.py +185 -0
  174. package/core/probes/ui_visual_diff.py +131 -0
  175. package/core/probes/web_probe.py +373 -18
  176. package/core/project_profiler/SPEC.md +1 -1
  177. package/core/project_profiler/arbitrator.py +6 -1
  178. package/core/project_profiler/detector.py +8 -1
  179. package/core/project_profiler/strategy.py +51 -15
  180. package/core/prompts/command_routing_en.md +2 -2
  181. package/core/prompts/command_routing_zh.md +2 -2
  182. package/core/prompts/stages/stage_repair.md +1 -1
  183. package/core/repair/README.md +1 -1
  184. package/core/repair/l7_repair_loop.py +1 -4
  185. package/core/repair/rsi_fixer.py +4 -4
  186. package/core/repair/rsi_loop.py +1 -3
  187. package/core/repair/rsi_repair.py +7 -7
  188. package/core/repair/rsi_scope.py +27 -8
  189. package/core/report_engine/SPEC.md +1 -1
  190. package/core/report_engine/attestation.py +8 -4
  191. package/core/report_engine/finding_report.py +2 -1
  192. package/core/report_engine/models.py +7 -9
  193. package/core/report_engine/sast_bridge.py +2 -2
  194. package/core/report_engine/server.py +18 -8
  195. package/core/report_engine/web-conformance.md +123 -18
  196. package/core/report_engine/web_conformance.py +21 -52
  197. package/core/retrieval/README.md +1 -1
  198. package/core/retrieval/SPEC.md +1 -1
  199. package/core/retrieval/code_analyzer.py +50 -14
  200. package/core/retrieval/context_assembler.py +7 -1
  201. package/core/retrieval/knowledge_sync.py +108 -14
  202. package/core/retrieval/symbol_index.py +25 -6
  203. package/core/retrieval/universal_code_matcher.py +234 -49
  204. package/core/runtime/README.md +1 -1
  205. package/core/runtime/bugx_logging.py +78 -7
  206. package/core/runtime/fixture_solidify.py +5 -10
  207. package/core/runtime/incident_eval.py +1 -1
  208. package/core/runtime/model_runner.py +4 -41
  209. package/core/runtime/platform_adapter.py +2 -2
  210. package/core/runtime/prep_validate.py +4 -2
  211. package/core/runtime/project_settings.py +2 -1
  212. package/core/runtime/scenario_eval.py +50 -8
  213. package/core/skills/bugx_docs_mcp_server.py +3 -1
  214. package/core/skills/bugx_mcp_server.py +29 -2
  215. package/core/skills/tools_kb.py +1 -1
  216. package/core/supervisor/README.md +1 -1
  217. package/core/supervisor/SPEC.md +1 -1
  218. package/core/supervisor/budget_governor.py +503 -9
  219. package/core/supervisor/checkpoint_pipeline.py +248 -6
  220. package/core/supervisor/checkpoint_sync.py +13 -0
  221. package/core/supervisor/claim_events.py +1 -1
  222. package/core/supervisor/finding_workflow.py +22 -5
  223. package/core/supervisor/lease_manager.py +1 -1
  224. package/core/supervisor/lifecycle_blocks.py +6 -1
  225. package/core/supervisor/rejection_remedies.py +52 -5
  226. package/core/supervisor/serial_authorization.py +48 -4
  227. package/core/supervisor/task_scheduler.py +2 -2
  228. package/core/supervisor/worker_checkpoint.py +8 -1
  229. package/core/supervisor/worker_runtime.py +8 -2
  230. package/core/supervisor_types/worker_claim.py +9 -0
  231. package/core/webui/README.md +1 -1
  232. package/core/webui/SPEC.md +2 -1
  233. package/core/webui/adapters/claude.py +5 -1
  234. package/core/webui/adapters/cline.py +10 -2
  235. package/core/webui/adapters/codex.py +5 -1
  236. package/core/webui/adapters/dsh.py +5 -1
  237. package/core/webui/docs_session_service.py +2 -2
  238. package/core/webui/mcp_inspector.py +11 -7
  239. package/core/webui/static/00-base.css +1060 -0
  240. package/core/webui/static/01-monitoring.css +802 -0
  241. package/core/webui/static/02-header-actions.css +321 -0
  242. package/core/webui/static/03-trigger-popover.css +697 -0
  243. package/core/webui/static/04-composer.css +628 -0
  244. package/core/webui/static/05-skills-center.css +878 -0
  245. package/core/webui/static/06-mcp-center.css +623 -0
  246. package/core/webui/static/07-skill-detail.css +265 -0
  247. package/core/webui/static/08-files-management.css +167 -0
  248. package/core/webui/static/09-files-center.css +386 -0
  249. package/core/webui/static/10-icons.css +105 -0
  250. package/core/webui/static/11-project-options.css +185 -0
  251. package/core/webui/static/12-profile-tab.css +383 -0
  252. package/core/webui/static/design-tokens.css +113 -0
  253. package/core/webui/static/index.html +14 -1
  254. package/core/webui/workspace_service.py +1 -1
  255. package/docs/07_distribution/01_README_NPM.md +190 -186
  256. package/ecosystem/integrations/README.md +1 -1
  257. package/ecosystem/integrations/dsh/mcp/package.json +1 -1
  258. package/ecosystem/integrations/dsh/skills/bugx-dsh/SKILL.md +1 -1
  259. package/ecosystem/integrations/dsh/ui/package.json +1 -1
  260. package/ecosystem/integrations/opencode/bugx-mcp-manifest.json +4 -4
  261. package/ecosystem/integrations/opencode/mcp-lock.json +14 -6
  262. package/ecosystem/integrations/opencode/opencode.json +23 -12
  263. package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
  264. package/ecosystem/integrations/qoder/connector-meta.json +1 -1
  265. package/ecosystem/integrations/workbuddy/connector-meta.json +1 -1
  266. package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +1 -1
  267. package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +1 -1
  268. package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +1 -1
  269. package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +1 -1
  270. package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +2 -2
  271. package/ecosystem/plugins/bugx/skills/bugx-dsh/SKILL.md +1 -1
  272. package/ecosystem/plugins/bugx/skills/bugx-opencode/SKILL.md +1 -1
  273. package/ecosystem/plugins/bugx/skills/bugx-zcode/SKILL.md +1 -1
  274. package/interfaces/bin/bugx.js +37 -0
  275. package/interfaces/cli/bugx_cli/__init__.py +4 -2
  276. package/interfaces/cli/bugx_cli/cli.py +11 -4
  277. package/interfaces/cli/bugx_cli/commands/advisory.py +1 -1
  278. package/interfaces/cli/bugx_cli/commands/agent.py +339 -73
  279. package/interfaces/cli/bugx_cli/commands/audit.py +2 -2
  280. package/interfaces/cli/bugx_cli/commands/autonomous.py +1 -1
  281. package/interfaces/cli/bugx_cli/commands/cloud.py +4 -3
  282. package/interfaces/cli/bugx_cli/commands/doctor.py +449 -204
  283. package/interfaces/cli/bugx_cli/commands/interaction.py +5 -1
  284. package/interfaces/cli/bugx_cli/commands/knowledge.py +2 -0
  285. package/interfaces/cli/bugx_cli/commands/lifecycle.py +3 -3
  286. package/interfaces/cli/bugx_cli/commands/plugin.py +55 -20
  287. package/interfaces/cli/bugx_cli/commands/plugin_claude.py +7 -7
  288. package/interfaces/cli/bugx_cli/commands/plugin_funide.py +2 -1
  289. package/interfaces/cli/bugx_cli/commands/plugin_zcode.py +1 -1
  290. package/interfaces/cli/bugx_cli/commands/report.py +2 -6
  291. package/interfaces/cli/bugx_cli/commands/system.py +11 -11
  292. package/interfaces/cli/bugx_cli/common.py +15 -7
  293. package/interfaces/cli/bugx_cli/host_adapters.py +29 -54
  294. package/interfaces/cli/bugx_cli/hosts/registry.py +8 -6
  295. package/interfaces/cli/bugx_cli/infra/ai_advisor.py +157 -27
  296. package/interfaces/cli/bugx_cli/infra/engine_installer.py +18 -10
  297. package/interfaces/cli/bugx_cli/infra/host_sync.py +11 -8
  298. package/interfaces/cli/bugx_cli/infra/mcp_advisor.py +76 -5
  299. package/interfaces/cli/bugx_cli/infra/security.py +13 -6
  300. package/package.json +2 -1
  301. package/pyproject.toml +20 -8
  302. package/scripts/ensure-python.mjs +7 -7
  303. package/scripts/sync-version.mjs +10 -21
  304. package/scripts/test-npm-wrapper.mjs +1 -1
  305. package/core/webui/static/project-settings.css +0 -6458
  306. package/docs/07_distribution/README.md +0 -16
  307. package/docs/README.md +0 -121
  308. package/interfaces/README.md +0 -143
  309. package/interfaces/bin/README.md +0 -35
  310. package/interfaces/cli/README.md +0 -90
  311. package/scripts/README.md +0 -118
@@ -481,20 +481,38 @@ def _merge_fingerprint_variants(state: Any, findings: list[dict[str, Any]]) -> i
481
481
  return out
482
482
 
483
483
  def slug_tokens(fingerprint: str) -> set[str]:
484
- """指纹最后一段短 slug 的语义词集合(≥3 字符;过滤通用词)。"""
484
+ """指纹最后一段短 slug 的语义词集合(≥3 字符;过滤通用词)。
485
+
486
+ F-RSI-20261110-019 v2:通用词表补 app/web/ui/api/lib/util——这些词
487
+ 在骨架型 slug(app-crash-loop / api-key-leak / web-socket-timeout)
488
+ 里精确共享会造成「不同缺陷同词」误并,与 src/core/py 同性质。
489
+ """
485
490
  slug = fingerprint.rsplit("::", 1)[-1]
486
- generic = {"src", "core", "py", "test", "tests", "main", "module"}
491
+ generic = {"src", "core", "py", "test", "tests", "main", "module",
492
+ "app", "web", "ui", "api", "lib", "util"}
487
493
  return {
488
494
  tok.lower() for tok in re.split(r"[-_]", slug)
489
495
  if len(tok) >= 3 and tok.lower() not in generic
490
496
  }
491
497
 
492
498
  def tokens_related(t1: set[str], t2: set[str]) -> bool:
493
- """两词集合存在前缀关系 token 对(sql/sqli、eval/evaluate 同源变体)。"""
494
- return any(
495
- a.startswith(b) or b.startswith(a)
496
- for a in t1 for b in t2
499
+ """F-RSI-20261110-019 v2 误并向修复:判据从「任意前缀对」收紧为
500
+ 「精确共享 token」或「≥2 个前缀关系 token 对」。
501
+
502
+ - 精确共享:同缺陷变体几乎必然共享缺陷名词(injection/traversal/
503
+ fstring)——sql-injection vs sqli-injection 精确共享 injection。
504
+ - ≥2 前缀对:纯缩写变体(path-traversal-read vs pth-traversal-write
505
+ 的 pth/path + traversal)仍归并。
506
+ - 单一 3 字符前缀对不再归并:sqlite/sql、auth/author、eval/evaluator
507
+ 是**不同缺陷**共享字母偶然前缀(红探针 A1-A3 实锤误并)。
508
+ """
509
+ if t1 & t2:
510
+ return True
511
+ prefix_pairs = sum(
512
+ 1 for a in t1 for b in t2
513
+ if a.startswith(b) or b.startswith(a)
497
514
  )
515
+ return prefix_pairs >= 2
498
516
 
499
517
  merged = 0
500
518
  existing = [
@@ -518,6 +536,27 @@ def _merge_fingerprint_variants(state: Any, findings: list[dict[str, Any]]) -> i
518
536
  return merged
519
537
 
520
538
 
539
+ def _roundup_package(slug: str, judge_dir: Path) -> dict[str, Any] | None:
540
+ """取该单元最新的 roundup 增广包(F-RSI-20261115-120)。
541
+
542
+ 无 round_no 的历史包不参与一跳判定(视为历史数据跳过);同 slug 多包
543
+ 时取目录时间戳最新的一个。目录不可读或解析失败返回 None。"""
544
+ best: tuple[float, Path] | None = None
545
+ for p in judge_dir.glob(f"roundup-*/{slug}.json"):
546
+ try:
547
+ ts = float(p.parent.name.split("-", 1)[1])
548
+ except (IndexError, ValueError):
549
+ ts = p.stat().st_mtime
550
+ if best is None or ts > best[0]:
551
+ best = (ts, p)
552
+ if best is None:
553
+ return None
554
+ try:
555
+ return json.loads(best[1].read_text(encoding="utf-8"))
556
+ except (OSError, json.JSONDecodeError):
557
+ return None
558
+
559
+
521
560
  def settle(verdicts_path: Path) -> int:
522
561
  """裁决收口:复现实跑取证 + 机械 checkpoint。"""
523
562
  root = resolve_project_root()
@@ -531,6 +570,14 @@ def settle(verdicts_path: Path) -> int:
531
570
  state = supervisor.status()
532
571
  fingerprint = state.target_fingerprint or supervisor.target_fingerprint
533
572
  accepted = rejected = 0
573
+ # F-RSI-20261112-079:无合法 verdict 条目时旧实现返回 rc=0(accepted=0
574
+ # rejected=0 的「假成功」)——输入垃圾文件与全部成功不可区分,宿主会
575
+ # 把结账失败当完成。诚实 rc:零合法条目=结账未发生=rc 1。
576
+ if not any(
577
+ isinstance(v, Mapping) and v.get("unit_id") for v in verdicts
578
+ ):
579
+ print(f"[judge] ✗ {verdicts_path} 内没有可结算的 verdict 条目(缺 unit_id 或非对象),拒绝假成功")
580
+ return 1
534
581
  for verdict in verdicts:
535
582
  if not isinstance(verdict, Mapping) or not verdict.get("unit_id"):
536
583
  continue
@@ -559,10 +606,16 @@ def settle(verdicts_path: Path) -> int:
559
606
  battery_evidence = _battery_evidence_for(root, claim_state)
560
607
  requests = verdict.get("probe_requests")
561
608
  slug_u = judge_pipeline.unit_parts(unit_id)[0].replace("/", "_") or "unit"
562
- already_roundup = any(
563
- p.stem == slug_u for p in _judge_dir().glob("roundup-*/*.json"))
564
- if already_roundup:
565
- requests = None # 服务端一跳上限:该单元已定向探针过,禁止二跳
609
+ current_round = int(getattr(state, "round_no", 1) or 1)
610
+ # F-RSI-20261115-120:一跳上限绑定当前轮(用户裁决 2026-11-15:每轮
611
+ # 全量重测,上轮忽视细节轮间必须可再探)——旧实现 glob 全部历史
612
+ # roundup 目录使禁令跨轮永续。轮内仍保持一跳(防 judge 反复要探针失控)。
613
+ round_pkg = _roundup_package(slug_u, _judge_dir())
614
+ if (round_pkg is not None
615
+ and int(round_pkg.get("round_no") or 0) == current_round):
616
+ requests = None # 本轮已定向探针过,禁止本轮内二跳
617
+ print(f"[judge] ⛔ {unit_id} 本轮已定向探针过(一跳上限),剥除重复探针请求")
618
+ _judge_log("hop_cap_stripped", unit=unit_id, round_no=current_round)
566
619
  if (verdict.get("verdict") == "insufficient_data"
567
620
  and requests and not verdict.get("probe_round")):
568
621
  # 定向探针一跳:宿主执行 judge 指定的探针,把增广证据打包回给
@@ -580,6 +633,7 @@ def settle(verdicts_path: Path) -> int:
580
633
  unit_id, root, battery_evidence + probe_evidence)
581
634
  if augmented is not None:
582
635
  augmented["probe_round"] = 1
636
+ augmented["round_no"] = current_round # F-RSI-20261115-120:一跳判定按轮
583
637
  augmented["_claim"] = {
584
638
  "worker_id": worker_id,
585
639
  "lease_id": claim_state.lease_id,
@@ -614,10 +668,14 @@ def settle(verdicts_path: Path) -> int:
614
668
  verdict, battery_evidence, reproduction,
615
669
  )
616
670
  if payload is None:
671
+ # F-RSI-20261112-079:防御分支(上游唯一 None 条件=unit_ids 空,
672
+ # 与 claim_state 命中条件互斥,常态不可达)——保留兜底但 id 必须
673
+ # 与正常路径同构含 uuid 段,防止同 worker 多次 blocked 撞
674
+ # checkpoint 幂等分支的「payload 不一致拒绝重放」。
617
675
  print(f"[judge] {unit_id}:无可绑定证据,标 blocked")
618
676
  supervisor.submit_checkpoint(
619
677
  worker_id,
620
- checkpoint_id=f"judge-{worker_id}-blocked",
678
+ checkpoint_id=f"judge-{worker_id}-blocked-{uuid.uuid4().hex[:8]}",
621
679
  coverage={unit_id: "blocked"},
622
680
  notes={unit_id: "judge battery produced no bindable evidence"},
623
681
  )
@@ -731,7 +789,6 @@ def settle_dir(path: Path) -> int:
731
789
  continue
732
790
  if data is None:
733
791
  continue
734
- continue
735
792
  entries = data if isinstance(data, list) else [data]
736
793
  for entry in entries:
737
794
  # PE-20261109-003:目录收割只认显式 verdict 字段。带 unit_id 但缺
@@ -32,6 +32,7 @@ from core.launch_phases.common import (
32
32
  VERIFY,
33
33
  child_environment,
34
34
  format_duration,
35
+ option_value as _common_option_value,
35
36
  resolve_project_root,
36
37
  run_verify_life,
37
38
  uses_project_layout,
@@ -78,13 +79,7 @@ from core.launch_phases.supervisor_bridge import (
78
79
  get_supervisor,
79
80
  )
80
81
 
81
- def _option_value(args: list[str], option: str) -> str | None:
82
- for i, arg in enumerate(args):
83
- if arg == option:
84
- return args[i + 1] if i + 1 < len(args) else None
85
- if arg.startswith(f"{option}="):
86
- return arg.split("=", 1)[1]
87
- return None
82
+ _option_value = _common_option_value
88
83
 
89
84
 
90
85
  #: 公开别名:同包延迟导入方(candidate_revalidation)必须用公开名——架构棘轮
@@ -653,6 +648,15 @@ def print_help() -> int:
653
648
  `name==version --hash=sha256:<64hex>`。安装强制
654
649
  --require-hashes --no-deps --only-binary=:all:,
655
650
  在中性临时目录执行且清空 PIP_*/PYTHON* 环境变量
651
+ judge [选项] 对 pending 单元批量预占+电池取证并输出判读包
652
+ (--all 按文件分组一次领完;--settle <verdicts.json>
653
+ 裁决收口;--settle-dir <dir> 收割目录统一结算)
654
+ findings-confirm [选项] Finding 确认门禁:对已裁决候选做终态确认
655
+ coverage <子命令> 覆盖治理(review-packages/review-apply/status 等,
656
+ 见 bugx engine coverage --help)
657
+ audit [选项] 在隔离副本中启动图审计或全息攻防渗透审计
658
+ prompt [--stage <name>] 输出指定阶段的 Stage Harness 任务包
659
+ daemon [选项] 自治持续挖掘常驻守护进程管理
656
660
  help | --help | -h 显示本说明
657
661
 
658
662
  保护边界
@@ -417,8 +417,15 @@ def close_session(final_round_id: str | None = None, *, reason: str = "completed
417
417
  "rounds_count": int(state.get("polling_round", 1) or 1),
418
418
  "status": final_state,
419
419
  })
420
- except Exception:
421
- pass
420
+ except Exception as exc:
421
+ # F-RSI-20261113-112:遥测上报失败不得静默——tokens_consumed 是
422
+ # 全局每日预算熔断(DOC-049)与账单观测的输入,静默丢失=计量
423
+ # 缺口。fail-open 保留(遥测不阻断结算),但缺口必须可观测
424
+ # (F-104/106/109 同款守卫系列第 4 处)。
425
+ print(
426
+ f"[post] ⚠ 会话遥测上报失败(全局 token 计量将缺口本次消耗): {exc}",
427
+ file=sys.stderr,
428
+ )
422
429
  return runtime_summary(current)
423
430
 
424
431
 
@@ -102,6 +102,7 @@ from core.launch_phases.finding_settlement import (
102
102
  derive_settle_line,
103
103
  gate_confirmed_findings,
104
104
  archive_stale_findings_binding,
105
+ refresh_stale_findings_json,
105
106
  settle_findings_path,
106
107
  verify_findings_binding,
107
108
  FindingsSnapshot,
@@ -347,6 +348,88 @@ def post(
347
348
  return result
348
349
 
349
350
 
351
+ def _supervisor_owner_cancelled_proof(runtime: dict) -> tuple[bool, str]:
352
+ """跨会话 --final 收口的 owner 死亡证明核验(E1 遗留观察 #3 机制 a)。
353
+
354
+ 合法接手者 =「同 lifecycle 绑定 + 原 owner 已取消终态在场」,用死亡证明
355
+ 替代同进程授权;fail-closed:任一证据缺失即拒绝,授权语义不放宽:
356
+
357
+ 1. runtime 必须是已被孤儿裁决收敛的 ``aborted`` 终态(由调用方前置判断);
358
+ 2. 项目布局下 runtime 的 ``lifecycle_id`` 必须等于 current.json 当前绑定
359
+ (接手者确实站在同一 lifecycle 上,而非无关会话);
360
+ 3. Supervisor 权威链(``status()`` 加载时已做 hash-chain 校验)必须在场
361
+ ``operation=lifecycle`` / ``gate=owner_cancelled`` 阻断事件(D27 宿主
362
+ 取消回传,即 owner 死亡证明);
363
+ 4. 链身份必须绑定同一 lifecycle(``round_id`` 相等且 ``run_id`` 落在
364
+ runtime 采纳/引擎派生形态集合内)。
365
+ """
366
+ lifecycle_id = runtime.get("lifecycle_id")
367
+ if not isinstance(lifecycle_id, str) or not lifecycle_id.strip():
368
+ return False, "runtime lifecycle identity missing"
369
+ if uses_project_layout():
370
+ try:
371
+ current = bugx_paths.read_current(resolve_project_root())
372
+ except (OSError, ValueError, RuntimeError) as exc:
373
+ return False, f"current lifecycle binding unreadable: {exc}"
374
+ if str(current.get("lifecycle_id") or "") != lifecycle_id:
375
+ return False, "runtime lifecycle is not the current lifecycle binding"
376
+ session_id = runtime.get("session_id") or runtime.get("polling_id")
377
+ allowed_run_ids = {runtime.get("run_id")}
378
+ if isinstance(session_id, str) and session_id.strip():
379
+ allowed_run_ids.add(f"lifecycle-{session_id}-{lifecycle_id}")
380
+ allowed_run_ids.add(f"lifecycle-{lifecycle_id}")
381
+ try:
382
+ state = get_supervisor().status()
383
+ except Exception as exc: # noqa: BLE001 - 链不可读一律 fail-closed
384
+ return False, f"supervisor chain unavailable: {exc}"
385
+ if (
386
+ getattr(state, "round_id", None) != lifecycle_id
387
+ or getattr(state, "run_id", None) not in allowed_run_ids
388
+ ):
389
+ return False, "supervisor chain identity does not bind this lifecycle"
390
+ chain_session = getattr(state, "session_id", None)
391
+ if (
392
+ isinstance(chain_session, str) and chain_session.strip()
393
+ and isinstance(session_id, str) and session_id.strip()
394
+ and chain_session != session_id
395
+ ):
396
+ # 链上会话代际与 runtime 会话代际分裂:接手锚点只认同一代际。
397
+ return False, "supervisor chain session does not match runtime session"
398
+ for event in getattr(state, "history", []) or []:
399
+ if (
400
+ isinstance(event, Mapping)
401
+ and event.get("type") in {"lifecycle_blocked", "lifecycle_blocked_throttled"}
402
+ and event.get("operation") == "lifecycle"
403
+ and event.get("gate") == "owner_cancelled"
404
+ ):
405
+ return True, "owner_cancelled death proof present in supervisor chain"
406
+ return False, "no owner_cancelled death proof in supervisor chain"
407
+
408
+
409
+ def _recovery_closeout_exemption_violation(
410
+ gate: Mapping[str, object], *, final: bool,
411
+ ) -> list[str] | None:
412
+ """D5 fail-closed 守卫:恢复结算并发豁免只服务 ``--final`` 收口场景。
413
+
414
+ 并行门(budget_governor)在三条件全真时豁免 require_parallel 的并发
415
+ 证明债并落 ``parallel_gate_inherited_closeout`` 留痕。该豁免的合法消费
416
+ 场景是恢复会话的 ``--final`` 结算收口;非 final 的 post 必须把被豁免的
417
+ 并行证明债还原为拒绝,防止零工作会话借恢复豁免越过非终局结算的并行门。
418
+ 豁免未生效(缺字段/ ineligible/ 无被豁免原因)时返回 None,行为不变。
419
+
420
+ 返回被豁免的原因列表表示违规(调用方应拒绝);None 表示无需干预。
421
+ """
422
+ exemption = gate.get("recovery_closeout_exemption")
423
+ if not isinstance(exemption, Mapping) or not exemption.get("eligible"):
424
+ return None
425
+ suppressed = exemption.get("suppressed_reasons")
426
+ if not isinstance(suppressed, list) or not suppressed:
427
+ return None
428
+ if final:
429
+ return None
430
+ return [str(reason) for reason in suppressed]
431
+
432
+
350
433
  def _post_impl(
351
434
  final: bool = False, share: str | None = None, *, allow_incomplete: bool = False,
352
435
  allow_serial: bool = False,
@@ -371,7 +454,27 @@ def _post_impl(
371
454
  polling_id=active_runtime.get("polling_id") or active_runtime.get("session_id"),
372
455
  )
373
456
  _begin_post_gate("runtime_active")
374
- if not active_runtime.get("active") or active_runtime.get("state") not in {"running", "finished"}:
457
+ runtime_gate_ok = (
458
+ bool(active_runtime.get("active"))
459
+ and active_runtime.get("state") in {"running", "finished"}
460
+ )
461
+ if not runtime_gate_ok and final and active_runtime.get("state") == "aborted":
462
+ # E1 遗留观察 #3 机制 a:owner 进程死亡后 runtime 被孤儿裁决收敛为
463
+ # aborted,「本会话 pre 授权」跨会话不可达,诚实 INCOMPLETE 收口永久
464
+ # 不可达。合法接手 = 同 lifecycle 绑定 + Supervisor 权威链在场
465
+ # owner_cancelled 死亡证明;无证明仍拒绝(fail-closed 不放宽)。
466
+ admitted, successor_proof = _supervisor_owner_cancelled_proof(active_runtime)
467
+ if admitted:
468
+ runtime_gate_ok = True
469
+ print(f"→ [跨会话收口] {successor_proof};允许合法接手者执行 --final 收口。")
470
+ try:
471
+ append_runtime_event(
472
+ active_runtime, "successor_closeout_admitted", time.time(),
473
+ successor_proof,
474
+ )
475
+ except (OSError, ValueError, RuntimeError) as exc:
476
+ print(f"[post] ⚠ 跨会话收口留痕失败(收口继续): {exc}")
477
+ if not runtime_gate_ok:
375
478
  return _fail_post(
376
479
  "post 必须紧接对应的活动 pre/runtime 会话执行,拒绝复用旧快照结算",
377
480
  gate="runtime_active",
@@ -564,6 +667,31 @@ def _post_impl(
564
667
  if serial_override:
565
668
  gate_ok = True
566
669
  print("并发门禁:已验证合法串行凭证,允许单 Worker 收尾。")
670
+ # D5(fail-closed):恢复结算并发豁免(parallel_gate_inherited_closeout)
671
+ # 仅限 --final 收口消费;非 final post 把被豁免的并行证明债还原为拒绝。
672
+ exemption_violation = _recovery_closeout_exemption_violation(gate, final=final)
673
+ if exemption_violation:
674
+ gate_ok = False
675
+ print(
676
+ "[post] ⚠ 恢复结算并发豁免仅限 --final 收口场景:非 final post "
677
+ "不接受继承结账豁免,被豁免的并行证明债保持拒绝:"
678
+ + ", ".join(exemption_violation)
679
+ )
680
+ elif final:
681
+ exemption = gate.get("recovery_closeout_exemption")
682
+ if (
683
+ isinstance(exemption, Mapping)
684
+ and exemption.get("eligible")
685
+ and exemption.get("suppressed_reasons")
686
+ ):
687
+ print(
688
+ "[post] 恢复结算并发豁免生效(留痕事件 "
689
+ "parallel_gate_inherited_closeout,三条件快照见 Supervisor 链):"
690
+ + ", ".join(
691
+ str(reason)
692
+ for reason in exemption.get("suppressed_reasons", [])
693
+ )
694
+ )
567
695
  if not gate_ok:
568
696
  return _fail_post(
569
697
  "并发门禁未满足:Life 未满足("
@@ -621,8 +749,16 @@ def _post_impl(
621
749
  findings_snapshot: FindingsSnapshot | None = None
622
750
  _begin_post_gate("findings_snapshot")
623
751
  try:
624
- if quiet_auto and auto_mode(active_runtime) and settle_findings_path(active_runtime) is None:
625
- auto_build_findings_json(active_runtime)
752
+ if quiet_auto and auto_mode(active_runtime):
753
+ # obs-2(2026-11-17):同 run 内先于裁决生成的 findings.json 会让旧
754
+ # 判定(仅 run_id/lifecycle)漏判 stale,旧候选视图被直接结算。
755
+ # 先做派生视图 vs 权威态一致性刷新:落后 → 归档 .stale-backup,
756
+ # settle_findings_path 返回 None,走 auto_build 从权威态重建。
757
+ stale_note = refresh_stale_findings_json(active_runtime)
758
+ if stale_note:
759
+ print(f"[post] {stale_note}")
760
+ if settle_findings_path(active_runtime) is None:
761
+ auto_build_findings_json(active_runtime)
626
762
  # 遗留 binding 归档(2026-11-09 实测修复 findings_binding_mismatch 死锁):
627
763
  # findings.json 绑定指向**已终结的旧 run** 时(auto 续轮换 run_id 后旧
628
764
  # 文件还在),那是旧 Life 的合法产物——归档回它所属的位置而不是拒绝
@@ -300,9 +300,20 @@ def verify_acceptance_receipt(receipt_path: Path) -> ReceiptVerificationResult:
300
300
  if "+build." not in engine_version:
301
301
  return ReceiptVerificationResult(
302
302
  False,
303
- f"Engine Version 声明必须带 build id(形如 1.0.0+build.N):"
303
+ f"Engine Version 声明必须带 build id(形如 0.1.0+build.N):"
304
304
  f"当前为 {engine_version!r}——收据无法自证是哪个引擎版本产出的",
305
305
  )
306
+ outcome_text = str(data.get("outcome") or "").strip()
307
+ if not outcome_text:
308
+ # F-RSI-20261115-125:outcome 是收据 schema 必写字段(写侧恒写),
309
+ # 删除该字段即可让 terminal 契约对两字段都查不到 INCOMPLETE 而
310
+ # 整段静默——「静默 INCOMPLETE 禁令」(CORE-306 §9)可被删字段
311
+ # 绕过。与 git_commit/engine_version 同型必填校验。
312
+ return ReceiptVerificationResult(
313
+ False,
314
+ "缺少 outcome 终态声明:收据必须显式声明终局结果"
315
+ "(删除 outcome 即可绕过「静默 INCOMPLETE」禁令)",
316
+ )
306
317
  hashes = data.get("artifact_hashes") or {}
307
318
  target_candidates: dict[str, list[str]] = {
308
319
  "module-coverage.md": ["module-coverage.md"],
@@ -174,7 +174,7 @@ def _snapshot_startup_git_dirty_paths(root: Path) -> list[str] | None:
174
174
  return sorted(paths)
175
175
 
176
176
 
177
- def _startup_policy_config(
177
+ def startup_policy_config(
178
178
  root: Path, cli_overrides: dict[str, Any] | None = None,
179
179
  ) -> dict[str, str]:
180
180
  """Resolve startup policy from system, user, project, then CLI scope."""
@@ -227,10 +227,10 @@ def _startup_policy_config(
227
227
  def startup_policy_explicit_keys(root: Path) -> frozenset[str]:
228
228
  """返回用户/项目 ``config.json`` 中**显式**声明的启动策略键集合。
229
229
 
230
- ``_startup_policy_config`` 会用 ``_STARTUP_DEFAULTS`` 播种全部键,调用方
230
+ ``startup_policy_config`` 会用 ``_STARTUP_DEFAULTS`` 播种全部键,调用方
231
231
  因此无法区分「用户配置了 local」与「默认值就是 local」。需要区分二者的
232
232
  门禁(如 ``report_policy`` 三选一:未显式声明才询问)只能读原始配置文件。
233
- 非法/不可读配置在 ``_startup_policy_config`` 已 fail-closed,这里静默跳过
233
+ 非法/不可读配置在 ``startup_policy_config`` 已 fail-closed,这里静默跳过
234
234
  仅用于判定「是否显式」,不承担校验职责。
235
235
  """
236
236
  keys: set[str] = set()
@@ -87,8 +87,10 @@ def extract_sink_snippets(root: Path, sinks: list[dict[str, Any]], max_snippets:
87
87
  if not s_file or not isinstance(s_line, int) or (s_file, s_line) in seen:
88
88
  continue
89
89
  seen.add((s_file, s_line))
90
- f_path = root / s_file
91
- if not f_path.is_file() or f_path.is_symlink():
90
+ if Path(s_file).is_absolute():
91
+ continue
92
+ f_path = (root / s_file).resolve()
93
+ if not f_path.is_relative_to(root.resolve()) or not f_path.is_file():
92
94
  continue
93
95
  try:
94
96
  lines = f_path.read_text(encoding="utf-8", errors="replace").splitlines()
@@ -114,50 +116,61 @@ def extract_project_readme_summary(root: Path, max_chars: int = 2000) -> str:
114
116
  return ""
115
117
 
116
118
 
119
+ def _mcp_server_names(payload: Any, container_key: str | None) -> list[str]:
120
+ """从宿主声明的容器键(可点分)里取出 MCP 服务器名;兼容通用键位。"""
121
+ containers = [container_key] if container_key else []
122
+ containers += ["mcpServers", "mcp_servers", "mcp.servers"]
123
+ names: list[str] = []
124
+ for key in dict.fromkeys(c for c in containers if c):
125
+ node: Any = payload
126
+ for part in key.split("."):
127
+ node = node.get(part) if isinstance(node, dict) else None
128
+ if isinstance(node, dict):
129
+ names.extend(str(k) for k in node)
130
+ elif isinstance(node, list):
131
+ names.extend(str(s.get("name") or s) for s in node if s)
132
+ return names
133
+
134
+
117
135
  def collect_mcp_skills_inventory(root: Path) -> dict[str, Any]:
118
136
  """扫描项目中已配置的 MCP 服务器和 Skills 清单,供 AI 评估 tooling 充足性。"""
119
137
  inventory: dict[str, Any] = {"mcp_servers": [], "skills": [], "mcp_config_files": []}
120
- # 常见 MCP 配置文件位置(通用配置 + 各宿主插件声明的项目级相对路径)
121
- mcp_config_candidates = [
122
- root / ".bugx" / "mcp-config.json",
123
- root / ".bugx" / "mcp_config.json",
124
- root / "mcp-lock.json",
125
- root / ".mcp.json",
126
- ]
138
+ # 宿主声明的项目级 MCP 配置路径 → 该宿主的容器键(opencode 是 ``mcp.servers``,
139
+ # codex 是 TOML ``mcp_servers``)。写入面是唯一事实,这里不重复硬编码。
140
+ relpaths: dict[str, str | None] = {}
127
141
  try:
128
142
  from core.host_runtime import host_registry
129
- for rel in host_registry.host_project_mcp_relpaths():
130
- cand = root / rel
131
- if cand not in mcp_config_candidates:
132
- mcp_config_candidates.append(cand)
143
+ relpaths = dict(host_registry.host_project_mcp_containers())
133
144
  except Exception:
134
145
  pass
135
- for cfg_path in mcp_config_candidates:
146
+ mcp_config_candidates: list[tuple[Path, str | None]] = [
147
+ (root / rel, key) for rel, key in relpaths.items()
148
+ ]
149
+ for extra in (".bugx/mcp-config.json", ".bugx/mcp_config.json", "mcp-lock.json", ".mcp.json"):
150
+ if not any(p == root / extra for p, _ in mcp_config_candidates):
151
+ mcp_config_candidates.append((root / extra, None))
152
+ for cfg_path, container_key in mcp_config_candidates:
136
153
  if not cfg_path.is_file():
137
154
  continue
138
155
  inventory["mcp_config_files"].append(str(cfg_path.relative_to(root)))
139
156
  try:
140
157
  text = cfg_path.read_text(encoding="utf-8", errors="replace")
141
- # JSON 格式
142
- if cfg_path.suffix == ".json":
143
- data = json.loads(text)
144
- servers = data.get("mcpServers") or data.get("mcp_servers") or {}
145
- if isinstance(servers, dict):
146
- inventory["mcp_servers"].extend(list(servers.keys()))
147
- elif isinstance(servers, list):
148
- inventory["mcp_servers"].extend(
149
- str(s.get("name") or s) for s in servers if s
150
- )
158
+ if cfg_path.suffix == ".toml":
159
+ import tomllib
160
+ payload: Any = tomllib.loads(text)
161
+ else:
162
+ payload = json.loads(text)
163
+ inventory["mcp_servers"].extend(_mcp_server_names(payload, container_key))
151
164
  except Exception:
152
165
  pass
153
166
  # 去重
154
167
  inventory["mcp_servers"] = sorted(set(inventory["mcp_servers"]))
155
- # Skills: 扫描 .agents/skills 和 skills/
168
+ # Skills: 扫描 .agents/skills 和 skills/(含 <category>/<name>/SKILL.md 两级布局)
156
169
  for skills_dir in (root / ".agents" / "skills", root / "skills"):
157
170
  if skills_dir.is_dir():
158
- for skill_dir in skills_dir.iterdir():
159
- if skill_dir.is_dir() and (skill_dir / "SKILL.md").is_file():
160
- inventory["skills"].append(skill_dir.name)
171
+ for skill_md in skills_dir.glob("**/SKILL.md"):
172
+ inventory["skills"].append(skill_md.parent.name)
173
+ inventory["skills"] = sorted(set(inventory["skills"]))
161
174
  return inventory
162
175
 
163
176
 
@@ -541,14 +554,18 @@ def run_recon_scout(
541
554
  for item in raw_hypotheses:
542
555
  if not isinstance(item, dict):
543
556
  continue
544
- src = str(item.get("source_file", ""))
545
- line = int(item.get("line") or 1)
546
- # 滑窗模糊锚定门禁
547
- if attack_graph_store.verify_hypothesis_anchor(root, src, line):
548
- valid_ops.append((
549
- attack_graph_store.EVENT_HYPOTHESIS_PROPOSED,
550
- {**item, "round_no": round_no, "status": "proposed", "confirmed_by_ai": True},
551
- ))
557
+ try:
558
+ src = str(item.get("source_file", ""))
559
+ line = int(item.get("line") or 1)
560
+ # 滑窗模糊锚定门禁
561
+ if attack_graph_store.verify_hypothesis_anchor(root, src, line):
562
+ valid_ops.append((
563
+ attack_graph_store.EVENT_HYPOTHESIS_PROPOSED,
564
+ {**item, "round_no": round_no, "status": "proposed", "confirmed_by_ai": True},
565
+ ))
566
+ except (TypeError, ValueError):
567
+ # 单条假说的脏 line 不得丢弃整批已通过锚定的假说
568
+ continue
552
569
  if valid_ops:
553
570
  attack_graph_store.record_events(root, valid_ops)
554
571
  print(f" [ReconScout] ✓ 成功注水 {len(valid_ops)} 个 AI 确认假说至作战攻击图")