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.
- package/README.md +19 -283
- package/dist/cli-registry.mjs +8 -1
- package/dist/cli-registry.mjs.map +1 -1
- package/dist/commands/execute/render-bundle.d.mts +6 -1
- package/dist/commands/execute/render-bundle.mjs +139 -32
- package/dist/commands/execute/render-bundle.mjs.map +1 -1
- package/dist/commands/lifecycle/config.mjs +6 -74
- package/dist/commands/lifecycle/config.mjs.map +1 -1
- package/dist/commands/trace/capacity.d.mts +12 -0
- package/dist/commands/trace/capacity.mjs +21 -0
- package/dist/commands/trace/capacity.mjs.map +1 -0
- package/dist/commands/trace/model.d.mts +89 -0
- package/dist/commands/trace/model.mjs +251 -0
- package/dist/commands/trace/model.mjs.map +1 -0
- package/dist/commands/trace/progression.d.mts +11 -0
- package/dist/commands/trace/progression.mjs +194 -0
- package/dist/commands/trace/progression.mjs.map +1 -0
- package/dist/commands/trace/review.d.mts +7 -0
- package/dist/commands/trace/review.mjs +51 -0
- package/dist/commands/trace/review.mjs.map +1 -0
- package/dist/commands/trace/task-link.d.mts +18 -0
- package/dist/commands/trace/task-link.mjs +72 -0
- package/dist/commands/trace/task-link.mjs.map +1 -0
- package/dist/commands/trace/trace.d.mts +1 -0
- package/dist/commands/trace/trace.mjs +293 -0
- package/dist/commands/trace/trace.mjs.map +1 -0
- package/dist/lib/bounded-file.d.mts +1 -0
- package/dist/lib/bounded-file.mjs +36 -0
- package/dist/lib/bounded-file.mjs.map +1 -0
- package/dist/lib/config-store.d.mts +34 -0
- package/dist/lib/config-store.mjs +70 -0
- package/dist/lib/config-store.mjs.map +1 -0
- package/dist/lib/file-lock.mjs +4 -5
- package/dist/lib/file-lock.mjs.map +1 -1
- package/dist/lib/input-limit.d.mts +4 -0
- package/dist/lib/input-limit.mjs +8 -0
- package/dist/lib/input-limit.mjs.map +1 -0
- package/dist/lib/memory-auto-register.mjs +2 -17
- package/dist/lib/memory-auto-register.mjs.map +1 -1
- package/dist/lib/report-language-tag.d.mts +1 -0
- package/dist/lib/report-language-tag.mjs +4 -0
- package/dist/lib/report-language-tag.mjs.map +1 -0
- package/dist/lib/report-language.d.mts +1 -0
- package/dist/lib/report-language.mjs +50 -0
- package/dist/lib/report-language.mjs.map +1 -0
- package/dist/lib/skill-catalog.mjs +3 -0
- package/dist/lib/skill-catalog.mjs.map +1 -1
- package/docs/architecture/storage-model.md +36 -5
- package/docs/architecture.md +10 -4
- package/docs/cli.md +279 -2
- package/docs/contributor-change-matrix.md +1 -2
- package/docs/project-structure-overview.md +31 -41
- package/package.json +1 -1
- package/runtime/BUILD.json +2 -2
- package/runtime/agents/operations/trace-interface-review.json +6 -0
- package/runtime/agents/operations/trace-scope-review.json +6 -0
- package/runtime/prompts/coding-preflight/authoring-checks.md +1 -1
- package/runtime/prompts/coding-preflight/clean-code.md +18 -20
- package/runtime/prompts/coding-preflight/overview.md +1 -1
- package/runtime/prompts/duties/code-reviewer.json +1 -1
- package/runtime/prompts/duties/interface-reviewer.json +32 -0
- package/runtime/prompts/host-orchestration/README.md +18 -9
- package/runtime/prompts/launch.template.md +3 -2
- package/runtime/prompts/lead/context-loader.md +2 -0
- package/runtime/prompts/lead/okstra-lead-contract.md +7 -7
- package/runtime/prompts/lead/report-writer.md +6 -6
- package/runtime/prompts/profiles/_coding-conventions-preflight.md +2 -2
- package/runtime/prompts/profiles/_common-contract.md +1 -1
- package/runtime/python/okstra_ctl/agent/invocation.py +1 -0
- package/runtime/python/okstra_ctl/agent/prompt_cli/cli.py +66 -26
- package/runtime/python/okstra_ctl/agent/prompt_cli/corrections.py +23 -8
- package/runtime/python/okstra_ctl/agent/prompt_cli/materialize.py +28 -10
- package/runtime/python/okstra_ctl/agent/prompt_cli/results.py +8 -11
- package/runtime/python/okstra_ctl/agent/standalone.py +12 -0
- package/runtime/python/okstra_ctl/analysis_packet.py +22 -11
- package/runtime/python/okstra_ctl/code_review_census.py +93 -2
- package/runtime/python/okstra_ctl/code_review_prepare.py +381 -0
- package/runtime/python/okstra_ctl/code_review_run.py +384 -0
- package/runtime/python/okstra_ctl/code_review_scope.py +13 -0
- package/runtime/python/okstra_ctl/code_review_supervisor.py +41 -0
- package/runtime/python/okstra_ctl/code_review_target.py +140 -15
- package/runtime/python/okstra_ctl/coverage_census.py +11 -2
- package/runtime/python/okstra_ctl/design_snapshot.py +16 -9
- package/runtime/python/okstra_ctl/direct_work.py +45 -3
- package/runtime/python/okstra_ctl/dispatch_core.py +31 -15
- package/runtime/python/okstra_ctl/dispatch_state.py +9 -2
- package/runtime/python/okstra_ctl/domain/role.py +1 -0
- package/runtime/python/okstra_ctl/doyouknow/sources/manager.py +48 -9
- package/runtime/python/okstra_ctl/final_report_schema.py +37 -34
- package/runtime/python/okstra_ctl/incremental_carry.py +6 -7
- package/runtime/python/okstra_ctl/initial_prompt_materialization.py +9 -2
- package/runtime/python/okstra_ctl/json_boundary.py +33 -6
- package/runtime/python/okstra_ctl/manager_cli.py +122 -1
- package/runtime/python/okstra_ctl/manager_journal.py +126 -0
- package/runtime/python/okstra_ctl/manager_launch.py +3 -3
- package/runtime/python/okstra_ctl/manager_log.py +221 -0
- package/runtime/python/okstra_ctl/manager_paths.py +8 -0
- package/runtime/python/okstra_ctl/manager_resume.py +59 -0
- package/runtime/python/okstra_ctl/manager_split.py +2 -2
- package/runtime/python/okstra_ctl/manager_store.py +116 -17
- package/runtime/python/okstra_ctl/manager_sync.py +42 -3
- package/runtime/python/okstra_ctl/manager_view.py +35 -2
- package/runtime/python/okstra_ctl/material.py +2 -0
- package/runtime/python/okstra_ctl/model_cli.py +64 -14
- package/runtime/python/okstra_ctl/model_defaults.py +22 -0
- package/runtime/python/okstra_ctl/model_io/renderers.py +3 -0
- package/runtime/python/okstra_ctl/operation_invocation.py +207 -28
- package/runtime/python/okstra_ctl/path_hints.py +14 -3
- package/runtime/python/okstra_ctl/paths.py +6 -1
- package/runtime/python/okstra_ctl/phases/catalog.py +24 -7
- package/runtime/python/okstra_ctl/phases/implementation/host-rules.md +3 -3
- package/runtime/python/okstra_ctl/phases/implementation/instructions/_implementation-diff-review.md +8 -6
- package/runtime/python/okstra_ctl/phases/implementation/instructions/_implementation-self-check.md +1 -1
- package/runtime/python/okstra_ctl/phases/implementation_option_selection/profile.md +1 -1
- package/runtime/python/okstra_ctl/phases/implementation_option_selection/votes.py +11 -11
- package/runtime/python/okstra_ctl/phases/implementation_planning/authoring.py +12 -9
- package/runtime/python/okstra_ctl/phases/implementation_planning/host-rules.md +3 -6
- package/runtime/python/okstra_ctl/phases/implementation_planning/instructions/plan-body-verification.md +12 -10
- package/runtime/python/okstra_ctl/phases/implementation_planning/profile.md +5 -5
- package/runtime/python/okstra_ctl/phases/improvement_discovery/lenses.py +12 -0
- package/runtime/python/okstra_ctl/phases/improvement_discovery/profile.md +7 -6
- package/runtime/python/okstra_ctl/phases/improvement_discovery/resolved_census.py +159 -0
- package/runtime/python/okstra_ctl/phases/improvement_discovery/spec.md +5 -2
- package/runtime/python/okstra_ctl/phases/improvement_discovery/validation.py +21 -7
- package/runtime/python/okstra_ctl/phases/release_handoff/boundary.json +1 -1
- package/runtime/python/okstra_ctl/phases/release_handoff/profile.md +4 -1
- package/runtime/python/okstra_ctl/plan_verify_cli.py +6 -4
- package/runtime/python/okstra_ctl/render.py +28 -2
- package/runtime/python/okstra_ctl/report_assembly.py +38 -11
- package/runtime/python/okstra_ctl/report_contract.py +26 -0
- package/runtime/python/okstra_ctl/report_corrections.py +36 -20
- package/runtime/python/okstra_ctl/report_inputs.py +1 -0
- package/runtime/python/okstra_ctl/report_language.py +4 -1
- package/runtime/python/okstra_ctl/report_narrative.py +179 -7
- package/runtime/python/okstra_ctl/report_projections.py +64 -18
- package/runtime/python/okstra_ctl/report_synthesis_packet.py +86 -36
- package/runtime/python/okstra_ctl/run.py +43 -35
- package/runtime/python/okstra_ctl/run_context.py +10 -1
- package/runtime/python/okstra_ctl/set_work_status.py +4 -15
- package/runtime/python/okstra_ctl/task_list_cli.py +34 -8
- package/runtime/python/okstra_ctl/task_query.py +239 -0
- package/runtime/python/okstra_ctl/trace_review.py +264 -0
- package/runtime/python/okstra_ctl/trace_tasks.py +197 -0
- package/runtime/python/okstra_ctl/user_authorization.py +14 -0
- package/runtime/python/okstra_ctl/wizard/confirmation.py +7 -3
- package/runtime/python/okstra_ctl/wizard/launch.py +52 -0
- package/runtime/python/okstra_ctl/wizard/launch_cli.py +39 -0
- package/runtime/python/okstra_ctl/wizard/outcome.py +17 -16
- package/runtime/python/okstra_ctl/wizard/registry.py +1 -1
- package/runtime/python/okstra_ctl/wizard/render.py +8 -0
- package/runtime/python/okstra_ctl/wizard/state.py +2 -1
- package/runtime/python/okstra_project/state.py +20 -0
- package/runtime/python/okstra_token_usage/blocks.py +74 -0
- package/runtime/python/okstra_token_usage/cli.py +23 -10
- package/runtime/python/okstra_token_usage/collect.py +25 -22
- package/runtime/python/okstra_token_usage/policy.py +193 -0
- package/runtime/schemas/report-synthesis-packet-v1.0.schema.json +1 -1
- package/runtime/skills/_fragments/wizard-confirm-step.md +1 -1
- package/runtime/skills/_fragments/wizard-preflight.md +1 -1
- package/runtime/skills/_fragments/wizard-prompt-loop.md +3 -5
- package/runtime/skills/_fragments/wizard-relay-protocol.md +1 -1
- package/runtime/skills/_fragments/wizard-render-bundle.md +15 -29
- package/runtime/skills/okstra-brief-gen/SKILL.md +7 -7
- package/runtime/skills/okstra-brief-gen/references/tracker-recursion.md +1 -1
- package/runtime/skills/okstra-code-review/SKILL.md +58 -50
- package/runtime/skills/okstra-code-review/references/census-rules.md +6 -6
- package/runtime/skills/okstra-code-review/references/review-calibration.md +8 -12
- package/runtime/skills/okstra-discussion/SKILL.md +22 -38
- package/runtime/skills/okstra-explain-flow/SKILL.md +6 -2
- package/runtime/skills/okstra-manager/SKILL.md +24 -0
- package/runtime/skills/okstra-memory/SKILL.md +1 -1
- package/runtime/skills/okstra-pr-gen/SKILL.md +1 -1
- package/runtime/skills/okstra-run/SKILL.md +55 -183
- package/runtime/skills/okstra-schedule-gen/SKILL.md +9 -13
- package/runtime/skills/okstra-setup/SKILL.md +3 -2
- package/runtime/skills/okstra-setup/references/project-config.md +2 -4
- package/runtime/skills/okstra-tdd/SKILL.md +187 -0
- package/runtime/skills/okstra-user-response/SKILL.md +4 -2
- package/runtime/templates/manager/view.template.html +4 -0
- package/runtime/templates/report-writer-prompt-preamble.md +15 -3
- package/runtime/templates/trace/trace.template.md +42 -0
- package/runtime/validators/checks/fixtures-02.py +25 -33
- 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(
|
|
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(
|
|
5537
|
-
|
|
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
|
|
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
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
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
|
-
|
|
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 =
|
|
5663
|
+
accuracy_problems = (
|
|
5664
|
+
usage_diagnostics(updated)[0]
|
|
5665
|
+
if policy == "advisory"
|
|
5666
|
+
else _accuracy_failures(updated)
|
|
5667
|
+
)
|
|
5637
5668
|
if accuracy_problems:
|
|
5638
|
-
#
|
|
5639
|
-
#
|
|
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
|
|
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(
|
|
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
|
|
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 =
|
|
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).
|
|
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
|
-
|
|
6031
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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(
|