Sync ctx a3fcda3 (part 2)
Browse filesGitHub commit: a3fcda3b083d6c607f1b4e1a818fc77f9ea2ce50
qa/feature_status.csv
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
feature_id,parent_feature_id,source_tracker,surface,feature,entrypoint_or_route,source_evidence,risk_level,user_story,expected_behavior,setup_preconditions,test_command_or_steps,verification_mode,status,evidence,bug_id,bug_summary,bug_repro,fix_status,retest_evidence,last_verified_at,owner_lane,notes,review_status,review_notes,fix_strategy,validation_status
|
| 2 |
MAINT-015,,expert-lane/telemetry-release-governance,Maintainer,No-mistakes Codex launcher,scripts/no_mistakes_codex_env.sh,scripts/no_mistakes_codex_env.sh; src/tests/test_no_mistakes_env.py,High,As a maintainer I can run no-mistakes after the desktop app name or installation path changes,Launcher preserves the trusted project Python environment resolves explicit executable and resource known-app and PATH candidates and validates both explicit overrides independently,POSIX shell and an installed Codex executable,.venv/bin/python -m pytest -q --no-cov src/tests/test_no_mistakes_env.py,Automated Test,Needs Validation,PASS FOCUSED: commit 2f8393f6 validates both explicit overrides independently; 15 focused tests pass and the real launcher resolves codex-cli 0.145.0-alpha.18.,AUDIT-072,The combined explicit executable and missing resource override previously bypassed resource validation.,Set a runnable explicit executable and a missing explicit resource directory then run the wrapper.,Fixed,PASS FOCUSED: the invalid resource override is rejected independently and all launcher discovery regressions pass; final real no-mistakes integration is pending.,2026-07-20,QA/Test Gate Lane,POSIX wrapper tests are intentionally skipped on native Windows while GitHub validates the surrounding CI contract.,Approved locally pending integration gate,Focused regression and real launcher execution prove the fix; the final branch-wide no-mistakes run remains the integration proof.,Ponytail: validate both nonempty explicit overrides before discovery and retain the combined-boundary regression.,Pending the final real no-mistakes run after all benchmark work is committed
|
| 3 |
-
"MAINT-016","","docs/qa/feature-user-story-status.csv","Maintainer","Adaptive ctx development benchmark","scripts/ctx_ab_benchmark.py","scripts/ctx_ab_benchmark.py; scripts/ctx_ab_exposure_ledger.py; scripts/ctx_ab_holdout.py; scripts/ctx_ab_holdout_acquire.py; scripts/ctx_ab_holdout_freeze.py; scripts/ctx_ab_holdout_materialize.py; scripts/ctx_ab_holdout_prepare.py; scripts/ctx_ab_swebench.py; benchmarks/ctx_ab/holdout-protocol-v1.json; benchmarks/ctx_ab/scenarios.yaml; src/tests/test_ctx_ab_benchmark.py; src/tests/test_ctx_ab_exposure_ledger.py; src/tests/test_ctx_ab_holdout_freeze.py; src/tests/test_ctx_ab_holdout_materialize.py; src/tests/test_ctx_ab_holdout_prepare.py; src/tests/test_ctx_ab_holdout_protocol.py; src/tests/test_ctx_ab_holdout_selection.py; src/tests/test_ctx_ab_swebench.py; qa/ctx_benchmark_status.csv","High","As a product owner I can compare the same feature development task with and without production CTX using reproducible quality, token, development-time, lifecycle, failure, and uncertainty evidence.","The confirmatory runner assigns ten hidden tasks from ten repositories to identical baseline and CTX arms, authenticates a frozen 30-pair schedule, evaluates both patches with the same blinded official SWE-bench Docker verifier, records exact provider usage and truthful CTX recommendation/load/use/unload evidence, and publishes no benefit claim unless every quality and evidence gate passes.","macOS Codex authentication, Python 3.12 environment, pinned official SWE-bench runtime and images, cached repositories, execution-frozen owner-only scenarios, and a clean committed head.","Run focused benchmark and holdout tests, authenticate the complete historical exposure inventory, materialize all ten official red/reference controls, freeze V2 before any selected task reaches CTX or a model, execute three paired repetitions per task sequentially with retries disabled, then inspect incidents, hidden evaluator results, exact usage, development time, lifecycle, and repository-clustered effects.","Automated Test plus Blinded Evaluation","Needs Validation","CURRENT CANDIDATE: framework PR #253 merged as 0e9289e4 after all required checks passed, including native Windows 3.12. The exact combined V2 suite passed 505/505 on framework code HEAD 547b80a5; exact-head preflight passed 19/19 on 78a003ac with 6,163 unit tests. Independent runtime, methodology, and CI reviewers returned MERGE. A fresh clean merged-main worktree, isolated Python 3.12.13 environment, and pinned Docker daemon pass dependency and amd64/arm64 conformance. Official evidence remains 0/10 controls, 0/30 pairs, and 0/60 arms.","BENCH-007; BENCH-008; BENCH-010; BENCH-011; BENCH-014; BENCH-021; BENCH-031; BENCH-032; BENCH-033; BENCH-034; BENCH-035; BENCH-036; BENCH-037; BENCH-038; BENCH-039; BENCH-040; BENCH-041; BENCH-042","The authenticated framework, native platform proof, merge, and local runtime conformance are complete; the complete historical exposure inventory, ten controls, 30 paired runs, failure classification, and honest product verdict remain open.","Authenticate every known historical exposure source, then execute all ten controls and 30 pairs sequentially from the clean merged-main worktree, classify every failure, and retain a valid not_beneficial verdict as final.","Framework integration, authenticated snapshots, historical-exposure rejection, source-closure enforcement, one-shot execution, merged-main identity, platform temporary-path rejection, authoritative verdict gates, task-disjoint-or-no-go generation, native Windows CI, and Docker/Python conformance are fixed; production execution remains pending.","CURRENT CANDIDATE 0e9289e4: merged-main identity is clean; required CI and native Windows passed; Python 3.12.13 and Docker amd64/arm64 conformance passed. Production execution remains 0/10 controls, 0/30 pairs, and 0/60 arms.","2026-07-30","QA/Test Gate Lane","Framework evidence proves mechanics and trust boundaries only; it does not prove CTX benefit. The confirmatory result is an intent-to-treat estimate and may honestly be not_beneficial. Any outcome-informed later study requires task-disjoint tasks and may require a new pinned universe.","Methodology, security, runtime-state, source-closure, exposure-ledger, and CI-policy scopes are approved; exposure inventory completeness and live product evidence remain pending.","Do not interpret green framework tests as product benefit. BENCH-034 and BENCH-035 remain open until the official controls and campaign finish; a valid not_beneficial result is final.","Ponytail: retain one evaluator and one frozen paired design; fix only reproduced harness or CTX defects, and require task-disjoint selection or a new pinned universe after outcome-informed changes.","Pending complete exposure inventory, ten controls, 30 pairs, 60 arms, independent result review, and publication of the honest verdict."
|
| 4 |
CLI-001,,docs/qa/feature-user-story-status.csv,CLI,Generic model run harness,ctx; python -m ctx,pyproject.toml project.scripts and src/ctx/__main__.py,High,As a user I can run or resume a model-agnostic ctx session,ctx and python -m ctx expose the same run/resume/sessions harness with configured provider tools secret-safe MCP attachment token budgets transcript ordering privacy-safe failure telemetry and persisted initial trace metadata,Provider credentials or dry-run/local test provider available,ctx --help; python -m ctx --help; focused run/resume smoke,Automated Test,Retested Pass,PASS: test_harness_cli_run.py focused suite reports 73 passed; test_package_scaffold.py covers python -m ctx --help.,AUDIT-018,Early ctx run/resume failures could exit without complete telemetry or trace correlation.,Trigger ctx run/resume early failure paths and inspect telemetry/session metadata.,Fixed,PASS: .venv/bin/pytest src/tests/test_harness_cli_run.py -q --tb=short -> 73 passed.,2026-07-05,CLI Lane,Updated for CLI failure telemetry trace metadata and inline MCP secret rejection.,Reviewed by no-mistakes,no-mistakes run 01KWSCY4EF01EXWSHYB5SGS4BC reached passed after review/test/document/lint/CI; post-merge stats cleanup PR #239 also passed.,Ponytail: telemetry-only hardening plus inline MCP secret rejection; no CLI behavior expansion.,Validated by focused regressions and no-mistakes run 01KWSCY4EF01EXWSHYB5SGS4BC on PR #238; PR merged as 90babdd and post-merge inventory cleanup merged as PR #239.
|
| 5 |
CLI-002,,docs/qa/feature-user-story-status.csv,CLI,Repository recommendation,ctx-recommend,pyproject.toml project.scripts,Medium,As a user I can ask ctx for current repo recommendations,ctx returns capped relevant skill agent MCP recommendations from the shared graph engine,Graph installed and target repo available,ctx-recommend --help then sample repo recommendation,Automated Test,Tested Pass,recommend CLI/golden subset: 24 passed for ctx-recommend and shared recommendation surfaces.,,,,,,2026-06-23,CLI Lane,Validated in focused pytest or isolated temp CLI smoke during A-Z pass.,Reviewed by no-mistakes,Historical tracker import; current canonical row is covered by completed goal-loop review and no-mistakes gate.,Ponytail: no fix needed unless retest produces a concrete regression.,Validated by completed goal-loop and no-mistakes gate
|
| 6 |
CLI-003,,docs/qa/feature-user-story-status.csv,CLI,Initial setup,ctx-init,pyproject.toml project.scripts,Medium,As a new user I can install hooks graph and model mode from one command,ctx-init installs requested pieces idempotently and reports failures with non-zero exit,Writable user config directory,ctx-init --model-mode skip --graph,CLI Smoke,Retested Pass,"PASS: final wheel 1b435d9b installs the runtime graph and actionable pack in a fresh home; independent clean-install and descriptor-pinned filesystem reviews pass.",AUDIT-087; AUDIT-088,"The previous clean-install path could delete unrelated converted wiki content, accept a symlinked ancestor, and expose too little actionable skill, agent, and MCP context.",Install the real runtime archive or wheel into a temporary home containing a private converted skill and a symlinked .claude ancestor; run ctx-init repeatedly and inspect recommendations and install paths.,"Fixed in commits 3b50bfd6, 9dec65c7, and 09d157a1.","PASS: final archive and wheel clean installs, preservation, containment, idempotence, and skill, agent, and MCP actionability smokes pass.",2026-07-27,CLI Lane,The final wheel was imported from its installed site-packages path outside the repository.,Approved by independent clean-install and filesystem reviewers,"No P0-P3 remains in the clean-home, path containment, or artifact actionability boundary.","Preserve user-owned wiki content, reject unsafe ancestors, and ship an attested project-owned context pack.","Validated by independent reviews and final wheel 1b435d9b A-Z smoke"
|
|
|
|
| 1 |
feature_id,parent_feature_id,source_tracker,surface,feature,entrypoint_or_route,source_evidence,risk_level,user_story,expected_behavior,setup_preconditions,test_command_or_steps,verification_mode,status,evidence,bug_id,bug_summary,bug_repro,fix_status,retest_evidence,last_verified_at,owner_lane,notes,review_status,review_notes,fix_strategy,validation_status
|
| 2 |
MAINT-015,,expert-lane/telemetry-release-governance,Maintainer,No-mistakes Codex launcher,scripts/no_mistakes_codex_env.sh,scripts/no_mistakes_codex_env.sh; src/tests/test_no_mistakes_env.py,High,As a maintainer I can run no-mistakes after the desktop app name or installation path changes,Launcher preserves the trusted project Python environment resolves explicit executable and resource known-app and PATH candidates and validates both explicit overrides independently,POSIX shell and an installed Codex executable,.venv/bin/python -m pytest -q --no-cov src/tests/test_no_mistakes_env.py,Automated Test,Needs Validation,PASS FOCUSED: commit 2f8393f6 validates both explicit overrides independently; 15 focused tests pass and the real launcher resolves codex-cli 0.145.0-alpha.18.,AUDIT-072,The combined explicit executable and missing resource override previously bypassed resource validation.,Set a runnable explicit executable and a missing explicit resource directory then run the wrapper.,Fixed,PASS FOCUSED: the invalid resource override is rejected independently and all launcher discovery regressions pass; final real no-mistakes integration is pending.,2026-07-20,QA/Test Gate Lane,POSIX wrapper tests are intentionally skipped on native Windows while GitHub validates the surrounding CI contract.,Approved locally pending integration gate,Focused regression and real launcher execution prove the fix; the final branch-wide no-mistakes run remains the integration proof.,Ponytail: validate both nonempty explicit overrides before discovery and retain the combined-boundary regression.,Pending the final real no-mistakes run after all benchmark work is committed
|
| 3 |
+
"MAINT-016","","docs/qa/feature-user-story-status.csv","Maintainer","Adaptive ctx development benchmark","scripts/ctx_ab_benchmark.py","scripts/ctx_ab_benchmark.py; scripts/ctx_ab_exposure_ledger.py; scripts/ctx_ab_failure_evidence.py; scripts/ctx_ab_holdout.py; scripts/ctx_ab_holdout_acquire.py; scripts/ctx_ab_holdout_freeze.py; scripts/ctx_ab_holdout_materialize.py; scripts/ctx_ab_holdout_prepare.py; scripts/ctx_ab_swebench.py; benchmarks/ctx_ab/holdout-protocol-v1.json; benchmarks/ctx_ab/scenarios.yaml; src/tests/test_ctx_ab_benchmark.py; src/tests/test_ctx_ab_exposure_ledger.py; src/tests/test_ctx_ab_failure_evidence.py; src/tests/test_ctx_ab_holdout_freeze.py; src/tests/test_ctx_ab_holdout_materialize.py; src/tests/test_ctx_ab_holdout_prepare.py; src/tests/test_ctx_ab_holdout_protocol.py; src/tests/test_ctx_ab_holdout_selection.py; src/tests/test_ctx_ab_swebench.py; qa/ctx_benchmark_status.csv","High","As a product owner I can compare the same feature development task with and without production CTX using reproducible quality, token, development-time, lifecycle, failure, and uncertainty evidence.","The confirmatory runner assigns ten hidden tasks from ten repositories to identical baseline and CTX arms, authenticates a frozen 30-pair schedule, evaluates both patches with the same blinded official SWE-bench Docker verifier, records exact provider usage and truthful CTX recommendation/load/use/unload evidence, and publishes no benefit claim unless every quality and evidence gate passes.","macOS Codex authentication, Python 3.12 environment, pinned official SWE-bench runtime and images, cached repositories, execution-frozen owner-only scenarios, and a clean committed head.","Run focused benchmark and holdout tests, authenticate the complete historical exposure inventory, materialize all ten official red/reference controls, freeze V2 before any selected task reaches CTX or a model, execute three paired repetitions per task sequentially with retries disabled, then inspect incidents, hidden evaluator results, exact usage, development time, lifecycle, and repository-clustered effects.","Automated Test plus Blinded Evaluation","Needs Validation","CURRENT CANDIDATE: framework PR #253 merged as 0e9289e4 after all required checks passed, including native Windows 3.12. The exact combined V2 suite passed 505/505 on framework code HEAD 547b80a5; exact-head preflight passed 19/19 on 78a003ac with 6,163 unit tests. Independent runtime, methodology, and CI reviewers returned MERGE. A fresh clean merged-main worktree, isolated Python 3.12.13 environment, and pinned Docker daemon pass dependency and amd64/arm64 conformance. Official evidence remains 0/10 controls, 0/30 pairs, and 0/60 arms.","BENCH-007; BENCH-008; BENCH-010; BENCH-011; BENCH-014; BENCH-021; BENCH-031; BENCH-032; BENCH-033; BENCH-034; BENCH-035; BENCH-036; BENCH-037; BENCH-038; BENCH-039; BENCH-040; BENCH-041; BENCH-042","The authenticated framework, native platform proof, merge, and local runtime conformance are complete; the complete historical exposure inventory, ten controls, 30 paired runs, failure classification, and honest product verdict remain open.","Authenticate every known historical exposure source, then execute all ten controls and 30 pairs sequentially from the clean merged-main worktree, classify every failure, and retain a valid not_beneficial verdict as final.","Framework integration, authenticated snapshots, historical-exposure rejection, source-closure enforcement, one-shot execution, merged-main identity, platform temporary-path rejection, authoritative verdict gates, task-disjoint-or-no-go generation, native Windows CI, and Docker/Python conformance are fixed; production execution remains pending.","CURRENT CANDIDATE 0e9289e4: merged-main identity is clean; required CI and native Windows passed; Python 3.12.13 and Docker amd64/arm64 conformance passed. Production execution remains 0/10 controls, 0/30 pairs, and 0/60 arms.","2026-07-30","QA/Test Gate Lane","Framework evidence proves mechanics and trust boundaries only; it does not prove CTX benefit. The confirmatory result is an intent-to-treat estimate and may honestly be not_beneficial. Any outcome-informed later study requires task-disjoint tasks and may require a new pinned universe.","Methodology, security, runtime-state, source-closure, exposure-ledger, and CI-policy scopes are approved; exposure inventory completeness and live product evidence remain pending.","Do not interpret green framework tests as product benefit. BENCH-034 and BENCH-035 remain open until the official controls and campaign finish; a valid not_beneficial result is final.","Ponytail: retain one evaluator and one frozen paired design; fix only reproduced harness or CTX defects, and require task-disjoint selection or a new pinned universe after outcome-informed changes.","Pending complete exposure inventory, ten controls, 30 pairs, 60 arms, independent result review, and publication of the honest verdict."
|
| 4 |
CLI-001,,docs/qa/feature-user-story-status.csv,CLI,Generic model run harness,ctx; python -m ctx,pyproject.toml project.scripts and src/ctx/__main__.py,High,As a user I can run or resume a model-agnostic ctx session,ctx and python -m ctx expose the same run/resume/sessions harness with configured provider tools secret-safe MCP attachment token budgets transcript ordering privacy-safe failure telemetry and persisted initial trace metadata,Provider credentials or dry-run/local test provider available,ctx --help; python -m ctx --help; focused run/resume smoke,Automated Test,Retested Pass,PASS: test_harness_cli_run.py focused suite reports 73 passed; test_package_scaffold.py covers python -m ctx --help.,AUDIT-018,Early ctx run/resume failures could exit without complete telemetry or trace correlation.,Trigger ctx run/resume early failure paths and inspect telemetry/session metadata.,Fixed,PASS: .venv/bin/pytest src/tests/test_harness_cli_run.py -q --tb=short -> 73 passed.,2026-07-05,CLI Lane,Updated for CLI failure telemetry trace metadata and inline MCP secret rejection.,Reviewed by no-mistakes,no-mistakes run 01KWSCY4EF01EXWSHYB5SGS4BC reached passed after review/test/document/lint/CI; post-merge stats cleanup PR #239 also passed.,Ponytail: telemetry-only hardening plus inline MCP secret rejection; no CLI behavior expansion.,Validated by focused regressions and no-mistakes run 01KWSCY4EF01EXWSHYB5SGS4BC on PR #238; PR merged as 90babdd and post-merge inventory cleanup merged as PR #239.
|
| 5 |
CLI-002,,docs/qa/feature-user-story-status.csv,CLI,Repository recommendation,ctx-recommend,pyproject.toml project.scripts,Medium,As a user I can ask ctx for current repo recommendations,ctx returns capped relevant skill agent MCP recommendations from the shared graph engine,Graph installed and target repo available,ctx-recommend --help then sample repo recommendation,Automated Test,Tested Pass,recommend CLI/golden subset: 24 passed for ctx-recommend and shared recommendation surfaces.,,,,,,2026-06-23,CLI Lane,Validated in focused pytest or isolated temp CLI smoke during A-Z pass.,Reviewed by no-mistakes,Historical tracker import; current canonical row is covered by completed goal-loop review and no-mistakes gate.,Ponytail: no fix needed unless retest produces a concrete regression.,Validated by completed goal-loop and no-mistakes gate
|
| 6 |
CLI-003,,docs/qa/feature-user-story-status.csv,CLI,Initial setup,ctx-init,pyproject.toml project.scripts,Medium,As a new user I can install hooks graph and model mode from one command,ctx-init installs requested pieces idempotently and reports failures with non-zero exit,Writable user config directory,ctx-init --model-mode skip --graph,CLI Smoke,Retested Pass,"PASS: final wheel 1b435d9b installs the runtime graph and actionable pack in a fresh home; independent clean-install and descriptor-pinned filesystem reviews pass.",AUDIT-087; AUDIT-088,"The previous clean-install path could delete unrelated converted wiki content, accept a symlinked ancestor, and expose too little actionable skill, agent, and MCP context.",Install the real runtime archive or wheel into a temporary home containing a private converted skill and a symlinked .claude ancestor; run ctx-init repeatedly and inspect recommendations and install paths.,"Fixed in commits 3b50bfd6, 9dec65c7, and 09d157a1.","PASS: final archive and wheel clean installs, preservation, containment, idempotence, and skill, agent, and MCP actionability smokes pass.",2026-07-27,CLI Lane,The final wheel was imported from its installed site-packages path outside the repository.,Approved by independent clean-install and filesystem reviewers,"No P0-P3 remains in the clean-home, path containment, or artifact actionability boundary.","Preserve user-owned wiki content, reject unsafe ancestors, and ship an attested project-owned context pack.","Validated by independent reviews and final wheel 1b435d9b A-Z smoke"
|
scripts/ctx_ab_failure_evidence.py
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Atomically preserve owner-only private evidence for CTX A/B failures."""
|
| 3 |
+
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import hashlib
|
| 7 |
+
import json
|
| 8 |
+
import os
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
import stat
|
| 11 |
+
import tempfile
|
| 12 |
+
import traceback
|
| 13 |
+
from typing import Any
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
FAILURE_GUARD = "ctx-ab-private-failure-v1"
|
| 17 |
+
FAILURE_MANIFEST = "artifact-manifest.json"
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class FailureEvidenceError(RuntimeError):
|
| 21 |
+
"""Private failure evidence could not be published safely."""
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def _canonical_bytes(value: Any) -> bytes:
|
| 25 |
+
return json.dumps(value, sort_keys=True, separators=(",", ":"), ensure_ascii=False).encode()
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def _sha256(data: bytes) -> str:
|
| 29 |
+
return hashlib.sha256(data).hexdigest()
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def _private_write(path: Path, data: bytes) -> None:
|
| 33 |
+
descriptor = os.open(
|
| 34 |
+
path,
|
| 35 |
+
os.O_WRONLY | os.O_CREAT | os.O_EXCL | getattr(os, "O_NOFOLLOW", 0),
|
| 36 |
+
0o600,
|
| 37 |
+
)
|
| 38 |
+
with os.fdopen(descriptor, "wb") as handle:
|
| 39 |
+
handle.write(data)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def _exception_chain(exc: BaseException) -> list[dict[str, str]]:
|
| 43 |
+
chain: list[dict[str, str]] = []
|
| 44 |
+
current: BaseException | None = exc
|
| 45 |
+
seen: set[int] = set()
|
| 46 |
+
while current is not None and id(current) not in seen:
|
| 47 |
+
seen.add(id(current))
|
| 48 |
+
chain.append({"message": str(current), "type": type(current).__name__})
|
| 49 |
+
current = current.__cause__ or (
|
| 50 |
+
None if current.__suppress_context__ else current.__context__
|
| 51 |
+
)
|
| 52 |
+
return chain
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def _harden_private_tree(root: Path) -> None:
|
| 56 |
+
os.chmod(root, 0o700)
|
| 57 |
+
for path in root.rglob("*"):
|
| 58 |
+
metadata = path.lstat()
|
| 59 |
+
if stat.S_ISLNK(metadata.st_mode):
|
| 60 |
+
continue
|
| 61 |
+
if stat.S_ISDIR(metadata.st_mode):
|
| 62 |
+
os.chmod(path, 0o700)
|
| 63 |
+
elif stat.S_ISREG(metadata.st_mode):
|
| 64 |
+
os.chmod(path, 0o700 if metadata.st_mode & 0o111 else 0o600)
|
| 65 |
+
else:
|
| 66 |
+
raise FailureEvidenceError("private failure evidence contains a special file")
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def _artifact_manifest(root: Path) -> dict[str, Any]:
|
| 70 |
+
entries: list[dict[str, Any]] = []
|
| 71 |
+
for path in sorted(root.rglob("*"), key=lambda item: item.relative_to(root).as_posix()):
|
| 72 |
+
relative = path.relative_to(root).as_posix()
|
| 73 |
+
if relative == FAILURE_MANIFEST:
|
| 74 |
+
continue
|
| 75 |
+
metadata = path.lstat()
|
| 76 |
+
record: dict[str, Any] = {
|
| 77 |
+
"mode": stat.S_IMODE(metadata.st_mode),
|
| 78 |
+
"path": relative,
|
| 79 |
+
}
|
| 80 |
+
if stat.S_ISDIR(metadata.st_mode):
|
| 81 |
+
record["type"] = "directory"
|
| 82 |
+
elif stat.S_ISREG(metadata.st_mode):
|
| 83 |
+
data = path.read_bytes()
|
| 84 |
+
record.update(
|
| 85 |
+
{
|
| 86 |
+
"bytes": len(data),
|
| 87 |
+
"sha256": _sha256(data),
|
| 88 |
+
"type": "file",
|
| 89 |
+
}
|
| 90 |
+
)
|
| 91 |
+
elif stat.S_ISLNK(metadata.st_mode):
|
| 92 |
+
record.update(
|
| 93 |
+
{
|
| 94 |
+
"sha256": _sha256(os.fsencode(os.readlink(path))),
|
| 95 |
+
"type": "symlink",
|
| 96 |
+
}
|
| 97 |
+
)
|
| 98 |
+
else:
|
| 99 |
+
raise FailureEvidenceError("private failure evidence contains a special file")
|
| 100 |
+
entries.append(record)
|
| 101 |
+
return {
|
| 102 |
+
"entries": entries,
|
| 103 |
+
"entry_count": len(entries),
|
| 104 |
+
"guard": FAILURE_GUARD,
|
| 105 |
+
"manifest_sha256": _sha256(_canonical_bytes(entries)),
|
| 106 |
+
"schema_version": 1,
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
def validate_destination(destination: Path, *, repository_root: Path) -> None:
|
| 111 |
+
if not destination.is_absolute():
|
| 112 |
+
raise FailureEvidenceError("failure evidence destination must be absolute")
|
| 113 |
+
resolved = destination.resolve(strict=False)
|
| 114 |
+
private_root = (repository_root / ".gate" / "ctx-ab-private").resolve()
|
| 115 |
+
if repository_root.resolve() in resolved.parents and private_root not in resolved.parents:
|
| 116 |
+
raise FailureEvidenceError(
|
| 117 |
+
"failure evidence inside the repository must use the private root"
|
| 118 |
+
)
|
| 119 |
+
destination.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
|
| 120 |
+
if destination.exists() or destination.is_symlink():
|
| 121 |
+
raise FailureEvidenceError("failure evidence destination already exists")
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
def publish_failure(
|
| 125 |
+
*,
|
| 126 |
+
destination: Path,
|
| 127 |
+
operation: str,
|
| 128 |
+
exc: BaseException,
|
| 129 |
+
repository_root: Path,
|
| 130 |
+
staging: Path | None = None,
|
| 131 |
+
) -> dict[str, Any]:
|
| 132 |
+
"""Publish a private immutable exception bundle, optionally with staged raw evidence."""
|
| 133 |
+
|
| 134 |
+
validate_destination(destination, repository_root=repository_root)
|
| 135 |
+
owns_staging = staging is None
|
| 136 |
+
if staging is None:
|
| 137 |
+
staging = Path(tempfile.mkdtemp(prefix=".ctx-ab-failure-", dir=destination.parent))
|
| 138 |
+
os.chmod(staging, 0o700)
|
| 139 |
+
elif staging.is_symlink() or not staging.is_dir():
|
| 140 |
+
raise FailureEvidenceError("failure evidence staging root is unsafe")
|
| 141 |
+
|
| 142 |
+
failure = {
|
| 143 |
+
"exception_chain": _exception_chain(exc),
|
| 144 |
+
"guard": FAILURE_GUARD,
|
| 145 |
+
"operation": operation,
|
| 146 |
+
"schema_version": 1,
|
| 147 |
+
"traceback": "".join(traceback.format_exception(exc)),
|
| 148 |
+
}
|
| 149 |
+
try:
|
| 150 |
+
_harden_private_tree(staging)
|
| 151 |
+
_private_write(staging / "failure.json", _canonical_bytes(failure))
|
| 152 |
+
manifest = _artifact_manifest(staging)
|
| 153 |
+
_private_write(staging / FAILURE_MANIFEST, _canonical_bytes(manifest))
|
| 154 |
+
staging.rename(destination)
|
| 155 |
+
except BaseException:
|
| 156 |
+
# Never delete a partially captured failure. A hidden owner-only staging
|
| 157 |
+
# directory is safer than destroying the only root-cause evidence.
|
| 158 |
+
if owns_staging and staging.exists():
|
| 159 |
+
os.chmod(staging, 0o700)
|
| 160 |
+
raise
|
| 161 |
+
return manifest
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
def already_preserved(destination: Path) -> bool:
|
| 165 |
+
return (
|
| 166 |
+
destination.is_dir()
|
| 167 |
+
and not destination.is_symlink()
|
| 168 |
+
and (destination / "failure.json").is_file()
|
| 169 |
+
and (destination / FAILURE_MANIFEST).is_file()
|
| 170 |
+
)
|
scripts/ctx_ab_holdout_freeze.py
CHANGED
|
@@ -21,6 +21,7 @@ from typing import Any
|
|
| 21 |
|
| 22 |
from scripts import ctx_ab_benchmark as benchmark
|
| 23 |
from scripts import ctx_ab_exposure_ledger as exposure_ledger
|
|
|
|
| 24 |
from scripts import ctx_ab_holdout as holdout
|
| 25 |
|
| 26 |
|
|
@@ -1520,6 +1521,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 1520 |
parser.add_argument("--environment", type=Path, required=True)
|
| 1521 |
parser.add_argument("--schedule", type=Path, required=True)
|
| 1522 |
parser.add_argument("--output", type=Path, required=True)
|
|
|
|
| 1523 |
parser.add_argument(
|
| 1524 |
"--expected-acquisition-protocol-sha256",
|
| 1525 |
required=True,
|
|
@@ -1529,6 +1531,13 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 1529 |
default=datetime.now(UTC).isoformat().replace("+00:00", "Z"),
|
| 1530 |
)
|
| 1531 |
args = parser.parse_args(argv)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1532 |
try:
|
| 1533 |
hashes = freeze_protocol(
|
| 1534 |
protocol_path=args.protocol,
|
|
@@ -1545,8 +1554,21 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 1545 |
frozen_at=args.frozen_at,
|
| 1546 |
expected_acquisition_protocol_sha256=args.expected_acquisition_protocol_sha256,
|
| 1547 |
)
|
| 1548 |
-
except
|
| 1549 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1550 |
print(
|
| 1551 |
"execution-frozen "
|
| 1552 |
+ " ".join(
|
|
|
|
| 21 |
|
| 22 |
from scripts import ctx_ab_benchmark as benchmark
|
| 23 |
from scripts import ctx_ab_exposure_ledger as exposure_ledger
|
| 24 |
+
from scripts import ctx_ab_failure_evidence as failure_evidence
|
| 25 |
from scripts import ctx_ab_holdout as holdout
|
| 26 |
|
| 27 |
|
|
|
|
| 1521 |
parser.add_argument("--environment", type=Path, required=True)
|
| 1522 |
parser.add_argument("--schedule", type=Path, required=True)
|
| 1523 |
parser.add_argument("--output", type=Path, required=True)
|
| 1524 |
+
parser.add_argument("--failure-evidence-output", type=Path, required=True)
|
| 1525 |
parser.add_argument(
|
| 1526 |
"--expected-acquisition-protocol-sha256",
|
| 1527 |
required=True,
|
|
|
|
| 1531 |
default=datetime.now(UTC).isoformat().replace("+00:00", "Z"),
|
| 1532 |
)
|
| 1533 |
args = parser.parse_args(argv)
|
| 1534 |
+
try:
|
| 1535 |
+
failure_evidence.validate_destination(
|
| 1536 |
+
args.failure_evidence_output,
|
| 1537 |
+
repository_root=ROOT,
|
| 1538 |
+
)
|
| 1539 |
+
except failure_evidence.FailureEvidenceError:
|
| 1540 |
+
parser.exit(2, "execution freeze precondition failed; evidence=unavailable\n")
|
| 1541 |
try:
|
| 1542 |
hashes = freeze_protocol(
|
| 1543 |
protocol_path=args.protocol,
|
|
|
|
| 1554 |
frozen_at=args.frozen_at,
|
| 1555 |
expected_acquisition_protocol_sha256=args.expected_acquisition_protocol_sha256,
|
| 1556 |
)
|
| 1557 |
+
except BaseException as exc:
|
| 1558 |
+
try:
|
| 1559 |
+
failure_evidence.publish_failure(
|
| 1560 |
+
destination=args.failure_evidence_output,
|
| 1561 |
+
operation="holdout-execution-freeze",
|
| 1562 |
+
exc=exc,
|
| 1563 |
+
repository_root=ROOT,
|
| 1564 |
+
)
|
| 1565 |
+
evidence_status = "preserved"
|
| 1566 |
+
except BaseException:
|
| 1567 |
+
evidence_status = "unavailable"
|
| 1568 |
+
parser.exit(
|
| 1569 |
+
2,
|
| 1570 |
+
f"execution freeze failed ({type(exc).__name__}); evidence={evidence_status}\n",
|
| 1571 |
+
)
|
| 1572 |
print(
|
| 1573 |
"execution-frozen "
|
| 1574 |
+ " ".join(
|
scripts/ctx_ab_holdout_materialize.py
CHANGED
|
@@ -27,6 +27,7 @@ if str(ROOT) not in sys.path:
|
|
| 27 |
|
| 28 |
from scripts import ctx_ab_benchmark as benchmark # noqa: E402
|
| 29 |
from scripts import ctx_ab_exposure_ledger as exposure_ledger # noqa: E402
|
|
|
|
| 30 |
from scripts import ctx_ab_holdout as holdout # noqa: E402
|
| 31 |
from scripts import ctx_ab_holdout_freeze as freezer # noqa: E402
|
| 32 |
from scripts import ctx_ab_swebench as swebench # noqa: E402
|
|
@@ -776,8 +777,26 @@ def _write_artifacts(
|
|
| 776 |
raise MaterializationError("private artifact permissions are unsafe")
|
| 777 |
retained_evidence.rename(temp / VERIFICATION_DIR)
|
| 778 |
temp.rename(output)
|
| 779 |
-
except
|
| 780 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 781 |
raise
|
| 782 |
|
| 783 |
|
|
@@ -792,6 +811,7 @@ def materialize(
|
|
| 792 |
runtime_availability_path: Path,
|
| 793 |
catalog_archive_path: Path,
|
| 794 |
output: Path,
|
|
|
|
| 795 |
swebench_checkout: Path,
|
| 796 |
swebench_python: Path,
|
| 797 |
docker_cli: Path,
|
|
@@ -812,6 +832,7 @@ def materialize(
|
|
| 812 |
"runtime availability": runtime_availability_path,
|
| 813 |
"catalog archive": catalog_archive_path,
|
| 814 |
"output": output,
|
|
|
|
| 815 |
}
|
| 816 |
)
|
| 817 |
except freezer.FreezeError as exc:
|
|
@@ -890,6 +911,13 @@ def materialize(
|
|
| 890 |
)
|
| 891 |
_validate_runtime(runtime)
|
| 892 |
_validate_output_destination(output)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 893 |
|
| 894 |
scenario_rows: list[dict[str, Any]] = []
|
| 895 |
scenarios: list[benchmark.Scenario] = []
|
|
@@ -897,9 +925,11 @@ def materialize(
|
|
| 897 |
reconstructed: dict[str, str] = {}
|
| 898 |
retained_evidence = Path(tempfile.mkdtemp(prefix=".official-verification-", dir=output.parent))
|
| 899 |
os.chmod(retained_evidence, 0o700)
|
|
|
|
| 900 |
try:
|
| 901 |
-
|
| 902 |
-
|
|
|
|
| 903 |
source_preflight_deadline = time.monotonic() + float(timeout)
|
| 904 |
for source_bundle in sources.values():
|
| 905 |
_validate_source_bundle_heads(
|
|
@@ -925,6 +955,17 @@ def materialize(
|
|
| 925 |
scenarios.append(scenario)
|
| 926 |
controls[scenario_id] = control
|
| 927 |
reconstructed[scenario_id] = reconstructed_source
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 928 |
|
| 929 |
scenario_pack_bytes = _canonical_bytes({"scenarios": scenario_rows, "version": 1})
|
| 930 |
scenario_pack_sha256 = _sha256(scenario_pack_bytes)
|
|
@@ -970,8 +1011,18 @@ def materialize(
|
|
| 970 |
retained_evidence=retained_evidence,
|
| 971 |
)
|
| 972 |
return {key: _sha256(value) for key, value in artifacts.items()}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 973 |
finally:
|
| 974 |
-
if retained_evidence.exists():
|
| 975 |
shutil.rmtree(retained_evidence, ignore_errors=True)
|
| 976 |
|
| 977 |
|
|
@@ -986,11 +1037,19 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 986 |
parser.add_argument("--runtime-availability", type=Path, required=True)
|
| 987 |
parser.add_argument("--catalog-archive", type=Path, required=True)
|
| 988 |
parser.add_argument("--output", type=Path, required=True)
|
|
|
|
| 989 |
parser.add_argument("--swebench-checkout", type=Path, required=True)
|
| 990 |
parser.add_argument("--swebench-python", type=Path, required=True)
|
| 991 |
parser.add_argument("--docker-cli", type=Path, required=True)
|
| 992 |
parser.add_argument("--docker-host", required=True)
|
| 993 |
args = parser.parse_args(argv)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 994 |
try:
|
| 995 |
hashes = materialize(
|
| 996 |
protocol_path=args.protocol,
|
|
@@ -1002,6 +1061,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 1002 |
runtime_availability_path=args.runtime_availability,
|
| 1003 |
catalog_archive_path=args.catalog_archive,
|
| 1004 |
output=args.output,
|
|
|
|
| 1005 |
swebench_checkout=args.swebench_checkout,
|
| 1006 |
swebench_python=args.swebench_python,
|
| 1007 |
docker_cli=args.docker_cli,
|
|
@@ -1009,9 +1069,22 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 1009 |
)
|
| 1010 |
controls = _load_json(args.output / OUTPUT_FILES["controls"])
|
| 1011 |
scenario_count = controls["scenario_count"]
|
| 1012 |
-
except
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1013 |
parser.exit(
|
| 1014 |
-
2,
|
|
|
|
|
|
|
| 1015 |
)
|
| 1016 |
print(
|
| 1017 |
f"materialized {scenario_count} private scenarios; "
|
|
|
|
| 27 |
|
| 28 |
from scripts import ctx_ab_benchmark as benchmark # noqa: E402
|
| 29 |
from scripts import ctx_ab_exposure_ledger as exposure_ledger # noqa: E402
|
| 30 |
+
from scripts import ctx_ab_failure_evidence as failure_evidence # noqa: E402
|
| 31 |
from scripts import ctx_ab_holdout as holdout # noqa: E402
|
| 32 |
from scripts import ctx_ab_holdout_freeze as freezer # noqa: E402
|
| 33 |
from scripts import ctx_ab_swebench as swebench # noqa: E402
|
|
|
|
| 777 |
raise MaterializationError("private artifact permissions are unsafe")
|
| 778 |
retained_evidence.rename(temp / VERIFICATION_DIR)
|
| 779 |
temp.rename(output)
|
| 780 |
+
except BaseException as exc:
|
| 781 |
+
cleanup_temp = True
|
| 782 |
+
published_verification = temp / VERIFICATION_DIR
|
| 783 |
+
if published_verification.exists() and not retained_evidence.exists():
|
| 784 |
+
try:
|
| 785 |
+
published_verification.rename(retained_evidence)
|
| 786 |
+
except BaseException as rollback_exc:
|
| 787 |
+
try:
|
| 788 |
+
temp.rename(retained_evidence)
|
| 789 |
+
except BaseException as fallback_exc:
|
| 790 |
+
cleanup_temp = False
|
| 791 |
+
exc.add_note(
|
| 792 |
+
"materialization rollback failed; staged evidence retained at "
|
| 793 |
+
f"{temp} ({type(rollback_exc).__name__}, "
|
| 794 |
+
f"{type(fallback_exc).__name__})"
|
| 795 |
+
)
|
| 796 |
+
else:
|
| 797 |
+
temp = retained_evidence / ".published-output-staging"
|
| 798 |
+
if cleanup_temp and temp.exists():
|
| 799 |
+
shutil.rmtree(temp, ignore_errors=True)
|
| 800 |
raise
|
| 801 |
|
| 802 |
|
|
|
|
| 811 |
runtime_availability_path: Path,
|
| 812 |
catalog_archive_path: Path,
|
| 813 |
output: Path,
|
| 814 |
+
failure_evidence_output: Path,
|
| 815 |
swebench_checkout: Path,
|
| 816 |
swebench_python: Path,
|
| 817 |
docker_cli: Path,
|
|
|
|
| 832 |
"runtime availability": runtime_availability_path,
|
| 833 |
"catalog archive": catalog_archive_path,
|
| 834 |
"output": output,
|
| 835 |
+
"failure evidence output": failure_evidence_output,
|
| 836 |
}
|
| 837 |
)
|
| 838 |
except freezer.FreezeError as exc:
|
|
|
|
| 911 |
)
|
| 912 |
_validate_runtime(runtime)
|
| 913 |
_validate_output_destination(output)
|
| 914 |
+
try:
|
| 915 |
+
failure_evidence.validate_destination(
|
| 916 |
+
failure_evidence_output,
|
| 917 |
+
repository_root=ROOT,
|
| 918 |
+
)
|
| 919 |
+
except failure_evidence.FailureEvidenceError as exc:
|
| 920 |
+
raise MaterializationError("private failure evidence destination is invalid") from exc
|
| 921 |
|
| 922 |
scenario_rows: list[dict[str, Any]] = []
|
| 923 |
scenarios: list[benchmark.Scenario] = []
|
|
|
|
| 925 |
reconstructed: dict[str, str] = {}
|
| 926 |
retained_evidence = Path(tempfile.mkdtemp(prefix=".official-verification-", dir=output.parent))
|
| 927 |
os.chmod(retained_evidence, 0o700)
|
| 928 |
+
preserve_retained_evidence = False
|
| 929 |
try:
|
| 930 |
+
work_root = Path(tempfile.mkdtemp(prefix=".ctx-holdout-materialize-", dir=output.parent))
|
| 931 |
+
os.chmod(work_root, 0o700)
|
| 932 |
+
try:
|
| 933 |
source_preflight_deadline = time.monotonic() + float(timeout)
|
| 934 |
for source_bundle in sources.values():
|
| 935 |
_validate_source_bundle_heads(
|
|
|
|
| 955 |
scenarios.append(scenario)
|
| 956 |
controls[scenario_id] = control
|
| 957 |
reconstructed[scenario_id] = reconstructed_source
|
| 958 |
+
except BaseException as exc:
|
| 959 |
+
try:
|
| 960 |
+
work_root.rename(retained_evidence / "raw-control-work")
|
| 961 |
+
except BaseException as capture_exc:
|
| 962 |
+
exc.add_note(
|
| 963 |
+
"raw control worktree publication failed; "
|
| 964 |
+
f"staging retained at {work_root} ({type(capture_exc).__name__})"
|
| 965 |
+
)
|
| 966 |
+
raise
|
| 967 |
+
else:
|
| 968 |
+
shutil.rmtree(work_root)
|
| 969 |
|
| 970 |
scenario_pack_bytes = _canonical_bytes({"scenarios": scenario_rows, "version": 1})
|
| 971 |
scenario_pack_sha256 = _sha256(scenario_pack_bytes)
|
|
|
|
| 1011 |
retained_evidence=retained_evidence,
|
| 1012 |
)
|
| 1013 |
return {key: _sha256(value) for key, value in artifacts.items()}
|
| 1014 |
+
except BaseException as exc:
|
| 1015 |
+
preserve_retained_evidence = True
|
| 1016 |
+
failure_evidence.publish_failure(
|
| 1017 |
+
staging=retained_evidence,
|
| 1018 |
+
destination=failure_evidence_output,
|
| 1019 |
+
operation="holdout-materialization",
|
| 1020 |
+
exc=exc,
|
| 1021 |
+
repository_root=ROOT,
|
| 1022 |
+
)
|
| 1023 |
+
raise
|
| 1024 |
finally:
|
| 1025 |
+
if retained_evidence.exists() and not preserve_retained_evidence:
|
| 1026 |
shutil.rmtree(retained_evidence, ignore_errors=True)
|
| 1027 |
|
| 1028 |
|
|
|
|
| 1037 |
parser.add_argument("--runtime-availability", type=Path, required=True)
|
| 1038 |
parser.add_argument("--catalog-archive", type=Path, required=True)
|
| 1039 |
parser.add_argument("--output", type=Path, required=True)
|
| 1040 |
+
parser.add_argument("--failure-evidence-output", type=Path, required=True)
|
| 1041 |
parser.add_argument("--swebench-checkout", type=Path, required=True)
|
| 1042 |
parser.add_argument("--swebench-python", type=Path, required=True)
|
| 1043 |
parser.add_argument("--docker-cli", type=Path, required=True)
|
| 1044 |
parser.add_argument("--docker-host", required=True)
|
| 1045 |
args = parser.parse_args(argv)
|
| 1046 |
+
try:
|
| 1047 |
+
failure_evidence.validate_destination(
|
| 1048 |
+
args.failure_evidence_output,
|
| 1049 |
+
repository_root=ROOT,
|
| 1050 |
+
)
|
| 1051 |
+
except failure_evidence.FailureEvidenceError:
|
| 1052 |
+
parser.exit(2, "materialization precondition failed; evidence=unavailable\n")
|
| 1053 |
try:
|
| 1054 |
hashes = materialize(
|
| 1055 |
protocol_path=args.protocol,
|
|
|
|
| 1061 |
runtime_availability_path=args.runtime_availability,
|
| 1062 |
catalog_archive_path=args.catalog_archive,
|
| 1063 |
output=args.output,
|
| 1064 |
+
failure_evidence_output=args.failure_evidence_output,
|
| 1065 |
swebench_checkout=args.swebench_checkout,
|
| 1066 |
swebench_python=args.swebench_python,
|
| 1067 |
docker_cli=args.docker_cli,
|
|
|
|
| 1069 |
)
|
| 1070 |
controls = _load_json(args.output / OUTPUT_FILES["controls"])
|
| 1071 |
scenario_count = controls["scenario_count"]
|
| 1072 |
+
except BaseException as exc:
|
| 1073 |
+
evidence_status = "preserved"
|
| 1074 |
+
if not failure_evidence.already_preserved(args.failure_evidence_output):
|
| 1075 |
+
try:
|
| 1076 |
+
failure_evidence.publish_failure(
|
| 1077 |
+
destination=args.failure_evidence_output,
|
| 1078 |
+
operation="holdout-materialization",
|
| 1079 |
+
exc=exc,
|
| 1080 |
+
repository_root=ROOT,
|
| 1081 |
+
)
|
| 1082 |
+
except BaseException:
|
| 1083 |
+
evidence_status = "unavailable"
|
| 1084 |
parser.exit(
|
| 1085 |
+
2,
|
| 1086 |
+
"materialization failed; private details suppressed "
|
| 1087 |
+
f"({type(exc).__name__}); evidence={evidence_status}\n",
|
| 1088 |
)
|
| 1089 |
print(
|
| 1090 |
f"materialized {scenario_count} private scenarios; "
|
scripts/ctx_ab_holdout_prepare.py
CHANGED
|
@@ -29,6 +29,7 @@ if str(ROOT) not in sys.path:
|
|
| 29 |
sys.path.insert(0, str(ROOT))
|
| 30 |
|
| 31 |
from scripts import ctx_ab_benchmark as benchmark # noqa: E402
|
|
|
|
| 32 |
from scripts import ctx_ab_holdout as holdout # noqa: E402
|
| 33 |
from scripts import ctx_ab_holdout_freeze as freezer # noqa: E402
|
| 34 |
from scripts import ctx_ab_swebench as swebench # noqa: E402
|
|
@@ -1673,6 +1674,10 @@ def _add_verifier_arguments(parser: argparse.ArgumentParser) -> None:
|
|
| 1673 |
parser.add_argument("--docker-host", required=True)
|
| 1674 |
|
| 1675 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1676 |
def main(argv: list[str] | None = None) -> int:
|
| 1677 |
parser = argparse.ArgumentParser(description=__doc__)
|
| 1678 |
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
@@ -1684,6 +1689,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 1684 |
protocol_parser.add_argument("--exposure-ledger", type=Path, required=True)
|
| 1685 |
protocol_parser.add_argument("--frozen-at", default=_default_timestamp())
|
| 1686 |
_add_verifier_arguments(protocol_parser)
|
|
|
|
| 1687 |
|
| 1688 |
sources_parser = subparsers.add_parser("sources")
|
| 1689 |
sources_parser.add_argument("--protocol", type=Path, required=True)
|
|
@@ -1694,6 +1700,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 1694 |
sources_parser.add_argument("--cache-root", type=Path, required=True)
|
| 1695 |
sources_parser.add_argument("--output", type=Path, required=True)
|
| 1696 |
sources_parser.add_argument("--workers", type=int, choices=range(1, 9), default=4)
|
|
|
|
| 1697 |
|
| 1698 |
environment_parser = subparsers.add_parser("environment")
|
| 1699 |
environment_parser.add_argument("--protocol", type=Path, required=True)
|
|
@@ -1715,8 +1722,16 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 1715 |
environment_parser.add_argument("--codex", type=Path, required=True)
|
| 1716 |
environment_parser.add_argument("--python", type=Path, default=Path(sys.executable))
|
| 1717 |
_add_verifier_arguments(environment_parser)
|
|
|
|
| 1718 |
|
| 1719 |
args = parser.parse_args(argv)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1720 |
try:
|
| 1721 |
if args.command == "protocol":
|
| 1722 |
digest = create_protocol(
|
|
@@ -1764,8 +1779,21 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 1764 |
docker_host=args.docker_host,
|
| 1765 |
)
|
| 1766 |
print(f"prepared execution environment sha256={digest}")
|
| 1767 |
-
except
|
| 1768 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1769 |
return 0
|
| 1770 |
|
| 1771 |
|
|
|
|
| 29 |
sys.path.insert(0, str(ROOT))
|
| 30 |
|
| 31 |
from scripts import ctx_ab_benchmark as benchmark # noqa: E402
|
| 32 |
+
from scripts import ctx_ab_failure_evidence as failure_evidence # noqa: E402
|
| 33 |
from scripts import ctx_ab_holdout as holdout # noqa: E402
|
| 34 |
from scripts import ctx_ab_holdout_freeze as freezer # noqa: E402
|
| 35 |
from scripts import ctx_ab_swebench as swebench # noqa: E402
|
|
|
|
| 1674 |
parser.add_argument("--docker-host", required=True)
|
| 1675 |
|
| 1676 |
|
| 1677 |
+
def _add_failure_evidence_argument(parser: argparse.ArgumentParser) -> None:
|
| 1678 |
+
parser.add_argument("--failure-evidence-output", type=Path, required=True)
|
| 1679 |
+
|
| 1680 |
+
|
| 1681 |
def main(argv: list[str] | None = None) -> int:
|
| 1682 |
parser = argparse.ArgumentParser(description=__doc__)
|
| 1683 |
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
|
|
| 1689 |
protocol_parser.add_argument("--exposure-ledger", type=Path, required=True)
|
| 1690 |
protocol_parser.add_argument("--frozen-at", default=_default_timestamp())
|
| 1691 |
_add_verifier_arguments(protocol_parser)
|
| 1692 |
+
_add_failure_evidence_argument(protocol_parser)
|
| 1693 |
|
| 1694 |
sources_parser = subparsers.add_parser("sources")
|
| 1695 |
sources_parser.add_argument("--protocol", type=Path, required=True)
|
|
|
|
| 1700 |
sources_parser.add_argument("--cache-root", type=Path, required=True)
|
| 1701 |
sources_parser.add_argument("--output", type=Path, required=True)
|
| 1702 |
sources_parser.add_argument("--workers", type=int, choices=range(1, 9), default=4)
|
| 1703 |
+
_add_failure_evidence_argument(sources_parser)
|
| 1704 |
|
| 1705 |
environment_parser = subparsers.add_parser("environment")
|
| 1706 |
environment_parser.add_argument("--protocol", type=Path, required=True)
|
|
|
|
| 1722 |
environment_parser.add_argument("--codex", type=Path, required=True)
|
| 1723 |
environment_parser.add_argument("--python", type=Path, default=Path(sys.executable))
|
| 1724 |
_add_verifier_arguments(environment_parser)
|
| 1725 |
+
_add_failure_evidence_argument(environment_parser)
|
| 1726 |
|
| 1727 |
args = parser.parse_args(argv)
|
| 1728 |
+
try:
|
| 1729 |
+
failure_evidence.validate_destination(
|
| 1730 |
+
args.failure_evidence_output,
|
| 1731 |
+
repository_root=ROOT,
|
| 1732 |
+
)
|
| 1733 |
+
except failure_evidence.FailureEvidenceError:
|
| 1734 |
+
parser.exit(2, "benchmark preparation precondition failed; evidence=unavailable\n")
|
| 1735 |
try:
|
| 1736 |
if args.command == "protocol":
|
| 1737 |
digest = create_protocol(
|
|
|
|
| 1779 |
docker_host=args.docker_host,
|
| 1780 |
)
|
| 1781 |
print(f"prepared execution environment sha256={digest}")
|
| 1782 |
+
except BaseException as exc:
|
| 1783 |
+
try:
|
| 1784 |
+
failure_evidence.publish_failure(
|
| 1785 |
+
destination=args.failure_evidence_output,
|
| 1786 |
+
operation=f"holdout-prepare-{args.command}",
|
| 1787 |
+
exc=exc,
|
| 1788 |
+
repository_root=ROOT,
|
| 1789 |
+
)
|
| 1790 |
+
evidence_status = "preserved"
|
| 1791 |
+
except BaseException:
|
| 1792 |
+
evidence_status = "unavailable"
|
| 1793 |
+
parser.exit(
|
| 1794 |
+
2,
|
| 1795 |
+
f"benchmark preparation failed ({type(exc).__name__}); evidence={evidence_status}\n",
|
| 1796 |
+
)
|
| 1797 |
return 0
|
| 1798 |
|
| 1799 |
|