okstra 0.232.0 → 0.233.0

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 (183) hide show
  1. package/README.md +19 -283
  2. package/dist/cli-registry.mjs +8 -1
  3. package/dist/cli-registry.mjs.map +1 -1
  4. package/dist/commands/execute/render-bundle.d.mts +6 -1
  5. package/dist/commands/execute/render-bundle.mjs +139 -32
  6. package/dist/commands/execute/render-bundle.mjs.map +1 -1
  7. package/dist/commands/lifecycle/config.mjs +6 -74
  8. package/dist/commands/lifecycle/config.mjs.map +1 -1
  9. package/dist/commands/trace/capacity.d.mts +12 -0
  10. package/dist/commands/trace/capacity.mjs +21 -0
  11. package/dist/commands/trace/capacity.mjs.map +1 -0
  12. package/dist/commands/trace/model.d.mts +89 -0
  13. package/dist/commands/trace/model.mjs +251 -0
  14. package/dist/commands/trace/model.mjs.map +1 -0
  15. package/dist/commands/trace/progression.d.mts +11 -0
  16. package/dist/commands/trace/progression.mjs +194 -0
  17. package/dist/commands/trace/progression.mjs.map +1 -0
  18. package/dist/commands/trace/review.d.mts +7 -0
  19. package/dist/commands/trace/review.mjs +51 -0
  20. package/dist/commands/trace/review.mjs.map +1 -0
  21. package/dist/commands/trace/task-link.d.mts +18 -0
  22. package/dist/commands/trace/task-link.mjs +72 -0
  23. package/dist/commands/trace/task-link.mjs.map +1 -0
  24. package/dist/commands/trace/trace.d.mts +1 -0
  25. package/dist/commands/trace/trace.mjs +293 -0
  26. package/dist/commands/trace/trace.mjs.map +1 -0
  27. package/dist/lib/bounded-file.d.mts +1 -0
  28. package/dist/lib/bounded-file.mjs +36 -0
  29. package/dist/lib/bounded-file.mjs.map +1 -0
  30. package/dist/lib/config-store.d.mts +34 -0
  31. package/dist/lib/config-store.mjs +70 -0
  32. package/dist/lib/config-store.mjs.map +1 -0
  33. package/dist/lib/file-lock.mjs +4 -5
  34. package/dist/lib/file-lock.mjs.map +1 -1
  35. package/dist/lib/input-limit.d.mts +4 -0
  36. package/dist/lib/input-limit.mjs +8 -0
  37. package/dist/lib/input-limit.mjs.map +1 -0
  38. package/dist/lib/memory-auto-register.mjs +2 -17
  39. package/dist/lib/memory-auto-register.mjs.map +1 -1
  40. package/dist/lib/report-language-tag.d.mts +1 -0
  41. package/dist/lib/report-language-tag.mjs +4 -0
  42. package/dist/lib/report-language-tag.mjs.map +1 -0
  43. package/dist/lib/report-language.d.mts +1 -0
  44. package/dist/lib/report-language.mjs +50 -0
  45. package/dist/lib/report-language.mjs.map +1 -0
  46. package/dist/lib/skill-catalog.mjs +3 -0
  47. package/dist/lib/skill-catalog.mjs.map +1 -1
  48. package/docs/architecture/storage-model.md +36 -5
  49. package/docs/architecture.md +10 -4
  50. package/docs/cli.md +279 -2
  51. package/docs/contributor-change-matrix.md +1 -2
  52. package/docs/project-structure-overview.md +31 -41
  53. package/package.json +1 -1
  54. package/runtime/BUILD.json +2 -2
  55. package/runtime/agents/operations/trace-interface-review.json +6 -0
  56. package/runtime/agents/operations/trace-scope-review.json +6 -0
  57. package/runtime/prompts/coding-preflight/authoring-checks.md +1 -1
  58. package/runtime/prompts/coding-preflight/clean-code.md +18 -20
  59. package/runtime/prompts/coding-preflight/overview.md +1 -1
  60. package/runtime/prompts/duties/code-reviewer.json +1 -1
  61. package/runtime/prompts/duties/interface-reviewer.json +32 -0
  62. package/runtime/prompts/host-orchestration/README.md +18 -9
  63. package/runtime/prompts/launch.template.md +3 -2
  64. package/runtime/prompts/lead/context-loader.md +2 -0
  65. package/runtime/prompts/lead/okstra-lead-contract.md +7 -7
  66. package/runtime/prompts/lead/report-writer.md +6 -6
  67. package/runtime/prompts/profiles/_coding-conventions-preflight.md +2 -2
  68. package/runtime/prompts/profiles/_common-contract.md +1 -1
  69. package/runtime/python/okstra_ctl/agent/invocation.py +1 -0
  70. package/runtime/python/okstra_ctl/agent/prompt_cli/cli.py +66 -26
  71. package/runtime/python/okstra_ctl/agent/prompt_cli/corrections.py +23 -8
  72. package/runtime/python/okstra_ctl/agent/prompt_cli/materialize.py +28 -10
  73. package/runtime/python/okstra_ctl/agent/prompt_cli/results.py +8 -11
  74. package/runtime/python/okstra_ctl/agent/standalone.py +12 -0
  75. package/runtime/python/okstra_ctl/analysis_packet.py +22 -11
  76. package/runtime/python/okstra_ctl/code_review_census.py +93 -2
  77. package/runtime/python/okstra_ctl/code_review_prepare.py +381 -0
  78. package/runtime/python/okstra_ctl/code_review_run.py +384 -0
  79. package/runtime/python/okstra_ctl/code_review_scope.py +13 -0
  80. package/runtime/python/okstra_ctl/code_review_supervisor.py +41 -0
  81. package/runtime/python/okstra_ctl/code_review_target.py +140 -15
  82. package/runtime/python/okstra_ctl/coverage_census.py +11 -2
  83. package/runtime/python/okstra_ctl/design_snapshot.py +16 -9
  84. package/runtime/python/okstra_ctl/direct_work.py +45 -3
  85. package/runtime/python/okstra_ctl/dispatch_core.py +31 -15
  86. package/runtime/python/okstra_ctl/dispatch_state.py +9 -2
  87. package/runtime/python/okstra_ctl/domain/role.py +1 -0
  88. package/runtime/python/okstra_ctl/doyouknow/sources/manager.py +48 -9
  89. package/runtime/python/okstra_ctl/final_report_schema.py +37 -34
  90. package/runtime/python/okstra_ctl/incremental_carry.py +6 -7
  91. package/runtime/python/okstra_ctl/initial_prompt_materialization.py +9 -2
  92. package/runtime/python/okstra_ctl/json_boundary.py +33 -6
  93. package/runtime/python/okstra_ctl/manager_cli.py +122 -1
  94. package/runtime/python/okstra_ctl/manager_journal.py +126 -0
  95. package/runtime/python/okstra_ctl/manager_launch.py +3 -3
  96. package/runtime/python/okstra_ctl/manager_log.py +221 -0
  97. package/runtime/python/okstra_ctl/manager_paths.py +8 -0
  98. package/runtime/python/okstra_ctl/manager_resume.py +59 -0
  99. package/runtime/python/okstra_ctl/manager_split.py +2 -2
  100. package/runtime/python/okstra_ctl/manager_store.py +116 -17
  101. package/runtime/python/okstra_ctl/manager_sync.py +42 -3
  102. package/runtime/python/okstra_ctl/manager_view.py +35 -2
  103. package/runtime/python/okstra_ctl/material.py +2 -0
  104. package/runtime/python/okstra_ctl/model_cli.py +64 -14
  105. package/runtime/python/okstra_ctl/model_defaults.py +22 -0
  106. package/runtime/python/okstra_ctl/model_io/renderers.py +3 -0
  107. package/runtime/python/okstra_ctl/operation_invocation.py +207 -28
  108. package/runtime/python/okstra_ctl/path_hints.py +14 -3
  109. package/runtime/python/okstra_ctl/paths.py +6 -1
  110. package/runtime/python/okstra_ctl/phases/catalog.py +24 -7
  111. package/runtime/python/okstra_ctl/phases/implementation/host-rules.md +3 -3
  112. package/runtime/python/okstra_ctl/phases/implementation/instructions/_implementation-diff-review.md +8 -6
  113. package/runtime/python/okstra_ctl/phases/implementation/instructions/_implementation-self-check.md +1 -1
  114. package/runtime/python/okstra_ctl/phases/implementation_option_selection/profile.md +1 -1
  115. package/runtime/python/okstra_ctl/phases/implementation_option_selection/votes.py +11 -11
  116. package/runtime/python/okstra_ctl/phases/implementation_planning/authoring.py +12 -9
  117. package/runtime/python/okstra_ctl/phases/implementation_planning/host-rules.md +3 -6
  118. package/runtime/python/okstra_ctl/phases/implementation_planning/instructions/plan-body-verification.md +12 -10
  119. package/runtime/python/okstra_ctl/phases/implementation_planning/profile.md +5 -5
  120. package/runtime/python/okstra_ctl/phases/improvement_discovery/lenses.py +12 -0
  121. package/runtime/python/okstra_ctl/phases/improvement_discovery/profile.md +7 -6
  122. package/runtime/python/okstra_ctl/phases/improvement_discovery/resolved_census.py +159 -0
  123. package/runtime/python/okstra_ctl/phases/improvement_discovery/spec.md +5 -2
  124. package/runtime/python/okstra_ctl/phases/improvement_discovery/validation.py +21 -7
  125. package/runtime/python/okstra_ctl/phases/release_handoff/boundary.json +1 -1
  126. package/runtime/python/okstra_ctl/phases/release_handoff/profile.md +4 -1
  127. package/runtime/python/okstra_ctl/plan_verify_cli.py +6 -4
  128. package/runtime/python/okstra_ctl/render.py +28 -2
  129. package/runtime/python/okstra_ctl/report_assembly.py +38 -11
  130. package/runtime/python/okstra_ctl/report_contract.py +26 -0
  131. package/runtime/python/okstra_ctl/report_corrections.py +36 -20
  132. package/runtime/python/okstra_ctl/report_inputs.py +1 -0
  133. package/runtime/python/okstra_ctl/report_language.py +4 -1
  134. package/runtime/python/okstra_ctl/report_narrative.py +179 -7
  135. package/runtime/python/okstra_ctl/report_projections.py +64 -18
  136. package/runtime/python/okstra_ctl/report_synthesis_packet.py +86 -36
  137. package/runtime/python/okstra_ctl/run.py +43 -35
  138. package/runtime/python/okstra_ctl/run_context.py +10 -1
  139. package/runtime/python/okstra_ctl/set_work_status.py +4 -15
  140. package/runtime/python/okstra_ctl/task_list_cli.py +34 -8
  141. package/runtime/python/okstra_ctl/task_query.py +239 -0
  142. package/runtime/python/okstra_ctl/trace_review.py +264 -0
  143. package/runtime/python/okstra_ctl/trace_tasks.py +197 -0
  144. package/runtime/python/okstra_ctl/user_authorization.py +14 -0
  145. package/runtime/python/okstra_ctl/wizard/confirmation.py +7 -3
  146. package/runtime/python/okstra_ctl/wizard/launch.py +52 -0
  147. package/runtime/python/okstra_ctl/wizard/launch_cli.py +39 -0
  148. package/runtime/python/okstra_ctl/wizard/outcome.py +17 -16
  149. package/runtime/python/okstra_ctl/wizard/registry.py +1 -1
  150. package/runtime/python/okstra_ctl/wizard/render.py +8 -0
  151. package/runtime/python/okstra_ctl/wizard/state.py +2 -1
  152. package/runtime/python/okstra_project/state.py +20 -0
  153. package/runtime/python/okstra_token_usage/blocks.py +74 -0
  154. package/runtime/python/okstra_token_usage/cli.py +23 -10
  155. package/runtime/python/okstra_token_usage/collect.py +25 -22
  156. package/runtime/python/okstra_token_usage/policy.py +193 -0
  157. package/runtime/schemas/report-synthesis-packet-v1.0.schema.json +1 -1
  158. package/runtime/skills/_fragments/wizard-confirm-step.md +1 -1
  159. package/runtime/skills/_fragments/wizard-preflight.md +1 -1
  160. package/runtime/skills/_fragments/wizard-prompt-loop.md +3 -5
  161. package/runtime/skills/_fragments/wizard-relay-protocol.md +1 -1
  162. package/runtime/skills/_fragments/wizard-render-bundle.md +15 -29
  163. package/runtime/skills/okstra-brief-gen/SKILL.md +7 -7
  164. package/runtime/skills/okstra-brief-gen/references/tracker-recursion.md +1 -1
  165. package/runtime/skills/okstra-code-review/SKILL.md +58 -50
  166. package/runtime/skills/okstra-code-review/references/census-rules.md +6 -6
  167. package/runtime/skills/okstra-code-review/references/review-calibration.md +8 -12
  168. package/runtime/skills/okstra-discussion/SKILL.md +22 -38
  169. package/runtime/skills/okstra-explain-flow/SKILL.md +6 -2
  170. package/runtime/skills/okstra-manager/SKILL.md +24 -0
  171. package/runtime/skills/okstra-memory/SKILL.md +1 -1
  172. package/runtime/skills/okstra-pr-gen/SKILL.md +1 -1
  173. package/runtime/skills/okstra-run/SKILL.md +55 -183
  174. package/runtime/skills/okstra-schedule-gen/SKILL.md +9 -13
  175. package/runtime/skills/okstra-setup/SKILL.md +3 -2
  176. package/runtime/skills/okstra-setup/references/project-config.md +2 -4
  177. package/runtime/skills/okstra-tdd/SKILL.md +187 -0
  178. package/runtime/skills/okstra-user-response/SKILL.md +4 -2
  179. package/runtime/templates/manager/view.template.html +4 -0
  180. package/runtime/templates/report-writer-prompt-preamble.md +15 -3
  181. package/runtime/templates/trace/trace.template.md +42 -0
  182. package/runtime/validators/checks/fixtures-02.py +25 -33
  183. package/runtime/validators/validate-run.py +93 -36
@@ -25,6 +25,8 @@ for _ssot_dir in (_VALIDATORS_DIR.parent / "scripts", _VALIDATORS_DIR.parent / "
25
25
  if _ssot_dir.is_dir() and str(_ssot_dir) not in sys.path:
26
26
  sys.path.insert(0, str(_ssot_dir))
27
27
 
28
+ from okstra_token_usage.policy import usage_accounting_policy, usage_diagnostics
29
+
28
30
  try:
29
31
  from okstra_ctl.final_report_schema import (
30
32
  SchemaError,
@@ -3093,7 +3095,24 @@ def validate_worker_results_audit(
3093
3095
  (advisories if advisories is not None else failures).extend(ledger)
3094
3096
 
3095
3097
 
3096
- def validate_team_state_usage(team_state: dict, failures: list[str]) -> None:
3098
+ def validate_team_state_usage(
3099
+ team_state: dict, failures: list[str], *,
3100
+ run_manifest: Mapping[str, Any] | None = None, advisories: list[str] | None = None,
3101
+ ) -> None:
3102
+ try:
3103
+ policy = usage_accounting_policy(run_manifest if run_manifest is not None else team_state)
3104
+ except ValueError as exc:
3105
+ failures.append(str(exc))
3106
+ return
3107
+ if policy == "advisory":
3108
+ errors, missing = usage_diagnostics(team_state)
3109
+ failures.extend(errors)
3110
+ if advisories is not None:
3111
+ advisories.extend(
3112
+ f"Token usage unavailable for {row['item']}: {row['risk']}"
3113
+ for row in missing
3114
+ )
3115
+ return
3097
3116
  if _session_accounting(team_state) == "artifact-only":
3098
3117
  return
3099
3118
  summary = team_state.get("usageSummary") or {}
@@ -5533,12 +5552,17 @@ def _import_token_usage():
5533
5552
  return collect, populate_token_cells
5534
5553
 
5535
5554
 
5536
- def _needs_token_autofix(team_state: dict, report_path: Path) -> bool:
5537
- if _session_accounting(team_state) == "artifact-only":
5555
+ def _needs_token_autofix(
5556
+ team_state: dict, report_path: Path, run_manifest: Mapping[str, Any] | None = None,
5557
+ ) -> bool:
5558
+ policy = usage_accounting_policy(run_manifest if run_manifest is not None else team_state)
5559
+ if policy == "strict" and _session_accounting(team_state) == "artifact-only":
5538
5560
  return False
5539
5561
  summary = team_state.get("usageSummary") or {}
5540
5562
  if not summary or not summary.get("collectedAt"):
5541
5563
  return True
5564
+ if policy == "advisory":
5565
+ return False
5542
5566
  if report_path.is_file():
5543
5567
  content = report_path.read_text()
5544
5568
  if any(p in content for p in TOKEN_PLACEHOLDERS):
@@ -5563,7 +5587,7 @@ def _needs_token_autofix(team_state: dict, report_path: Path) -> bool:
5563
5587
 
5564
5588
 
5565
5589
  def _accuracy_failures(updated: dict) -> list[str]:
5566
- """Return human-readable reasons the collected usage is incomplete.
5590
+ """Return strict-policy failures for incomplete collected usage.
5567
5591
 
5568
5592
  Goal: never let zero-valued usage be silently written or substituted into
5569
5593
  the final report. If a session jsonl is missing, the operator must know
@@ -5602,6 +5626,7 @@ def attempt_token_usage_autofix(
5602
5626
  team_state_path: Path,
5603
5627
  report_path: Path,
5604
5628
  project_root: Path,
5629
+ *, run_manifest: Mapping[str, Any] | None = None,
5605
5630
  ) -> tuple[str, list[str]]:
5606
5631
  """Run the Phase 7 token-usage collector in-process when artifacts indicate
5607
5632
  Phase 7 was skipped.
@@ -5609,43 +5634,51 @@ def attempt_token_usage_autofix(
5609
5634
  Returns ``(state, messages)`` where ``state`` is one of:
5610
5635
 
5611
5636
  - ``"skipped"`` — opt-out or autofix not needed; messages is empty.
5612
- - ``"recovered"`` — collector ran AND every session that should have a
5613
- jsonl was found; team-state is rewritten and the final report's token
5614
- placeholders are substituted with real values. messages carries a
5615
- single info line.
5616
- - ``"accuracy-failed"`` — collector ran but at least one expected
5617
- session is missing. Nothing is written to disk; messages contains the
5618
- contract violations the validator must surface so the operator can
5619
- re-collect accurately rather than ship a report containing zeros.
5620
- - ``"import-failed"`` / ``"collector-error"`` — autofix could not run;
5621
- caller falls back to the original contract failures.
5637
+ - ``"recovered"`` — collector ran and team-state was rewritten. Strict
5638
+ runs also substitute the report; advisory runs preserve published data
5639
+ and views. Messages describe recovery; final validation reports absence.
5640
+ - ``"accuracy-failed"`` — malformed accounting, or missing sessions under
5641
+ strict policy, prevented persistence. messages contains the violations.
5642
+ - ``"import-failed"`` / ``"collector-error"`` — autofix could not run.
5643
+ Advisory runs keep these blocking; strict runs retain the original
5644
+ contract checks after reporting the skipped recovery.
5622
5645
  """
5623
5646
  if os.environ.get("OKSTRA_VALIDATE_NO_AUTOFIX") == "1":
5624
5647
  return "skipped", []
5625
- if not _needs_token_autofix(team_state, report_path):
5648
+ try:
5649
+ policy = usage_accounting_policy(run_manifest if run_manifest is not None else team_state)
5650
+ except ValueError as exc:
5651
+ return "accuracy-failed", [str(exc)]
5652
+ if not _needs_token_autofix(team_state, report_path, run_manifest):
5626
5653
  return "skipped", []
5627
5654
  try:
5628
5655
  collect, populate_token_cells = _import_token_usage()
5629
5656
  except Exception as exc: # noqa: BLE001
5630
5657
  return "import-failed", [f"okstra_token_usage import failed: {exc}"]
5631
5658
  try:
5632
- updated = collect(team_state_path, project_root)
5659
+ updated = collect(team_state_path, project_root, manifest=run_manifest)
5633
5660
  except Exception as exc: # noqa: BLE001
5634
5661
  return "collector-error", [f"token-usage collector raised: {exc}"]
5635
5662
 
5636
- accuracy_problems = _accuracy_failures(updated)
5663
+ accuracy_problems = (
5664
+ usage_diagnostics(updated)[0]
5665
+ if policy == "advisory"
5666
+ else _accuracy_failures(updated)
5667
+ )
5637
5668
  if accuracy_problems:
5638
- # Refuse to persist zeroed usage. Surface specific reasons so the
5639
- # operator can locate the missing session(s) instead of silently
5640
- # shipping a report with `0` token counts.
5669
+ # Invalid accounting is never persisted. Strict runs also refuse
5670
+ # incomplete session measurements; advisory absence is checked later.
5641
5671
  return "accuracy-failed", [
5642
- f"Phase 7 token-usage auto-recovery refused to write incomplete data: {reason}"
5672
+ f"Phase 7 token-usage auto-recovery refused invalid or incomplete accounting: {reason}"
5643
5673
  for reason in accuracy_problems
5644
5674
  ]
5645
5675
 
5646
5676
  team_state_path.write_text(
5647
5677
  json.dumps(updated, indent=2, ensure_ascii=False) + "\n"
5648
5678
  )
5679
+ if policy == "advisory":
5680
+ message = "usageSummary recollected in team-state; published report data and HTML were preserved."
5681
+ return "recovered", [message]
5649
5682
  data_path = _data_path_for(report_path)
5650
5683
  try:
5651
5684
  replaced = populate_token_cells(data_path, updated)
@@ -5789,16 +5822,14 @@ def run_plan_body_section(
5789
5822
  return 0 if not failures else 2
5790
5823
 
5791
5824
 
5792
- def run_plan_body_inputs(narrative_path: Path, state_path: Path) -> int:
5825
+ def run_plan_body_inputs(
5826
+ narrative_path: Path, state_path: Path, *, run_manifest_path: Path | None = None,
5827
+ ) -> int:
5793
5828
  """게시 전 서사와 수렴 소유 상태에서 같은 계획 게이트를 채점한다."""
5794
- from okstra_ctl.report_narrative import parse_narrative
5795
- from okstra_ctl.final_report_schema import load_schema_version
5829
+ from okstra_ctl.report_narrative import load_writer_input
5796
5830
 
5797
5831
  try:
5798
- narrative = parse_narrative(
5799
- narrative_path.read_text(encoding="utf-8"),
5800
- load_schema_version("3.0"),
5801
- )
5832
+ narrative = load_writer_input(narrative_path, run_manifest=run_manifest_path)
5802
5833
  state = json.loads(state_path.read_text(encoding="utf-8"))
5803
5834
  except (OSError, UnicodeError, ValueError) as exc:
5804
5835
  print(f"validate-run: plan-body inputs are invalid ({exc})", file=sys.stderr)
@@ -5983,7 +6014,8 @@ def main() -> int:
5983
6014
  if args.section == SECTION_PLAN_BODY:
5984
6015
  if args.narrative and args.state and not args.report:
5985
6016
  return run_plan_body_inputs(
5986
- Path(args.narrative).resolve(), Path(args.state).resolve()
6017
+ Path(args.narrative).absolute(), Path(args.state).resolve(),
6018
+ run_manifest_path=Path(args.run_manifest).absolute() if args.run_manifest else None,
5987
6019
  )
5988
6020
  if args.report and not args.narrative and not args.state:
5989
6021
  return run_plan_body_section(
@@ -6027,16 +6059,26 @@ def main() -> int:
6027
6059
  report_path = resolve_input(args.report)
6028
6060
  team_state = load_json(team_state_path)
6029
6061
 
6030
- autofix_state, autofix_messages = attempt_token_usage_autofix(
6031
- team_state, team_state_path, report_path, project_root
6032
- )
6062
+ usage_failures: list[str] = []
6063
+ try:
6064
+ usage_policy = usage_accounting_policy(run_manifest)
6065
+ except ValueError as exc:
6066
+ usage_policy = None
6067
+ usage_failures.append(str(exc))
6068
+ autofix_state, autofix_messages = "skipped", []
6069
+ else:
6070
+ autofix_state, autofix_messages = attempt_token_usage_autofix(
6071
+ team_state, team_state_path, report_path, project_root,
6072
+ run_manifest=run_manifest,
6073
+ )
6033
6074
  if autofix_state == "recovered":
6034
6075
  team_state = load_json(team_state_path)
6035
6076
  for msg in autofix_messages:
6036
6077
  print(f"validate-run: Phase 7 auto-recovery — {msg}", file=sys.stderr)
6037
6078
  elif autofix_state in ("import-failed", "collector-error"):
6079
+ outcome = "failed" if usage_policy == "advisory" else "skipped"
6038
6080
  for msg in autofix_messages:
6039
- print(f"validate-run: Phase 7 auto-recovery skipped — {msg}", file=sys.stderr)
6081
+ print(f"validate-run: Phase 7 auto-recovery {outcome} — {msg}", file=sys.stderr)
6040
6082
 
6041
6083
  failures: list[str] = []
6042
6084
  # Findings that are reported but do not fail the run.
@@ -6050,9 +6092,17 @@ def main() -> int:
6050
6092
  # wrong. Those findings are surfaced and carried in the run manifest
6051
6093
  # instead — currently the worker citation ledger and the PROGRESS narration
6052
6094
  # lines.
6053
- advisories: list[str] = []
6095
+ advisories: list[str] = (
6096
+ list(autofix_messages)
6097
+ if autofix_state == "recovered" and usage_policy == "advisory"
6098
+ else []
6099
+ )
6054
6100
  versioned_session_failures: list[str] = []
6055
- if autofix_state == "accuracy-failed":
6101
+ if usage_policy == "advisory" and autofix_state in {
6102
+ "accuracy-failed", "collector-error", "import-failed",
6103
+ }:
6104
+ usage_failures.extend(autofix_messages)
6105
+ elif autofix_state == "accuracy-failed":
6056
6106
  failures.extend(autofix_messages)
6057
6107
  _validate_execution_identity_v2(run_manifest, failures)
6058
6108
  contract = extract_contract(run_manifest, task_manifest, failures)
@@ -6109,7 +6159,11 @@ def main() -> int:
6109
6159
  report_data=validation_data,
6110
6160
  team_state=team_state,
6111
6161
  )
6112
- validate_team_state_usage(team_state, failures)
6162
+ if usage_policy is not None:
6163
+ validate_team_state_usage(
6164
+ team_state, usage_failures if usage_policy == "advisory" else failures,
6165
+ run_manifest=run_manifest, advisories=advisories,
6166
+ )
6113
6167
 
6114
6168
  if task_type:
6115
6169
  validate_worker_results_audit(report_path, task_type, failures, advisories)
@@ -6258,6 +6312,9 @@ def main() -> int:
6258
6312
  # 근거와 정책: scripts/okstra_ctl/blocking_checks.py
6259
6313
  failures, demoted = partition_blocking(failures)
6260
6314
  advisories.extend(demoted)
6315
+ # Accounting contract errors have explicit policy ownership. They do not
6316
+ # pass through the legacy message-based classification for report checks.
6317
+ failures.extend(dict.fromkeys(usage_failures))
6261
6318
 
6262
6319
  validation_status = "passed" if not failures else "failed"
6263
6320
  update_validation_metadata(