Sync ctx eea3f60 (part 2)
Browse filesGitHub commit: eea3f60109fad1541eef0ec95b811f7025d8a79f
- pyproject.toml +10 -0
- qa/bug_smoke_status.csv +1 -1
- qa/ctx_benchmark_status.csv +6 -5
- qa/feature_status.csv +10 -10
- scripts/ci_classifier.py +0 -17
- scripts/ci_preflight.py +2 -2
- scripts/ci_required.py +1 -10
- scripts/clean_host_contract.py +1 -13
- scripts/ctx_ab_benchmark.py +525 -140
- scripts/ctx_ab_exposure_ledger.py +4 -6
- scripts/ctx_ab_holdout.py +3 -5
- scripts/ctx_ab_holdout_acquire.py +3 -5
- scripts/ctx_ab_holdout_freeze.py +4 -14
- scripts/ctx_ab_holdout_materialize.py +3 -11
- scripts/ctx_ab_holdout_prepare.py +5 -15
- scripts/ctx_ab_swebench.py +12 -437
- src/backup_mirror.py +5 -6
- src/backup_watchdog.py +2 -2
- src/corpus_cache.py +2 -3
- src/ctx/adapters/claude_code/inject_hooks.py +3 -9
- src/ctx/adapters/claude_code/install/mcp_install.py +4 -20
- src/ctx/adapters/generic/tools/mcp_router.py +4 -42
- src/ctx/cli/run.py +1 -10
- src/ctx/core/graph/semantic_edges.py +2 -7
- src/ctx/core/graph/vector_index.py +3 -3
- src/ctx/monitor/pages/harness.py +2 -2
pyproject.toml
CHANGED
|
@@ -10,6 +10,16 @@ authors = [{ name = "Steve Solun" }]
|
|
| 10 |
license = "MIT"
|
| 11 |
readme = "README.md"
|
| 12 |
requires-python = ">=3.11"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
dependencies = [
|
| 15 |
"markdown>=3.6,<4",
|
|
|
|
| 10 |
license = "MIT"
|
| 11 |
readme = "README.md"
|
| 12 |
requires-python = ">=3.11"
|
| 13 |
+
classifiers = [
|
| 14 |
+
"Operating System :: MacOS",
|
| 15 |
+
"Operating System :: POSIX",
|
| 16 |
+
"Operating System :: POSIX :: Linux",
|
| 17 |
+
"Programming Language :: Python :: 3",
|
| 18 |
+
"Programming Language :: Python :: 3.11",
|
| 19 |
+
"Programming Language :: Python :: 3.12",
|
| 20 |
+
"Programming Language :: Python :: 3.13",
|
| 21 |
+
"Programming Language :: Python :: Implementation :: CPython",
|
| 22 |
+
]
|
| 23 |
|
| 24 |
dependencies = [
|
| 25 |
"markdown>=3.6,<4",
|
qa/bug_smoke_status.csv
CHANGED
|
@@ -6,7 +6,7 @@ AUDIT-075,CLI Contract,Tag backfill,discovery root option,src/ctx/core/quality/t
|
|
| 6 |
AUDIT-076,Authorization,Generic adaptive runtime,model-visible lifecycle consent,src/ctx/adapters/generic/ctx_core_tools.py; src/ctx/adapters/generic/runtime_lifecycle.py,"Commits fc4cf0b9 and ddbbb111 make model lifecycle calls advisory, reject manufactured applied authority, and preserve trusted host-owned activation paths.",Critical,Only a host-issued session and content-bound activation grant may authorize runtime context; a model recommendation or lifecycle call must not claim user consent.,adversarial authority-default review,Retested Pass,2026-07-20,A model with the full ctx surface could manufacture an event that appeared to be an explicitly selected user load.,"Call ctx__load_entity with missing or manufactured selection authority and inspect requested versus applied events.",Keep model-published lifecycle tools advisory and accept applied transitions only from the trusted host path.,Fixed,.venv/bin/python -m pytest -q --no-cov src/tests/test_harness_ctx_core.py,PASS: the 434-test focused runtime checkpoint rejects model-manufactured applied authority while preserving trusted host-applied transitions.,2026-07-25,Runtime/API/MCP Lane,Approved by independent runtime and privacy reviewers,The authority boundary is host-owned and model lifecycle calls remain observable advisory requests.,Closed; retain the adversarial authority regression in the focused and full gates.
|
| 7 |
AUDIT-077,Context Integrity,Generic adaptive runtime,durable wiki body and ineffective unload,src/ctx/adapters/generic/ctx_core_tools.py; src/ctx/adapters/generic/loop.py; src/ctx/adapters/generic/runtime_lifecycle.py,"Commits 9cbe248c and 33d5353f cap wiki bodies, expose raw wiki call/result context for one subsequent provider request, and strip it from persistence and replay.",Critical,Skill or agent text must be scan-and-hash matched size bounded marked untrusted attached only to a provider-request copy and physically absent after unload.,adversarial prompt-lifetime review,Retested Pass,2026-07-20,Untrusted raw catalog instructions and their token cost could survive in provider history after their useful turn.,Call wiki_get for a long or malicious entity then persist replay and inspect subsequent provider messages.,Use a bounded one-turn provider-copy lease and remove raw wiki tool context at persistence and replay boundaries.,Fixed,.venv/bin/python -m pytest -q --no-cov src/tests/test_harness_loop.py src/tests/test_harness_state.py,"PASS: focused loop/state regressions in the 434-test runtime checkpoint prove one-turn raw context, persistence/replay stripping, compaction safety, and fail-before-side-effect ID validation.",2026-07-25,Runtime/API/MCP Lane,Approved by independent runtime reviewer,The raw tool-context lifetime defect is closed; model-authored quotations remain a documented residual risk rather than raw tool state.,Closed; retain lifetime persistence replay and reused-ID adversarial regressions.
|
| 8 |
AUDIT-078,Authorization,MCP runtime,advertised-schema dispatch boundary,src/ctx/adapters/generic/tools/mcp_router.py; src/ctx/adapters/generic/loop.py,Commit 51c845d2 requires every dispatch to match the active published tool registry before RPC; focused boundary tests cover hidden and unpublished calls.,Critical,Every MCP call must match the exact active published tool registry and immutable capability epoch used for the provider response before any RPC occurs.,hidden-tool and stale-capability review,Retested Pass,2026-07-20,A model or caller can invoke a server tool that was not advertised in the current provider capability set.,Start a server with multiple tools expose a subset then call an omitted qualified tool directly through McpRouter.call.,Publish exact active registries per epoch and require expected epoch server activity and exact tool membership atomically at dispatch.,Fixed,.venv/bin/python -m pytest -q --no-cov src/tests/test_mcp_router.py src/tests/test_harness_loop.py,PASS: the published-tool boundary slice reported 74 passing tests and independent review approved the exact dispatch guard.,2026-07-25,Runtime/API/MCP Lane,Approved by independent MCP reviewer,Hidden and policy-filtered tools are rejected at the router boundary before any server RPC.,Closed; retain hidden-tool and stale-capability regressions.
|
| 9 |
-
AUDIT-079,Efficiency,MCP runtime,eager startup schemas and unverifiable cleanup,src/ctx/adapters/generic/tools/mcp_router.py; src/ctx/cli/run.py,"Lazy selective MCP activation, schema revocation, process-
|
| 10 |
AUDIT-080,Telemetry,Evaluator runtime,complete session token accounting,src/ctx/adapters/generic/evaluator.py; src/ctx/cli/run.py,"Commits 43fda102 and 0708979d propagate cumulative planner, contract, generator, evaluator, and bounded-agent usage to budgets, session history, CLI JSON, and telemetry.",High,CLI JSON telemetry and budgets must account for every planner contract generator evaluator and delegated-agent model call without inventing per-tool attribution.,usage data-flow review,Retested Pass,2026-07-20,Evaluator-enabled sessions underreport the tokens and cost of the development process and can present misleading efficiency KPIs.,Run ctx run with planner contract and evaluator then compare emitted usage with EvaluationLoopResult.total_usage.,Propagate total_usage to session output and telemetry; add explicit component scopes and include bounded child usage in parent budget enforcement.,Fixed,.venv/bin/python -m pytest -q --no-cov src/tests/test_harness_evaluator.py src/tests/test_harness_cli_run.py,PASS: focused cumulative-accounting regressions and the 5140-test orchestration checkpoint passed with unavailable child detail kept explicit.,2026-07-25,Telemetry/Enterprise Lane,Approved by independent telemetry reviewer,All orchestrated model calls now contribute to cumulative usage without invented per-tool attribution.,"Closed; retain complete, partial, and unavailable usage regressions."
|
| 11 |
AUDIT-081,State Integrity,Runtime lifecycle,requested versus applied entity state,src/ctx/adapters/generic/runtime_lifecycle.py,"Commits fc4cf0b9 and f04c32b4 distinguish requested and applied transitions and derive loaded state only from load_applied/unload_applied events.",High,Session state must distinguish suggested requested approved activating active used deactivating inactive blocked and degraded states and report active only after applied state is verified.,lifecycle state-machine review,Retested Pass,2026-07-20,Dashboards and integrations could report an entity active when only an advisory request had been appended.,Record load_requested without load_applied then call session_state and inspect loaded entities.,Derive active session state only from verified applied transitions while retaining advisory request history.,Fixed,.venv/bin/python -m pytest -q --no-cov src/tests/test_harness_ctx_core.py,PASS: the 434-test focused runtime checkpoint excludes requested-only entities and preserves correct load_applied/use/unload_applied ordering.,2026-07-25,Telemetry/Enterprise Lane,Approved by independent runtime reviewer,Active state is now applied-only while advisory events remain auditable.,Closed; keep requested-only and mixed-epoch state regressions in the focused gate.
|
| 12 |
AUDIT-082,Telemetry,MCP adaptive runtime,lifecycle efficiency and cleanup evidence,src/ctx/adapters/generic/tools/mcp_router.py; src/ctx/cli/run.py; src/ctx/adapters/generic/runtime_lifecycle.py,"Commit aec4181d hashes external MCP identities and emits bounded capability epochs, schema bytes, process start/reap/recovery outcomes, lifetime, and terminal transitions without double counting.",High,Adaptive telemetry must expose privacy-safe counts durations schema and context bytes capability epochs activation outcomes and verified cleanup without commands secrets raw evidence or credential fingerprints.,telemetry coverage and privacy review,Retested Pass,2026-07-20,Adaptive MCP telemetry exposed raw external identifiers and lacked complete process-lifetime and cleanup proof.,Activate call recover and unload an MCP then inspect telemetry for hashed identity epoch process lifetime reap outcome and one terminal transition.,Use existing OTel primitives with bounded hashed dimensions and emit lifecycle evidence only after observed process transitions.,Fixed,.venv/bin/python -m pytest -q --no-cov src/tests/test_enterprise_telemetry.py src/tests/test_mcp_router.py src/tests/test_harness_ctx_core.py,PASS: the 434-test focused runtime checkpoint covers privacy-safe identity capability epochs process start/reap/recovery lifetime cleanup and truthful token completeness.,2026-07-25,Telemetry/Enterprise Lane,Approved by independent MCP and privacy reviewers,The privacy and complete adaptive-runtime evidence findings are closed without changing exporter scope.,Closed; retain no-double-count recovery and process-reap adversarial regressions.
|
|
|
|
| 6 |
AUDIT-076,Authorization,Generic adaptive runtime,model-visible lifecycle consent,src/ctx/adapters/generic/ctx_core_tools.py; src/ctx/adapters/generic/runtime_lifecycle.py,"Commits fc4cf0b9 and ddbbb111 make model lifecycle calls advisory, reject manufactured applied authority, and preserve trusted host-owned activation paths.",Critical,Only a host-issued session and content-bound activation grant may authorize runtime context; a model recommendation or lifecycle call must not claim user consent.,adversarial authority-default review,Retested Pass,2026-07-20,A model with the full ctx surface could manufacture an event that appeared to be an explicitly selected user load.,"Call ctx__load_entity with missing or manufactured selection authority and inspect requested versus applied events.",Keep model-published lifecycle tools advisory and accept applied transitions only from the trusted host path.,Fixed,.venv/bin/python -m pytest -q --no-cov src/tests/test_harness_ctx_core.py,PASS: the 434-test focused runtime checkpoint rejects model-manufactured applied authority while preserving trusted host-applied transitions.,2026-07-25,Runtime/API/MCP Lane,Approved by independent runtime and privacy reviewers,The authority boundary is host-owned and model lifecycle calls remain observable advisory requests.,Closed; retain the adversarial authority regression in the focused and full gates.
|
| 7 |
AUDIT-077,Context Integrity,Generic adaptive runtime,durable wiki body and ineffective unload,src/ctx/adapters/generic/ctx_core_tools.py; src/ctx/adapters/generic/loop.py; src/ctx/adapters/generic/runtime_lifecycle.py,"Commits 9cbe248c and 33d5353f cap wiki bodies, expose raw wiki call/result context for one subsequent provider request, and strip it from persistence and replay.",Critical,Skill or agent text must be scan-and-hash matched size bounded marked untrusted attached only to a provider-request copy and physically absent after unload.,adversarial prompt-lifetime review,Retested Pass,2026-07-20,Untrusted raw catalog instructions and their token cost could survive in provider history after their useful turn.,Call wiki_get for a long or malicious entity then persist replay and inspect subsequent provider messages.,Use a bounded one-turn provider-copy lease and remove raw wiki tool context at persistence and replay boundaries.,Fixed,.venv/bin/python -m pytest -q --no-cov src/tests/test_harness_loop.py src/tests/test_harness_state.py,"PASS: focused loop/state regressions in the 434-test runtime checkpoint prove one-turn raw context, persistence/replay stripping, compaction safety, and fail-before-side-effect ID validation.",2026-07-25,Runtime/API/MCP Lane,Approved by independent runtime reviewer,The raw tool-context lifetime defect is closed; model-authored quotations remain a documented residual risk rather than raw tool state.,Closed; retain lifetime persistence replay and reused-ID adversarial regressions.
|
| 8 |
AUDIT-078,Authorization,MCP runtime,advertised-schema dispatch boundary,src/ctx/adapters/generic/tools/mcp_router.py; src/ctx/adapters/generic/loop.py,Commit 51c845d2 requires every dispatch to match the active published tool registry before RPC; focused boundary tests cover hidden and unpublished calls.,Critical,Every MCP call must match the exact active published tool registry and immutable capability epoch used for the provider response before any RPC occurs.,hidden-tool and stale-capability review,Retested Pass,2026-07-20,A model or caller can invoke a server tool that was not advertised in the current provider capability set.,Start a server with multiple tools expose a subset then call an omitted qualified tool directly through McpRouter.call.,Publish exact active registries per epoch and require expected epoch server activity and exact tool membership atomically at dispatch.,Fixed,.venv/bin/python -m pytest -q --no-cov src/tests/test_mcp_router.py src/tests/test_harness_loop.py,PASS: the published-tool boundary slice reported 74 passing tests and independent review approved the exact dispatch guard.,2026-07-25,Runtime/API/MCP Lane,Approved by independent MCP reviewer,Hidden and policy-filtered tools are rejected at the router boundary before any server RPC.,Closed; retain hidden-tool and stale-capability regressions.
|
| 9 |
+
AUDIT-079,Efficiency,MCP runtime,eager startup schemas and unverifiable cleanup,src/ctx/adapters/generic/tools/mcp_router.py; src/ctx/cli/run.py,"Lazy selective MCP activation, schema revocation, POSIX process-group termination, failed-reap retention, and hashed lifecycle events are implemented and pass the focused runtime slice. HISTORICAL REVIEW NOTE: native Windows proof was previously pending; that unsupported obligation is retired. Remote supported-host cleanup proof remains pending.",High,Dormant MCP configs must consume no process or schema budget; selected servers start independently and unload revokes schemas then verifies process-tree and thread cleanup.,runtime lifecycle and process-containment review,Needs Validation,2026-07-20,One slow unused MCP can delay or fail the session and stale descendants or schemas can survive best-effort shutdown.,Configure multiple servers including one unused or stubborn child then inspect startup latency schemas and surviving descendants.,Add host activation mode with dormant normalized configs selective start and stop schema limits drain or cancel verified process-group reaping and failed-reap tombstones.,Fixed,.venv/bin/python -m pytest -q --no-cov src/tests/test_mcp_router.py src/tests/test_harness_cli_run.py,PASS LOCAL: focused MCP router suite reported 79 passing tests with POSIX session and process-group termination regressions; remote stubborn-descendant validation remains outstanding.,2026-08-01,Runtime/API/MCP Lane,Approved locally pending remote supported-host validation,"The implementation exists and local containment passes, so this is validation debt rather than unstarted product work.",Run remote lazy-activation and POSIX process-tree cleanup validation on a supported host.
|
| 10 |
AUDIT-080,Telemetry,Evaluator runtime,complete session token accounting,src/ctx/adapters/generic/evaluator.py; src/ctx/cli/run.py,"Commits 43fda102 and 0708979d propagate cumulative planner, contract, generator, evaluator, and bounded-agent usage to budgets, session history, CLI JSON, and telemetry.",High,CLI JSON telemetry and budgets must account for every planner contract generator evaluator and delegated-agent model call without inventing per-tool attribution.,usage data-flow review,Retested Pass,2026-07-20,Evaluator-enabled sessions underreport the tokens and cost of the development process and can present misleading efficiency KPIs.,Run ctx run with planner contract and evaluator then compare emitted usage with EvaluationLoopResult.total_usage.,Propagate total_usage to session output and telemetry; add explicit component scopes and include bounded child usage in parent budget enforcement.,Fixed,.venv/bin/python -m pytest -q --no-cov src/tests/test_harness_evaluator.py src/tests/test_harness_cli_run.py,PASS: focused cumulative-accounting regressions and the 5140-test orchestration checkpoint passed with unavailable child detail kept explicit.,2026-07-25,Telemetry/Enterprise Lane,Approved by independent telemetry reviewer,All orchestrated model calls now contribute to cumulative usage without invented per-tool attribution.,"Closed; retain complete, partial, and unavailable usage regressions."
|
| 11 |
AUDIT-081,State Integrity,Runtime lifecycle,requested versus applied entity state,src/ctx/adapters/generic/runtime_lifecycle.py,"Commits fc4cf0b9 and f04c32b4 distinguish requested and applied transitions and derive loaded state only from load_applied/unload_applied events.",High,Session state must distinguish suggested requested approved activating active used deactivating inactive blocked and degraded states and report active only after applied state is verified.,lifecycle state-machine review,Retested Pass,2026-07-20,Dashboards and integrations could report an entity active when only an advisory request had been appended.,Record load_requested without load_applied then call session_state and inspect loaded entities.,Derive active session state only from verified applied transitions while retaining advisory request history.,Fixed,.venv/bin/python -m pytest -q --no-cov src/tests/test_harness_ctx_core.py,PASS: the 434-test focused runtime checkpoint excludes requested-only entities and preserves correct load_applied/use/unload_applied ordering.,2026-07-25,Telemetry/Enterprise Lane,Approved by independent runtime reviewer,Active state is now applied-only while advisory events remain auditable.,Closed; keep requested-only and mixed-epoch state regressions in the focused gate.
|
| 12 |
AUDIT-082,Telemetry,MCP adaptive runtime,lifecycle efficiency and cleanup evidence,src/ctx/adapters/generic/tools/mcp_router.py; src/ctx/cli/run.py; src/ctx/adapters/generic/runtime_lifecycle.py,"Commit aec4181d hashes external MCP identities and emits bounded capability epochs, schema bytes, process start/reap/recovery outcomes, lifetime, and terminal transitions without double counting.",High,Adaptive telemetry must expose privacy-safe counts durations schema and context bytes capability epochs activation outcomes and verified cleanup without commands secrets raw evidence or credential fingerprints.,telemetry coverage and privacy review,Retested Pass,2026-07-20,Adaptive MCP telemetry exposed raw external identifiers and lacked complete process-lifetime and cleanup proof.,Activate call recover and unload an MCP then inspect telemetry for hashed identity epoch process lifetime reap outcome and one terminal transition.,Use existing OTel primitives with bounded hashed dimensions and emit lifecycle evidence only after observed process transitions.,Fixed,.venv/bin/python -m pytest -q --no-cov src/tests/test_enterprise_telemetry.py src/tests/test_mcp_router.py src/tests/test_harness_ctx_core.py,PASS: the 434-test focused runtime checkpoint covers privacy-safe identity capability epochs process start/reap/recovery lifetime cleanup and truthful token completeness.,2026-07-25,Telemetry/Enterprise Lane,Approved by independent MCP and privacy reviewers,The privacy and complete adaptive-runtime evidence findings are closed without changing exporter scope.,Closed; retain no-double-count recovery and process-reap adversarial regressions.
|
qa/ctx_benchmark_status.csv
CHANGED
|
@@ -8,7 +8,7 @@ BENCH-005,token-accounting,As a product owner I receive honest time and token KP
|
|
| 8 |
BENCH-007,retry-loop,"As an operator I get a durable record of failures and bounded retries.","Failures are logged and later correlated retries resolve them; unresolved incidents fail; light escalates only after a clean model turn and normal verifier exit 1.",Needs Validation,"Unit tests cover correlated resolution and timeout/non-test failure non-escalation; adaptive live recovery evidence is pending.","Inject a normal focused-test failure and a timeout then inspect treatment levels and incident statuses.","Silent retries hide instability and timeout escalation activates unnecessary expensive context.","Resolve prior attempt rows after success reject unresolved rows and gate escalation on exact failure kind.","Review blockers fixed in code; live recovery remains.",2026-07-20
|
| 9 |
"BENCH-008","treatment-overhead","As a ctx user I receive useful context without paying for every available tool.","Host preflight selects at most one bounded skill or abstains; expensive MCP and reviewer surfaces activate only after explicit evidence; selected context is removed after its useful phase.","Needs Validation","Historical Click calibration favored CTX, while the six-pair attrs diagnostic preserved quality but did not meet the uncached-token benefit threshold. Those exposed, outcome-informed assignments are diagnostic only. The official V2 campaign remains NOT RUN: 0/30 pairs and 0/60 arms.","In the frozen official V2 campaign, inspect every CTX arm for exact recommendation, selection, load, use, unload, abstention, and provider-token evidence, then apply the preregistered repository-level quality and benefit gates.","Generic guidance or unnecessary tool surfaces can preserve quality while increasing uncached tokens and elapsed time.","Keep bounded trace metrics, fail closed on run attestation, load only policy-selected context, and require quality non-inferiority plus the preregistered repository-level benefit threshold.","Keep open until the official task-disjoint V2 campaign reports all 30 pairs; do not reuse the exposed attrs, Requests, or Rich assignments as confirmatory evidence.","2026-07-30"
|
| 10 |
"BENCH-009","arm-order","As a reviewer I get order-balanced results even when scenarios are filtered.","Each six-trial three-arm block uses every permutation once; each six-trial baseline-light block alternates order exactly three times each.","Resolved","Commit 25a3c082; test_three_arm_schedule_is_stable_and_counterbalanced and test_two_arm_schedule_alternates_order_three_times_each pass.","Compare full and filtered three-arm schedules, then assert the two-arm six-trial sequence is baseline-first and CTX-first 3/3.","Resetting scenario indexes or always starting one arm biases timing and cache effects.","Use stable scenario ordering and explicit two-arm alternation.","Pass: both supported schedules are deterministic and counterbalanced.","2026-07-28"
|
| 11 |
-
BENCH-010,process-containment,"As an operator I do not retain detached benchmark or verification processes.","Timeout and successful-parent paths terminate descendants on POSIX
|
| 12 |
BENCH-011,runtime-tool-proof,"As a reviewer I can reject an MCP or reviewer claim that used the wrong target or was not closed.","Full treatment passes only with the expected MCP slug type body and a matching selected-marker spawned waited and closed reviewer ID.",Needs Validation,"Unit fixtures reject failed wrong-argument wrong-result unclosed and malicious-review prompts; real MCP protocol preflight passes.","Run one live ctx-full arm and inspect policy_valid tool observations marker and team-token scope.","Tool-name-only evidence can credit the wrong call and completed reviewers can remain allocated.","Bind MCP evidence to exact arguments/result bind agent evidence to selected marker and mark any agent attempt token-incomplete.","Review blocker fixed in code; final live trace pending.",2026-07-20
|
| 13 |
"BENCH-012","run-manifest","As a reviewer I can reproduce the exact benchmark schedule and repository state.","The manifest records trials, retries, timeout, arm mode, filters, cache, schedule, script and scenario hashes, dependencies, catalog provenance, and clean state; live scoring rejects dirty state.","Resolved","Commit 25a3c082 and .gate/ctx-ab-runs/ctx-ab-20260727T223114Z-0be5b69e/environment.json record the version-2 cache hit, seven bound runtime files, schedule, hashes, and dirty diagnostic state.","Run a dry run from a dirty tree, inspect environment.json, then confirm the same live command fails before model execution.","Missing parameters or allowing a changing harness makes evidence irreproducible.","Persist the complete manifest and require a clean committed harness for live production runs.","Pass: manifest completeness and dirty-tree fail-closed behavior are independently reviewed.","2026-07-28"
|
| 14 |
BENCH-013,feature-registry,"As a ctx maintainer I can discover the benchmark from the repository feature inventory.","The benchmark runner has a user story and evidence row in both canonical and published feature trackers.",Resolved,"MAINT-016 exists in qa/feature_status.csv and docs/qa/feature-user-story-status.csv; all 17 feature tracker tests pass.","Run .venv/bin/python -m pytest -q src/tests/test_feature_user_story_tracker.py.","An untracked maintainer surface violates the repository-wide feature audit goal and fails CI.","Add one MAINT-016 row to each approved tracker and retain the benchmark ledger as source evidence.","Pass: canonical and published rows parse with unique IDs and the maintainer-script coverage gate is green.",2026-07-30
|
|
@@ -32,12 +32,13 @@ BENCH-020,legacy-skill-router,"As a developer I receive a small ranked skill sel
|
|
| 32 |
"BENCH-031","marginal-value-abstention","As a ctx user I do not pay prompt and setup cost for guidance that only repeats the task language and adds no task-specific capability.","When a selected skill matches only the normalized scenario language and no intent-specific tag, CTX records a verified policy abstention, selects nothing, leaves the treatment prompt unchanged, and remains eligible for honest no-op comparison.","Needs Validation","Commit e8abed6f implements fail-closed language-only abstention, sealed final attestations, exact schedule enforcement, and trusted policy KPIs. Two independent reviewers approved after adversarial forged, tampered, malformed, wrong-language, constraint-only, and intent-specific cases; 135 benchmark tests passed. Dry run ctx-ab-20260728-abstention-kpi-wip confirms no selection, body fetch, prompt change, or loaded terminal state; a real current-head model turn is still required to verify the live abstention.","From a clean current committed head, run six pairs for a frozen scenario that produces an exact language-only match; require policy_abstention_verified=true, unchanged prompt hashes, zero selected and loaded context, sealed final attestations, complete exact token evidence, and no unresolved incidents.","An overbroad abstention rule could hide useful language expertise or overfit one observed benchmark; a dry run cannot prove the live model-turn evidence boundary.","Gate only an exact non-empty language-only match, fetch no body, preserve candidate and lifecycle evidence, seal results after terminal attestation, and exclude forged or untrusted rows from claims and KPI numerators.","Implementation approved with no findings; keep open only for a clean current-head live rerun and paired KPI result.","2026-07-28"
|
| 33 |
"BENCH-032","local-fast-summary-provenance","As a release reviewer I can bind every local-fast result to the exact committed head and execution window.","The summary JSON records a schema version, UTC start and finish timestamps, exact HEAD SHA, resolved merge-base SHA, profile, committed-head semantics, dirty state at selection, exact changed paths, worker count, lane timings, and return codes; every lane runs the captured HEAD.","Resolved","Commits 3f41e438 and a61237cd. Two independent reviewers approved after closing classification-before-SHA, mutable-base, ambiguous-dirty-state, and timestamp-typing findings. A clean detached-worktree run at c9e1faaba639b009c4f07e8b79e8a2dbf77e61a9 passed all 11 lanes with returncode 0 in 135.935 seconds. Ignored .gate/local-fast.json files are rolling local output and are never canonical current evidence after another run.","Run scripts/no_mistakes_run.sh fast --summary-json .gate/local-fast.json, compare head_sha to git rev-parse HEAD, verify base_sha is the merge base, require source_worktree_dirty_at_selection=false and every lane returncode=0.","Without immutable selection and execution revisions, a copied green summary or concurrent commit can misattribute lane selection and results.","Capture head and merge-base before classification, classify against those SHAs, recheck HEAD, pin every worktree to the captured revision, and serialize exact provenance.","Pass: CTO and independent reviewer approved the provenance contract; accept an individual run only when its summary binds the reviewed commit and every lane is green.","2026-07-30"
|
| 34 |
"BENCH-033","clustered-statistical-evidence","As a product owner I receive uncertainty-aware CTX benefit evidence that does not treat repeated trials as independent repositories.","Product-level verdicts collapse paired trials to scenario medians and scenarios to repository medians, require a frozen repository identity for every attempt, and use an exact repository-support test without inflating the independent sample count.","Resolved","Commit c62c81cb; 138 focused benchmark tests passed. The rolling .gate/local-fast.json binds clean head c62c81cbfcfd6a626ccbe0718f890837ee4dc5cd to 11 green lanes, 9 workers, returncode 0, and 46.587 seconds; it does not retain pytest or coverage output.","Construct three unanimous repositories, one dominant repository, missing or malformed mappings, retry-time relabeling, case-only aliases, five unanimous repositories, and a matrix with mostly verified abstentions plus one verified delivery; inspect repository_cluster_analysis, ctx_policy_outcomes, and product_benefit_verdict.","Pseudoreplication, forged repository labels, or interpreting a policy-assignment effect as universal delivered-context causality could make evidence look stronger than it is.","Require six scenarios, five canonical repositories, six trials, exact frozen URL identity on every attempt, at least one verified delivery overall, trusted delivery or verified abstention for every CTX assignment, all-repository quality and non-regression, and exact one-sided support p at most 0.05.","Pass: independent statistical and code reviewers approved the implementation; the follow-up CTO review required explicit intent-to-treat and global-delivery semantics, which are now documented without claiming per-repository delivered-context causality.","2026-07-28"
|
| 35 |
-
"BENCH-034","official-holdout-verification","As a benchmark reviewer I can judge baseline and CTX patches with the same hidden repository-native evaluator.","Every holdout control and scored patch runs in the pinned official SWE-bench Docker environment, proves exact FAIL_TO_PASS and PASS_TO_PASS identities, retains raw evidence, and leaves no process or container behind.","Needs Validation","
|
| 36 |
"BENCH-035","production-graph-feature-benefit","As a product owner I can show whether the same coding agent implements real hidden features more effectively with CTX recommendations than without CTX.","A fresh frozen protocol assigns ten hidden feature tasks from ten repositories to identical baseline and CTX arms, counterbalances order, repeats pairs, keeps the evaluator secret, and reports verified quality, exact tokens, development time, errors, recommendations, and load/use/unload evidence without assuming CTX wins.","Needs Validation","CURRENT CANDIDATE: framework PR #253 merged as 0e9289e4 with all required checks green. The exact combined V2 suite passed 505/505 on framework code HEAD 547b80a5, exact-head preflight passed 19/19 on 78a003ac, and all independent review lanes returned MERGE. The official campaign remains NOT RUN: 0/10 controls, 0/30 pairs, and 0/60 arms; CTX benefit remains unproven.","For each frozen task run the same model, limits, commit, task text, evaluator, and authenticated environment in isolated baseline and CTX workspaces; execute three paired repetitions with a globally frozen 15/15 order; aggregate by repository and preserve every failure.","Small or cherry-picked tasks, different environments, leaked tests, parallel hardware contention, missing token attribution, outcome-informed reuse, or calling framework validation a product result could manufacture an apparent CTX advantage.","Use ten independent repositories, three paired repetitions per task, uncached provider tokens as the primary endpoint, development time excluding evaluator time as a secondary endpoint, quality non-inferiority, exact repository-level support, and a task-disjoint generation after any outcome-informed product fix.","Open until the complete exposure inventory, all ten controls, and 30 pairs complete with exact evidence, failures are classified, the result is independently reviewed, and the honest verdict is published. A valid not_beneficial result is final and must not be rerun or hidden.","2026-07-30"
|
| 37 |
"BENCH-036","official-v2-verdict-gates","As a benchmark reviewer I receive an official V2 verdict that cannot bypass the preregistered claim gates.","The authoritative official verdict is produced by the authenticated repository-level evaluator and requires the frozen primary token endpoint, at least nine benefiting repositories, the frozen overall token-ratio threshold, preserved quality, exact evidence, no unresolved incidents, and verified CTX delivery in all ten repositories; time-only improvement cannot pass.","Resolved","Commit 7b212141 routes official results through evaluate_repository_claim and publishes its gate results verbatim. Negative regressions reject time-only improvement and verified delivery in only nine repositories; the exact combined V2 suite passed 455/455 on HEAD 71f31993.","Construct ten repository rows with time ratio 0.80, token ratio 1.05, and verified delivery in only one repository; before the fix the generic OR-based summary could label the product beneficial, while the authenticated official evaluator now returns not_beneficial.","A favorable public verdict could contradict the frozen methodology and invalidate the confirmatory claim.","Replace the generic summary verdict for official runs with evaluate_repository_claim over authenticated repository rows, preserve every gate result in public evidence, and add negative regressions for time-only and incomplete-delivery cases.","Pass: the P0 bypass was independently reproduced, the authoritative-gate fix and regressions were reviewed, and exact-head framework integration is green; this does not claim that the official campaign has run or benefited CTX.","2026-07-30"
|
| 38 |
"BENCH-037","task-disjoint-protocol-generations","As a benchmark reviewer I can require a genuinely fresh holdout after any outcome-informed product or harness change.","Each protocol generation uses stable dataset-derived per-repository candidate ranking and selects candidate slot generation minus one; a restart either produces task-ID-disjoint choices in all ten repositories or fails closed and requires a new pinned universe.","Resolved","Commit cc1631c9 implements stable candidate partitions, candidate_slot = protocol_generation - 1, mutation rejection, and fail-closed cardinality. The methodology reviewer approved the focused 111-test evidence. The current pinned universe supports generation 1 only because 9/10 repositories have a second eligible candidate; generation 2 is therefore an intentional no-go.","Build generation 1 and generation 2 from a fixture with at least two eligible candidates per repository and compare task-ID sets, then remove one repository's second candidate or mutate the generation, seed, or slot; the first sets are disjoint and every invalid or undersupplied case is rejected.","Reusing observed tasks after a product or harness fix turns a confirmatory rerun into outcome-informed tuning and can bias the published result.","Bind generation to stable per-repository candidate slots and authenticate the complete design; after any outcome-informed fix, select a task-disjoint generation or preregister a new pinned universe when fresh cardinality is insufficient.","Pass: independent methodology review approved the task-disjoint-or-no-go design. Generation 1 remains eligible and NOT RUN; generation 2 is unavailable on the current universe by design.","2026-07-30"
|
| 39 |
"BENCH-038","authenticated-verdict-snapshots","As a benchmark reviewer I can trust that acquisition provenance and frozen verdict inputs cannot change after authentication.","The runner reconstructs the complete canonical acquisition protocol, verifies its digest and V1-derived design, retains authenticated immutable bytes for every frozen verdict input, and refuses reports or public summaries after any post-attestation drift.","Resolved","Commits fa5aa34d, 2c9b6d2b, and cd051cba authenticate canonical acquisition provenance and verdict snapshots. The independent security reviewer approved arbitrary-digest, claim-gate drift, canonical-byte, eight-input mutation, privacy, and module-invocation probes; the exact combined V2 suite passed 455/455 on HEAD 71f31993.","Supply an arbitrary acquisition digest or rehash altered claim gates, then mutate each of the eight frozen inputs after loading and request a performance report or public summary; every path is rejected before a verdict is emitted.","A forged predecessor digest or time-of-check/time-of-use mutation could produce a public verdict from unauthenticated methodology or hidden inputs.","Reconstruct and validate the canonical acquisition document, compare its canonical digest, retain authenticated bytes for all frozen artifacts, and reauthenticate snapshots at every verdict-producing boundary.","Pass: independent security review found no remaining issue in the trust-chain, post-attestation mutation, privacy, or CLI-import scope; the official campaign remains NOT RUN.","2026-07-30"
|
| 40 |
-
"BENCH-039","future-history-isolation","As a benchmark reviewer I can prove neither arm can inspect a future commit or gold fix from the selected repository.","Official controls and measured arms use the same authenticated offline source bundle containing the selected base commit closure, no descendant refs, no remote, and no unreachable future objects; the source-map bytes and every bundle hash are execution-frozen.","Needs Validation","Commits a3667925, e38518e7, and 65df2edb prepare, authenticate, consume, and independently revalidate exact base-closure bundles. A post-materialization future-gold bundle swap was reproduced, fixed, and independently rejected; the exact combined V2 suite passed 505/505 on code HEAD 547b80a5. Exact-head preflight then passed 19/19 on 78a003ac
|
| 41 |
-
"BENCH-040","one-shot-campaign-guard","As a benchmark reviewer I can prove one frozen assignment set is measured by only one serial campaign on the host.","Official execution holds one host-wide exclusive lock for the complete campaign, independently validates frozen selection task/repository pairs against the executable scenario pack, atomically consumes their order-independent identity before measured model work, and records exact selection and execution-protocol identities as secondary fail-closed indexes, so another process, reordering, re-freeze, clone, or output path cannot overlap or replay measured assignments.","Needs Validation","The pre-launch audit first reproduced two distinct protocol digests consuming one selection on the merged framework. Independent review then reproduced reordered selection bytes producing another selection digest, a forged selection repository map producing another assignment digest for identical executable scenarios, and first-run multi-level state creation without syncing every new ancestor link. Commits 1f654635 and d4a0f8ab validate selection rules and exact scenario repositories before deriving the semantic identity, write assignment then selection then protocol indexes, fsync every verified directory/parent and each claim/containing directory even under concurrent publication, and add loader-level replay, permutation, concurrency, interruption, durability, privacy, permission, malformed-state, link-state, same-protocol, and cross-clone regressions. No official selection, protocol, assignment claim, or model outcome exists.","Claim an assignment set with selection/protocol A, then reorder or forge the selection map while retaining identical executable scenario pairs and rehash every linkage; race distinct protocols and missing hierarchy creators; inject interruption between indexes; start from a missing multi-level state base and observe every file and directory-entry fsync; every replay must fail before a model arm while one owner-only assignment record and at most one matching selection and protocol record remain.","Concurrent arms, unauthenticated semantic inputs, or byte-level reordering/re-freezing of one deterministic assignment set permits outcome-informed confirmatory reruns and invalidates timing and statistical evidence; an unsynced ancestor directory can lose every one-shot claim after a crash.","Validate fixed acquisition selection rules and exact task/repository agreement with the scenario pack, then use an owner-only persistent host lock plus an atomic semantic-assignment consumption index and exact selection/protocol secondary indexes; create and durably sync every state component and the assignment claim first, failing closed on existing, legacy, malformed, stale, aliased, mismatched, or partially written state.","Pass: five independent review cycles reproduced and closed every semantic and durability gap, ending APPROVE with no P0-P3 finding; the combined benchmark/prepare/tracker suite passed 309/309 plus Ruff, format, mypy, and diff checks; the exact committed fast gate passed all 8 lanes with 6,193 unit tests, and the activated-venv PR preflight passed all 16 steps.
|
| 42 |
"BENCH-041","historical-exposure-ledger","As a benchmark reviewer I can prove every selected task is disjoint from all tasks previously shown to CTX, an LLM, or a benchmark arm.","Before ranking, selection authenticates a private canonical salted HMAC ledger, rejects every matching instance ID with explicit evidence, freezes the ledger digest into acquisition and execution protocols, and cannot proceed without the exact ledger.","Needs Validation","Commits 4b541eac, beaed567, a3667925, e38518e7, and 65df2edb bind the private HMAC ledger through selection, source preparation, controls, and freeze. Empty-ledger and overlap attacks were reproduced, fixed, and independently rejected; the exact combined V2 suite passed 505/505 and exact-head preflight passed 19/19 on 78a003ac. No V2 task was submitted to CTX or a model.","Construct a deterministic candidate set where the highest-ranked row is present in the authenticated exposure ledger; require explicit rejection and a disjoint replacement, then tamper, omit, reorder, duplicate, or swap the ledger and require fail-closed behavior.","A previously observed task allows outcome-informed tuning or memory effects and converts a confirmatory benchmark into contaminated reuse.","Build and merge a private hash-only historical ledger, authenticate exact canonical bytes, apply exclusion before all ranking/cardinality checks, and regenerate the first eligible ten-repository selection.","Implementation, independent privacy/methodology review, and exact-head preflight pass; the merged-main run must still combine all known private evidence sources and produce a fresh disjoint selection before controls.","2026-07-30"
|
| 43 |
-
"BENCH-042","merged-main-attestation","As a benchmark reviewer I can prove protocol creation and every measured arm use the exact clean commit published at origin/main.","The acquisition protocol freezes a credential-free origin URL and origin/main revision; protocol preparation, source preparation, startup, every arm, and final attestation require clean HEAD equal to that exact remote-tracking revision and reject drift.","Needs Validation","Commits a3667925, e38518e7, a562c443, 68d113c9, and 78a003ac authenticate origin URL, origin/main, HEAD, cleanliness, repository-state digest, and platform-native temporary-path rejection at preparation, startup, every arm, and final attestation. Exact-head preflight passed 19/19, PR #253 merged as 0e9289e4 with all required checks green, and a fresh detached worktree matched clean origin/main. Python 3.12.13 dependencies and the pinned Docker daemon passed conformance without revealing a task.","Create a clean unmerged commit, alter origin/main, change the origin URL, advance HEAD after startup, or place live scenarios under the platform temporary directory; protocol creation and each later boundary must fail before producing eligible evidence.","A clean feature branch, stale remote-tracking ref, or temporary scenario path can produce invalid or exposed evidence that appears reproducible.","Freeze sanitized remote identity and exact origin/main SHA, require HEAD equality after an authenticated fetch boundary, reject the platform temporary root, and recheck the same values before every arm and in final attestation.","Implementation, exact-head preflight, independent review,
|
|
|
|
|
|
| 8 |
BENCH-007,retry-loop,"As an operator I get a durable record of failures and bounded retries.","Failures are logged and later correlated retries resolve them; unresolved incidents fail; light escalates only after a clean model turn and normal verifier exit 1.",Needs Validation,"Unit tests cover correlated resolution and timeout/non-test failure non-escalation; adaptive live recovery evidence is pending.","Inject a normal focused-test failure and a timeout then inspect treatment levels and incident statuses.","Silent retries hide instability and timeout escalation activates unnecessary expensive context.","Resolve prior attempt rows after success reject unresolved rows and gate escalation on exact failure kind.","Review blockers fixed in code; live recovery remains.",2026-07-20
|
| 9 |
"BENCH-008","treatment-overhead","As a ctx user I receive useful context without paying for every available tool.","Host preflight selects at most one bounded skill or abstains; expensive MCP and reviewer surfaces activate only after explicit evidence; selected context is removed after its useful phase.","Needs Validation","Historical Click calibration favored CTX, while the six-pair attrs diagnostic preserved quality but did not meet the uncached-token benefit threshold. Those exposed, outcome-informed assignments are diagnostic only. The official V2 campaign remains NOT RUN: 0/30 pairs and 0/60 arms.","In the frozen official V2 campaign, inspect every CTX arm for exact recommendation, selection, load, use, unload, abstention, and provider-token evidence, then apply the preregistered repository-level quality and benefit gates.","Generic guidance or unnecessary tool surfaces can preserve quality while increasing uncached tokens and elapsed time.","Keep bounded trace metrics, fail closed on run attestation, load only policy-selected context, and require quality non-inferiority plus the preregistered repository-level benefit threshold.","Keep open until the official task-disjoint V2 campaign reports all 30 pairs; do not reuse the exposed attrs, Requests, or Rich assignments as confirmatory evidence.","2026-07-30"
|
| 10 |
"BENCH-009","arm-order","As a reviewer I get order-balanced results even when scenarios are filtered.","Each six-trial three-arm block uses every permutation once; each six-trial baseline-light block alternates order exactly three times each.","Resolved","Commit 25a3c082; test_three_arm_schedule_is_stable_and_counterbalanced and test_two_arm_schedule_alternates_order_three_times_each pass.","Compare full and filtered three-arm schedules, then assert the two-arm six-trial sequence is baseline-first and CTX-first 3/3.","Resetting scenario indexes or always starting one arm biases timing and cache effects.","Use stable scenario ordering and explicit two-arm alternation.","Pass: both supported schedules are deterministic and counterbalanced.","2026-07-28"
|
| 11 |
+
BENCH-010,process-containment,"As an operator I do not retain detached benchmark or verification processes.","Timeout and successful-parent paths terminate descendants on supported POSIX hosts including detached children that retain inherited pipes and fail closed when cleanup cannot be verified.",Needs Validation,"HISTORICAL PLATFORM FACT: code commit ea3625f6 added a kill-on-close Windows Job Object, suspended root assignment before resume, dynamic PID verification, cleanup-before-pipe-drain behavior, verified emergency cleanup, and native success and timeout regressions. The exact combined V2 suite passed 505/505 on code HEAD 547b80a5; independent runtime and source-boundary reviews approved that candidate. CURRENT POSIX CANDIDATE: native Windows containment was removed and process-group plus marker cleanup remains the supported contract.","Run the POSIX detached-descendant successful-parent, inherited-pipe, timeout, and cleanup-failure regressions, then scan every recorded PID after the official campaign.","Detached children distort elapsed time, leak resources, or turn a successful root into a false timeout while retaining inherited pipes.","Use POSIX process-group plus marker cleanup; terminate and verify containment on every success, timeout, and exception path before draining inherited pipes.","Supported-host implementation and focused gates pass; the official post-run PID scan remains required.",2026-08-01
|
| 12 |
BENCH-011,runtime-tool-proof,"As a reviewer I can reject an MCP or reviewer claim that used the wrong target or was not closed.","Full treatment passes only with the expected MCP slug type body and a matching selected-marker spawned waited and closed reviewer ID.",Needs Validation,"Unit fixtures reject failed wrong-argument wrong-result unclosed and malicious-review prompts; real MCP protocol preflight passes.","Run one live ctx-full arm and inspect policy_valid tool observations marker and team-token scope.","Tool-name-only evidence can credit the wrong call and completed reviewers can remain allocated.","Bind MCP evidence to exact arguments/result bind agent evidence to selected marker and mark any agent attempt token-incomplete.","Review blocker fixed in code; final live trace pending.",2026-07-20
|
| 13 |
"BENCH-012","run-manifest","As a reviewer I can reproduce the exact benchmark schedule and repository state.","The manifest records trials, retries, timeout, arm mode, filters, cache, schedule, script and scenario hashes, dependencies, catalog provenance, and clean state; live scoring rejects dirty state.","Resolved","Commit 25a3c082 and .gate/ctx-ab-runs/ctx-ab-20260727T223114Z-0be5b69e/environment.json record the version-2 cache hit, seven bound runtime files, schedule, hashes, and dirty diagnostic state.","Run a dry run from a dirty tree, inspect environment.json, then confirm the same live command fails before model execution.","Missing parameters or allowing a changing harness makes evidence irreproducible.","Persist the complete manifest and require a clean committed harness for live production runs.","Pass: manifest completeness and dirty-tree fail-closed behavior are independently reviewed.","2026-07-28"
|
| 14 |
BENCH-013,feature-registry,"As a ctx maintainer I can discover the benchmark from the repository feature inventory.","The benchmark runner has a user story and evidence row in both canonical and published feature trackers.",Resolved,"MAINT-016 exists in qa/feature_status.csv and docs/qa/feature-user-story-status.csv; all 17 feature tracker tests pass.","Run .venv/bin/python -m pytest -q src/tests/test_feature_user_story_tracker.py.","An untracked maintainer surface violates the repository-wide feature audit goal and fails CI.","Add one MAINT-016 row to each approved tracker and retain the benchmark ledger as source evidence.","Pass: canonical and published rows parse with unique IDs and the maintainer-script coverage gate is green.",2026-07-30
|
|
|
|
| 32 |
"BENCH-031","marginal-value-abstention","As a ctx user I do not pay prompt and setup cost for guidance that only repeats the task language and adds no task-specific capability.","When a selected skill matches only the normalized scenario language and no intent-specific tag, CTX records a verified policy abstention, selects nothing, leaves the treatment prompt unchanged, and remains eligible for honest no-op comparison.","Needs Validation","Commit e8abed6f implements fail-closed language-only abstention, sealed final attestations, exact schedule enforcement, and trusted policy KPIs. Two independent reviewers approved after adversarial forged, tampered, malformed, wrong-language, constraint-only, and intent-specific cases; 135 benchmark tests passed. Dry run ctx-ab-20260728-abstention-kpi-wip confirms no selection, body fetch, prompt change, or loaded terminal state; a real current-head model turn is still required to verify the live abstention.","From a clean current committed head, run six pairs for a frozen scenario that produces an exact language-only match; require policy_abstention_verified=true, unchanged prompt hashes, zero selected and loaded context, sealed final attestations, complete exact token evidence, and no unresolved incidents.","An overbroad abstention rule could hide useful language expertise or overfit one observed benchmark; a dry run cannot prove the live model-turn evidence boundary.","Gate only an exact non-empty language-only match, fetch no body, preserve candidate and lifecycle evidence, seal results after terminal attestation, and exclude forged or untrusted rows from claims and KPI numerators.","Implementation approved with no findings; keep open only for a clean current-head live rerun and paired KPI result.","2026-07-28"
|
| 33 |
"BENCH-032","local-fast-summary-provenance","As a release reviewer I can bind every local-fast result to the exact committed head and execution window.","The summary JSON records a schema version, UTC start and finish timestamps, exact HEAD SHA, resolved merge-base SHA, profile, committed-head semantics, dirty state at selection, exact changed paths, worker count, lane timings, and return codes; every lane runs the captured HEAD.","Resolved","Commits 3f41e438 and a61237cd. Two independent reviewers approved after closing classification-before-SHA, mutable-base, ambiguous-dirty-state, and timestamp-typing findings. A clean detached-worktree run at c9e1faaba639b009c4f07e8b79e8a2dbf77e61a9 passed all 11 lanes with returncode 0 in 135.935 seconds. Ignored .gate/local-fast.json files are rolling local output and are never canonical current evidence after another run.","Run scripts/no_mistakes_run.sh fast --summary-json .gate/local-fast.json, compare head_sha to git rev-parse HEAD, verify base_sha is the merge base, require source_worktree_dirty_at_selection=false and every lane returncode=0.","Without immutable selection and execution revisions, a copied green summary or concurrent commit can misattribute lane selection and results.","Capture head and merge-base before classification, classify against those SHAs, recheck HEAD, pin every worktree to the captured revision, and serialize exact provenance.","Pass: CTO and independent reviewer approved the provenance contract; accept an individual run only when its summary binds the reviewed commit and every lane is green.","2026-07-30"
|
| 34 |
"BENCH-033","clustered-statistical-evidence","As a product owner I receive uncertainty-aware CTX benefit evidence that does not treat repeated trials as independent repositories.","Product-level verdicts collapse paired trials to scenario medians and scenarios to repository medians, require a frozen repository identity for every attempt, and use an exact repository-support test without inflating the independent sample count.","Resolved","Commit c62c81cb; 138 focused benchmark tests passed. The rolling .gate/local-fast.json binds clean head c62c81cbfcfd6a626ccbe0718f890837ee4dc5cd to 11 green lanes, 9 workers, returncode 0, and 46.587 seconds; it does not retain pytest or coverage output.","Construct three unanimous repositories, one dominant repository, missing or malformed mappings, retry-time relabeling, case-only aliases, five unanimous repositories, and a matrix with mostly verified abstentions plus one verified delivery; inspect repository_cluster_analysis, ctx_policy_outcomes, and product_benefit_verdict.","Pseudoreplication, forged repository labels, or interpreting a policy-assignment effect as universal delivered-context causality could make evidence look stronger than it is.","Require six scenarios, five canonical repositories, six trials, exact frozen URL identity on every attempt, at least one verified delivery overall, trusted delivery or verified abstention for every CTX assignment, all-repository quality and non-regression, and exact one-sided support p at most 0.05.","Pass: independent statistical and code reviewers approved the implementation; the follow-up CTO review required explicit intent-to-treat and global-delivery semantics, which are now documented without claiming per-repository delivered-context causality.","2026-07-28"
|
| 35 |
+
"BENCH-034","official-holdout-verification","As a benchmark reviewer I can judge baseline and CTX patches with the same hidden repository-native evaluator.","Every holdout control and scored patch runs in the pinned official SWE-bench Docker environment, proves exact FAIL_TO_PASS and PASS_TO_PASS identities, retains raw evidence, and leaves no process or container behind.","Needs Validation","HISTORICAL PLATFORM FACT: framework PR #253 merged as 0e9289e4 after all required checks passed, including the focused native Windows 3.12 gate. CURRENT POSIX CANDIDATE: the exact combined V2 suite passed 505/505 on framework code HEAD 547b80a5, and exact-head preflight passed 19/19 on 78a003ac. The isolated Python 3.12 environment and pinned Docker daemon pass dependency plus amd64/arm64 smoke checks. The official campaign remains NOT RUN: 0/10 controls, 0/30 pairs, and 0/60 arms.","From the clean merged-main worktree, authenticate the complete historical exposure inventory, run all ten controls, inspect private official reports and raw status artifacts, then execute all 60 arms and verify post-run process and container containment.","A host test path, asymmetric evaluator, unpinned image, leaked hidden artifact, or treating framework tests as production evidence could manufacture a quality result.","Use one pinned SWE-bench worker bridge for acquisition controls and both scored arms, supervise descendants and containers, authenticate every harness, runtime, dependency, image, and protocol input, and return only safe hashes and counts.","Framework integration, independent trust-boundary review, merge, and supported-host runtime conformance pass; historical Windows CI is evidence only, while the exposure inventory and official 10-control and 60-arm execution remain open.","2026-08-01"
|
| 36 |
"BENCH-035","production-graph-feature-benefit","As a product owner I can show whether the same coding agent implements real hidden features more effectively with CTX recommendations than without CTX.","A fresh frozen protocol assigns ten hidden feature tasks from ten repositories to identical baseline and CTX arms, counterbalances order, repeats pairs, keeps the evaluator secret, and reports verified quality, exact tokens, development time, errors, recommendations, and load/use/unload evidence without assuming CTX wins.","Needs Validation","CURRENT CANDIDATE: framework PR #253 merged as 0e9289e4 with all required checks green. The exact combined V2 suite passed 505/505 on framework code HEAD 547b80a5, exact-head preflight passed 19/19 on 78a003ac, and all independent review lanes returned MERGE. The official campaign remains NOT RUN: 0/10 controls, 0/30 pairs, and 0/60 arms; CTX benefit remains unproven.","For each frozen task run the same model, limits, commit, task text, evaluator, and authenticated environment in isolated baseline and CTX workspaces; execute three paired repetitions with a globally frozen 15/15 order; aggregate by repository and preserve every failure.","Small or cherry-picked tasks, different environments, leaked tests, parallel hardware contention, missing token attribution, outcome-informed reuse, or calling framework validation a product result could manufacture an apparent CTX advantage.","Use ten independent repositories, three paired repetitions per task, uncached provider tokens as the primary endpoint, development time excluding evaluator time as a secondary endpoint, quality non-inferiority, exact repository-level support, and a task-disjoint generation after any outcome-informed product fix.","Open until the complete exposure inventory, all ten controls, and 30 pairs complete with exact evidence, failures are classified, the result is independently reviewed, and the honest verdict is published. A valid not_beneficial result is final and must not be rerun or hidden.","2026-07-30"
|
| 37 |
"BENCH-036","official-v2-verdict-gates","As a benchmark reviewer I receive an official V2 verdict that cannot bypass the preregistered claim gates.","The authoritative official verdict is produced by the authenticated repository-level evaluator and requires the frozen primary token endpoint, at least nine benefiting repositories, the frozen overall token-ratio threshold, preserved quality, exact evidence, no unresolved incidents, and verified CTX delivery in all ten repositories; time-only improvement cannot pass.","Resolved","Commit 7b212141 routes official results through evaluate_repository_claim and publishes its gate results verbatim. Negative regressions reject time-only improvement and verified delivery in only nine repositories; the exact combined V2 suite passed 455/455 on HEAD 71f31993.","Construct ten repository rows with time ratio 0.80, token ratio 1.05, and verified delivery in only one repository; before the fix the generic OR-based summary could label the product beneficial, while the authenticated official evaluator now returns not_beneficial.","A favorable public verdict could contradict the frozen methodology and invalidate the confirmatory claim.","Replace the generic summary verdict for official runs with evaluate_repository_claim over authenticated repository rows, preserve every gate result in public evidence, and add negative regressions for time-only and incomplete-delivery cases.","Pass: the P0 bypass was independently reproduced, the authoritative-gate fix and regressions were reviewed, and exact-head framework integration is green; this does not claim that the official campaign has run or benefited CTX.","2026-07-30"
|
| 38 |
"BENCH-037","task-disjoint-protocol-generations","As a benchmark reviewer I can require a genuinely fresh holdout after any outcome-informed product or harness change.","Each protocol generation uses stable dataset-derived per-repository candidate ranking and selects candidate slot generation minus one; a restart either produces task-ID-disjoint choices in all ten repositories or fails closed and requires a new pinned universe.","Resolved","Commit cc1631c9 implements stable candidate partitions, candidate_slot = protocol_generation - 1, mutation rejection, and fail-closed cardinality. The methodology reviewer approved the focused 111-test evidence. The current pinned universe supports generation 1 only because 9/10 repositories have a second eligible candidate; generation 2 is therefore an intentional no-go.","Build generation 1 and generation 2 from a fixture with at least two eligible candidates per repository and compare task-ID sets, then remove one repository's second candidate or mutate the generation, seed, or slot; the first sets are disjoint and every invalid or undersupplied case is rejected.","Reusing observed tasks after a product or harness fix turns a confirmatory rerun into outcome-informed tuning and can bias the published result.","Bind generation to stable per-repository candidate slots and authenticate the complete design; after any outcome-informed fix, select a task-disjoint generation or preregister a new pinned universe when fresh cardinality is insufficient.","Pass: independent methodology review approved the task-disjoint-or-no-go design. Generation 1 remains eligible and NOT RUN; generation 2 is unavailable on the current universe by design.","2026-07-30"
|
| 39 |
"BENCH-038","authenticated-verdict-snapshots","As a benchmark reviewer I can trust that acquisition provenance and frozen verdict inputs cannot change after authentication.","The runner reconstructs the complete canonical acquisition protocol, verifies its digest and V1-derived design, retains authenticated immutable bytes for every frozen verdict input, and refuses reports or public summaries after any post-attestation drift.","Resolved","Commits fa5aa34d, 2c9b6d2b, and cd051cba authenticate canonical acquisition provenance and verdict snapshots. The independent security reviewer approved arbitrary-digest, claim-gate drift, canonical-byte, eight-input mutation, privacy, and module-invocation probes; the exact combined V2 suite passed 455/455 on HEAD 71f31993.","Supply an arbitrary acquisition digest or rehash altered claim gates, then mutate each of the eight frozen inputs after loading and request a performance report or public summary; every path is rejected before a verdict is emitted.","A forged predecessor digest or time-of-check/time-of-use mutation could produce a public verdict from unauthenticated methodology or hidden inputs.","Reconstruct and validate the canonical acquisition document, compare its canonical digest, retain authenticated bytes for all frozen artifacts, and reauthenticate snapshots at every verdict-producing boundary.","Pass: independent security review found no remaining issue in the trust-chain, post-attestation mutation, privacy, or CLI-import scope; the official campaign remains NOT RUN.","2026-07-30"
|
| 40 |
+
"BENCH-039","future-history-isolation","As a benchmark reviewer I can prove neither arm can inspect a future commit or gold fix from the selected repository.","Official controls and measured arms use the same authenticated offline source bundle containing the selected base commit closure, no descendant refs, no remote, and no unreachable future objects; the source-map bytes and every bundle hash are execution-frozen.","Needs Validation","Commits a3667925, e38518e7, and 65df2edb prepare, authenticate, consume, and independently revalidate exact base-closure bundles. A post-materialization future-gold bundle swap was reproduced, fixed, and independently rejected; the exact combined V2 suite passed 505/505 on code HEAD 547b80a5. Exact-head preflight then passed 19/19 on 78a003ac and PR #253 merged as 0e9289e4. HISTORICAL PLATFORM FACT: native Windows CI passed that prior candidate. No official task has been selected or run.","Create a fixture repository with a base commit followed by a future gold commit, prepare the official source artifact, clone each arm workspace, and require every ref, object, log, show, remote, and fsck probe to make the future commit inaccessible while preserving the exact base tree.","An agent can read the gold fix from local Git history, making quality, time, and token comparisons invalid even when hidden evaluator files remain private.","Retain only authenticated offline commit-closure bundles, freeze a canonical source map and bundle hashes, remove remotes after clone, and fail closed on any extra ref, unreachable object, commit, tree, or hash drift.","Implementation, adversarial tests, independent review, exact-head preflight, and merge pass on the supported contract; historical Windows CI is evidence only and authenticated live source preparation remains.","2026-08-01"
|
| 41 |
+
"BENCH-040","one-shot-campaign-guard","As a benchmark reviewer I can prove one frozen assignment set is measured by only one serial campaign on the host.","Official execution holds one host-wide exclusive lock for the complete campaign, independently validates frozen selection task/repository pairs against the executable scenario pack, atomically consumes their order-independent identity before measured model work, and records exact selection and execution-protocol identities as secondary fail-closed indexes, so another process, reordering, re-freeze, clone, or output path cannot overlap or replay measured assignments.","Needs Validation","The pre-launch audit first reproduced two distinct protocol digests consuming one selection on the merged framework. Independent review then reproduced reordered selection bytes producing another selection digest, a forged selection repository map producing another assignment digest for identical executable scenarios, and first-run multi-level state creation without syncing every new ancestor link. Commits 1f654635 and d4a0f8ab validate selection rules and exact scenario repositories before deriving the semantic identity, write assignment then selection then protocol indexes, fsync every verified directory/parent and each claim/containing directory even under concurrent publication, and add loader-level replay, permutation, concurrency, interruption, durability, privacy, permission, malformed-state, link-state, same-protocol, and cross-clone regressions. No official selection, protocol, assignment claim, or model outcome exists.","Claim an assignment set with selection/protocol A, then reorder or forge the selection map while retaining identical executable scenario pairs and rehash every linkage; race distinct protocols and missing hierarchy creators; inject interruption between indexes; start from a missing multi-level state base and observe every file and directory-entry fsync; every replay must fail before a model arm while one owner-only assignment record and at most one matching selection and protocol record remain.","Concurrent arms, unauthenticated semantic inputs, or byte-level reordering/re-freezing of one deterministic assignment set permits outcome-informed confirmatory reruns and invalidates timing and statistical evidence; an unsynced ancestor directory can lose every one-shot claim after a crash.","Validate fixed acquisition selection rules and exact task/repository agreement with the scenario pack, then use an owner-only persistent host lock plus an atomic semantic-assignment consumption index and exact selection/protocol secondary indexes; create and durably sync every state component and the assignment claim first, failing closed on existing, legacy, malformed, stale, aliased, mismatched, or partially written state.","Pass: five independent review cycles reproduced and closed every semantic and durability gap, ending APPROVE with no P0-P3 finding; the combined benchmark/prepare/tracker suite passed 309/309 plus Ruff, format, mypy, and diff checks; the exact committed fast gate passed all 8 lanes with 6,193 unit tests, and the activated-venv PR preflight passed all 16 steps. HISTORICAL PLATFORM FACT: native Windows CI passed before support removal. Merge to origin/main and the live one-shot campaign remain.","2026-08-01"
|
| 42 |
"BENCH-041","historical-exposure-ledger","As a benchmark reviewer I can prove every selected task is disjoint from all tasks previously shown to CTX, an LLM, or a benchmark arm.","Before ranking, selection authenticates a private canonical salted HMAC ledger, rejects every matching instance ID with explicit evidence, freezes the ledger digest into acquisition and execution protocols, and cannot proceed without the exact ledger.","Needs Validation","Commits 4b541eac, beaed567, a3667925, e38518e7, and 65df2edb bind the private HMAC ledger through selection, source preparation, controls, and freeze. Empty-ledger and overlap attacks were reproduced, fixed, and independently rejected; the exact combined V2 suite passed 505/505 and exact-head preflight passed 19/19 on 78a003ac. No V2 task was submitted to CTX or a model.","Construct a deterministic candidate set where the highest-ranked row is present in the authenticated exposure ledger; require explicit rejection and a disjoint replacement, then tamper, omit, reorder, duplicate, or swap the ledger and require fail-closed behavior.","A previously observed task allows outcome-informed tuning or memory effects and converts a confirmatory benchmark into contaminated reuse.","Build and merge a private hash-only historical ledger, authenticate exact canonical bytes, apply exclusion before all ranking/cardinality checks, and regenerate the first eligible ten-repository selection.","Implementation, independent privacy/methodology review, and exact-head preflight pass; the merged-main run must still combine all known private evidence sources and produce a fresh disjoint selection before controls.","2026-07-30"
|
| 43 |
+
"BENCH-042","merged-main-attestation","As a benchmark reviewer I can prove protocol creation and every measured arm use the exact clean commit published at origin/main.","The acquisition protocol freezes a credential-free origin URL and origin/main revision; protocol preparation, source preparation, startup, every arm, and final attestation require clean HEAD equal to that exact remote-tracking revision and reject drift.","Needs Validation","Commits a3667925, e38518e7, a562c443, 68d113c9, and 78a003ac authenticate origin URL, origin/main, HEAD, cleanliness, repository-state digest, and platform-native temporary-path rejection at preparation, startup, every arm, and final attestation. Exact-head preflight passed 19/19, PR #253 merged as 0e9289e4 with all required checks green, and a fresh detached worktree matched clean origin/main. Python 3.12.13 dependencies and the pinned Docker daemon passed conformance without revealing a task.","Create a clean unmerged commit, alter origin/main, change the origin URL, advance HEAD after startup, or place live scenarios under the platform temporary directory; protocol creation and each later boundary must fail before producing eligible evidence.","A clean feature branch, stale remote-tracking ref, or temporary scenario path can produce invalid or exposed evidence that appears reproducible.","Freeze sanitized remote identity and exact origin/main SHA, require HEAD equality after an authenticated fetch boundary, reject the platform temporary root, and recheck the same values before every arm and in final attestation.","Implementation, exact-head preflight, independent review, merge, and clean supported-host runtime conformance pass; historical Windows CI is evidence only and the authenticated exposure inventory remains required before selection.","2026-08-01"
|
| 44 |
+
"BENCH-043","preselected-descriptive-metrics","As a benchmark reviewer I receive a fixed, privacy-safe account of command, CTX funnel, lifecycle, and error evidence without changing the primary verdict after outcomes are known.","Before task selection, the runner freezes exact raw-to-aggregate definitions, retains all 60 assigned arms regardless of outcome, keeps unknown evidence missing, publishes only after the full authenticated campaign, and never feeds descriptive values into confirmatory gates.","Needs Validation","The descriptive-metrics-v1 contract and failing-first regressions cover completed shell-command calls, failures, UTF-8 output bytes, repeated commands, CTX recommendation/select/deliver/semantic-use counts, closed lifecycle events, timeouts, nonzero return codes, arm totals and medians, paired differences, four-cell binary pairs, partial-campaign withholding, duplicate rejection, sealed harness failures, primary-verdict invariance, and sentinel privacy. The official campaign remains NOT RUN: 0/10 controls, 0/30 pairs, and 0/60 arms.","Run the focused benchmark suite, mutate descriptive values while holding primary inputs fixed, inject malformed and private sentinel values, remove or duplicate an assignment, and inspect public-summary.json only after a complete 60-arm synthetic campaign.","Outcome filtering, zero-filling, calling command executions all tools, inferring semantic use from delivery, task-level publication, or post-outcome metric changes could manufacture an efficiency advantage.","Commit the versioned descriptive schema before selection; validate complete traces and closed lifecycles; report known and missing denominators; use fixed whole-arm and whole-campaign aggregates; enforce an allowlist-only public boundary; leave primary thresholds and verdict code unchanged.","Implementation tests pass locally; independent code and methodology review plus required CI remain before any task selection or production arm.","2026-08-01"
|
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
|
| 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","
|
| 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"
|
|
@@ -131,7 +131,7 @@ DOC-NAV-024,,docs/qa/feature-user-story-status.csv,Docs,Memory anchoring page,do
|
|
| 131 |
DOC-NAV-025,,docs/qa/feature-user-story-status.csv,Docs,Skill lifecycle and dashboard page,docs/skill-lifecycle-and-dashboard.md,mkdocs.yml nav,Medium,As a dashboard user I can understand skill lifecycle views,The page documents lifecycle states dashboard linkage and expected user workflows,Docs build environment available,python -m mkdocs build --strict --quiet plus tracker nav coverage test,Automated Test,Tested Pass,PASS: docs/skill-lifecycle-and-dashboard.md is present in mkdocs.yml nav; python -m mkdocs build --strict --quiet passed; tracker nav coverage test passed for this entrypoint.,,,,,,2026-06-29,Core/Docs Lane,Added for public MkDocs nav coverage enforcement.,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
|
| 132 |
DOC-NAV-026,,docs/qa/feature-user-story-status.csv,Docs,Skill-quality install page,docs/skill-quality-install.md,mkdocs.yml nav,Medium,As an installer I can understand skill quality install guidance,The page documents quality signals install decisions and user-visible expectations,Docs build environment available,python -m mkdocs build --strict --quiet plus tracker nav coverage test,Automated Test,Tested Pass,PASS: docs/skill-quality-install.md is present in mkdocs.yml nav; python -m mkdocs build --strict --quiet passed; tracker nav coverage test passed for this entrypoint.,,,,,,2026-06-29,Core/Docs Lane,Added for public MkDocs nav coverage enforcement.,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
|
| 133 |
DIST-001,,docs/qa/feature-user-story-status.csv,Distribution,GitHub About metadata,GitHub repository About,src/update_repo_stats.py,High,As a GitHub visitor I can understand ctx positioning and current counts from the repo About,About says ctx is a recommendation layer not a marketplace and uses shipped graph counts,GitHub CLI authenticated,python src/update_repo_stats.py --check-github-about,Manual/Documented,Retested Pass,PASS: GitHub About description is up to date on main 16c96b1.,,,,,PASS: GitHub About description is up to date on main 16c96b1.,2026-06-29,Telemetry/Release Lane,Revalidated after inventory wording merge with python src/update_repo_stats.py --check-github-about.,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
|
| 134 |
-
DIST-002,,docs/qa/feature-user-story-status.csv,Distribution,Main CI test workflow,.github/workflows/test.yml,.github/workflows/test.yml,High,As a contributor I can trust the required main test workflow,Main pushes run static unit canary package browser security telemetry and required aggregate gates
|
| 135 |
DIST-003,,docs/qa/feature-user-story-status.csv,Distribution,Docs deploy workflow,.github/workflows/docs.yml,.github/workflows/docs.yml,High,As a docs visitor I get the current public docs after main updates,Docs workflow builds strict MkDocs and deploys GitHub Pages without stale generated content,GitHub Pages enabled,gh run view 29021393673 and curl public docs URLs,Manual/Documented,Retested Pass,PASS: Deploy docs to GitHub Pages run 29021393673 for de646b52 succeeded and the generated README/docs stats check is up to date.,,,,,PASS: Deploy docs to GitHub Pages run 29021393673 for de646b52 succeeded and the generated README/docs stats check is up to date.,2026-07-11,Telemetry/Release Lane,Public docs reflect merged main at de646b52; the volatile test inventory remains generator-owned in README and docs/index.md.,Reviewed locally,Local standards/spec review confirmed the docs run and generator-owned stats evidence; prior docs-only no-mistakes run 01KWSY6H1BV17DK8G2CJKYB23W also reached checks-passed and merged.,Ponytail: keep volatile counts in generated files instead of duplicating them in tracker prose.,README/docs stats check passes; numeric inventory is intentionally generator-owned
|
| 136 |
DIST-004,,docs/qa/feature-user-story-status.csv,Distribution,Hugging Face sync workflow,.github/workflows/huggingface-sync.yml,.github/workflows/huggingface-sync.yml and scripts/sync_huggingface.py,Critical,As a Hugging Face visitor I get the same tracked repo and graph artifacts as GitHub,Workflow hydrates graph artifacts from matching release assets or size-capped targeted LFS for full publishes while refusing stale README/docs stats and limiting card-only sync to README/CHANGELOG/docs inputs,Valid write-scoped HF_TOKEN configured in GitHub secrets,GitHub Actions Sync Hugging Face workflow on main,Automated Test,Blocked/Human Decision,FAIL: main Sync Hugging Face workflow run 28340695227 for 16c96b1 failed after README/docs stats and graph artifact hydration passed; upload to https://huggingface.co/api/datasets/Stevesolun/ctx/preupload/main returned 401 Unauthorized / Invalid username or password.,CTX-CICD-001,Post-exposure HF_TOKEN rotation remains open after successful sync proof,GitHub Actions Sync Hugging Face workflow on main,"Replace and revoke the token that was exposed during incident handling, update GitHub HF_TOKEN, then rerun the Sync Hugging Face workflow.","PASS: workflow_dispatch Sync Hugging Face run 28362276544 proved the replacement secret could publish the dataset at that time; current repo stats are enforced separately by update_repo_stats.py and PR #239 refreshed GitHub docs to 4,473 inventory.",2026-07-05,Human Owner,"Successful run proved the replacement secret worked, but the exposed credential still requires another rotation before this row can pass; workflow classifier now full-syncs source test and workflow changes.",Human-owned blocker reviewed,Imported from docs/qa/feature-user-story-status.csv; supporting status now matches canonical Blocked/Human Decision.,Human decision: HF_TOKEN rotation is intentionally out of scope for the agent.,Out of scope human-owned blocker; no-mistakes not applicable until token rotation is confirmed
|
| 137 |
DIST-005,,docs/qa/feature-user-story-status.csv,Distribution,Clean host contract workflow,.github/workflows/clean-host-contract.yml,.github/workflows/clean-host-contract.yml,High,As a new installer I can verify ctx works on a clean host,Workflow installs the package in a clean environment and runs the clean-host smoke contract,GitHub Actions available,gh run view 28340695216,Automated Test,Retested Pass,PASS: Clean host contract job 83954561453 passed inside main Tests run 28340695216 for 16c96b1.,,,,,PASS: Clean host contract job 83954561453 passed inside main Tests run 28340695216 for 16c96b1.,2026-06-29,Telemetry/Release Lane,Revalidated through the current required main workflow after the inventory wording merge.,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
|
|
@@ -143,9 +143,9 @@ SEC-001,DIST-004,docs/qa/feature-user-story-status.csv,Distribution,Hugging Face
|
|
| 143 |
SEC-002,,docs/qa/feature-user-story-status.csv,Distribution,No-mistakes development gate,no-mistakes axi run,imported-skills/no-mistakes and no-mistakes binary,High,As a maintainer I can gate feature branches through no-mistakes before merge,The no-mistakes pipeline runs intent rebase review test docs lint push PR and CI before changes reach main,Feature branch with committed changes,no-mistakes axi run --intent tracker-governance-change,Automated Test,Tested Pass,no-mistakes run 01KW9N9RP1F7N9T593164EPZY6 reached checks-passed and PR #206 merged after CI success.,,,,,,2026-06-29,Telemetry/Release Lane,Tracks the required development-process gate requested for enterprise readiness.,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
|
| 144 |
MAINT-001,,docs/qa/feature-user-story-status.csv,Maintainer,Backup snapshot audit,scripts/audit_backup.py,scripts/audit_backup.py,Medium,As a maintainer I can inspect backup snapshots for missing expected files,Script summarizes backup contents while accepting --help without snapshot access and flags missing graph/wiki/report artifacts without mutating the repo,Backup fixture available,python scripts/audit_backup.py --help; run script against representative backup fixture,Manual/Documented,Retested Pass,PASS: --help printed usage without touching snapshot files; temp backup fixture with BOM manifest printed entries and OK coverage; focused pytest passed.,CTX-AZ-008; CTX-QA-034,Backup audit previously rejected UTF-8 BOM manifests and treated --help as a snapshot path,python scripts/audit_backup.py --help; run script against representative backup fixture,Fixed by utf-8-sig manifest reads and snapshot-free help parsing in PR #210,PASS: /tmp/ctx-verify-venv/bin/python scripts/audit_backup.py --help; focused pytest 62 passed 1 skipped; no-mistakes run 01KWFXQTHJ83VNZ9ZJGMTAJPWC checks-passed.,2026-07-02,Core/Docs Lane,Read-only reporting; --help is snapshot-free and does not repair backup gaps.,Reviewed by no-mistakes,Run 01KWFXQTHJ83VNZ9ZJGMTAJPWC reported no findings; PR #210 merged as c61de902e8fdd2a4b2cfa061c5337a2fef078d0a.,Ponytail: minimal fix only; no behavior expansion beyond help handling.,Validated by completed goal-loop and no-mistakes gate
|
| 145 |
MAINT-002,,docs/qa/feature-user-story-status.csv,Maintainer,Dashboard graph index builder,scripts/build_dashboard_graph_index.py,scripts/build_dashboard_graph_index.py,Medium,As a dashboard user I get fast graph search and neighborhoods,Script builds the dashboard SQLite/index artifacts from graph exports for fast monitor reads,Graph fixture available,Run script against small graph fixture and query resulting index,Manual/Documented,Retested Pass,FAIL: BOM-prefixed graph.json from PowerShell Set-Content -Encoding UTF8 raised JSONDecodeError.,CTX-AZ-008,Dashboard graph index builder read graph JSON with utf-8 and rejected common Windows BOM input,Run script against small graph fixture and query resulting index,Fixed by reading graph JSON with utf-8-sig,PASS: temp graph fixture built SQLite index with 2 nodes and neighbor mcp-server:github; regression pytest passed.,2026-06-23,Core/Docs Lane,,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
|
| 146 |
-
MAINT-003,,docs/qa/feature-user-story-status.csv,Maintainer,CI change classifier,scripts/ci_classifier.py,scripts/ci_classifier.py and .github/workflows/test.yml,Medium,As a contributor I get the right CI gates for the files I changed,Classifier marks docs graph source package browser similarity telemetry
|
| 147 |
MAINT-004,,docs/qa/feature-user-story-status.csv,Maintainer,No-test policy gate,scripts/ci_no_test_policy.py,scripts/ci_no_test_policy.py and .github/workflows/test.yml,Medium,As a reviewer I can reject risky code or workflow changes without test updates,Policy fails contract changes including release sync and graph artifact maintainer scripts that omit matching tests while allowing proven metadata-only releases or maintainer-applied no-tests-needed labels for genuinely untestable changes,CI policy tests available,python -m pytest src/tests/test_ci_classifier.py src/tests/test_ci_preflight.py -q,Automated Test,Tested Pass,CI policy and preflight suites cover contract files release metadata exceptions no-tests-needed label exemptions and rejection when diff context is missing.,,,,,,2026-07-05,Core/Docs Lane,Validated after preflight started passing real per-file diffs to the policy helper and after maintainer script contract coverage expanded.,Reviewed by no-mistakes,Documentation sync verified against current policy behavior.,Ponytail: release metadata exemptions require actual diff evidence and maintainer script changes require tests unless a maintainer applies no-tests-needed.,Validated by focused policy and preflight regressions
|
| 148 |
-
MAINT-005,,docs/qa/feature-user-story-status.csv,Maintainer,Required CI aggregate,scripts/ci_required.py,scripts/ci_required.py and .github/workflows/test.yml,Medium,As a branch maintainer I can trust the required CI summary,Aggregate rejects failed missing or wrongly skipped required jobs
|
| 149 |
MAINT-006,,docs/qa/feature-user-story-status.csv,Maintainer,CI preflight gate,scripts/ci_preflight.py,scripts/ci_preflight.py scripts/ci_classifier.py and scripts/local_fast_gate.py,Medium,As a contributor I can run the same preflight logic locally that CI uses,"Preflight classifies changes then emits source static gates (ruff format/check, ruff lint, mypy, pip check), public docs tracker including bug-smoke, feature, dashboard, and toolbox coverage, strict build, graph, browser, package, and similarity gates required; local-fast groups those same checks into isolated parallel worktree lanes before the serial gate",Repo checkout with git available,Run scripts/ci_preflight.py against representative changed files; run scripts/no_mistakes_run.sh fast before PR validation,CI/CD Gate,Tested Pass,"select_checks and workflow parity coverage confirm the public docs tracker includes bug-smoke, feature, dashboard, and toolbox checks before strict MkDocs build; local_fast_gate grouping coverage confirms graph hydration stays with graph validation and source changes split across independent lanes.",,,,,,2026-07-06,Core/Docs Lane,Validated through focused preflight tests and the first real local-fast run which exposed missing tracker coverage before the final serial gate.,Reviewed by no-mistakes,Documentation sync verified against current preflight docs-check coverage and local-fast grouping behavior.,Ponytail: public tracker coverage matches PR docs workflow while local-fast only parallelizes existing checks.,Validated by focused preflight regression and local-fast dry run
|
| 150 |
MAINT-007,,docs/qa/feature-user-story-status.csv,Maintainer,Clean host contract script,scripts/clean_host_contract.py,scripts/clean_host_contract.py and .github/workflows/clean-host-contract.yml,Medium,As a new installer I can smoke ctx on a clean host,Script builds a clean venv installs ctx and runs init scan harness and monitor checks,Network and clean temp venv available,GitHub clean-host contract or local script smoke,Automated Test,Tested Pass,Clean host contract job passed inside PR #195 required checks.,,,,,,2026-06-23,Core/Docs Lane,Workflow evidence covers the script path.,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
|
| 151 |
MAINT-008,,docs/qa/feature-user-story-status.csv,Maintainer,Dashboard smoke script,scripts/dashboard_smoke.py,scripts/dashboard_smoke.py,Medium,As a maintainer I can smoke a running monitor before release,Script probes an already running ctx-monitor base URL and checks key pages/APIs with optional warmup,Monitor running or fake HTTP fixture available,python -m pytest src/tests/test_dashboard_smoke.py -q,Automated Test,Tested Pass,Dashboard smoke test suite covers route probing warmup and failure reporting for a supplied base URL.,,,,,,2026-06-29,Core/Docs Lane,Corrected wording from starts-or-probes to probes-running-monitor; ctx-monitor startup is tracked separately by CLI-042.,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
|
|
@@ -157,7 +157,7 @@ MAINT-013,,docs/qa/feature-user-story-status.csv,Maintainer,Hugging Face sync sc
|
|
| 157 |
MAINT-014,,docs/qa/feature-user-story-status.csv,Maintainer,Similarity threshold tuner,scripts/tune_similarity_thresholds.py,scripts/tune_similarity_thresholds.py,High,As a graph maintainer I can calibrate similarity thresholds against fixtures,Tuner prints help without loading the embedding model and sweeps threshold settings with precision/recall/F1 output without mutating graph artifacts,Similarity fixture corpus available,python scripts/tune_similarity_thresholds.py --help; run tuner against fixture corpus,Manual/Documented,Retested Pass,"PASS: --help printed usage without loading the embedder; focused pytest passed; tuner prints precision, recall, F1, and confusion counts.",CTX-QA-035,Similarity tuner --help previously loaded the embedding backend and could fail before usage output,python scripts/tune_similarity_thresholds.py --help,Fixed by model-free help handling and F1 metric reporting in PR #210,PASS: /tmp/ctx-verify-venv/bin/python scripts/tune_similarity_thresholds.py --help; focused pytest 62 passed 1 skipped; GitHub Similarity precision/recall passed.,2026-07-02,Core/Docs Lane,Full sweep still depends on embedding backend availability; --help stays model-free and CI covers fixture precision/recall/F1.,Reviewed by no-mistakes,Run 01KWFXQTHJ83VNZ9ZJGMTAJPWC reported no findings; PR #210 merged as c61de902e8fdd2a4b2cfa061c5337a2fef078d0a.,Ponytail: minimal fix only; no behavior expansion beyond help/F1 reporting.,Validated by completed goal-loop and no-mistakes gate
|
| 158 |
PUBLIC-001,,docs/qa/feature-user-story-status.csv,Docs,Public catalog search JavaScript,docs/assets/javascripts/catalog.js,docs/assets/javascripts/catalog.js and docs/catalog.md,Medium,As a GitHub Pages visitor I can filter catalog tiles without a local dashboard,JavaScript wires input and checkbox filters and updates visible catalog cards/counts client-side,Docs assets available,python -m pytest src/tests/test_docs_catalog_page.py -q,Automated Test,Tested Pass,Docs catalog page tests verify script inclusion input listener and public non-local links.,,,,,,2026-06-23,Core/Docs Lane,Validated by focused pytest in this tracker slice.,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
|
| 159 |
PUBLIC-002,,docs/qa/feature-user-story-status.csv,Docs,Public repo stats refresh JavaScript,docs/assets/javascripts/repo-stats-refresh.js,docs/assets/javascripts/repo-stats-refresh.js and mkdocs.yml,Medium,As a docs visitor I see current repo stats when GitHub allows client refresh,JavaScript is included by MkDocs and degrades safely when live repo stats cannot be fetched,Docs assets available,python -m pytest src/tests/test_docs_repo_stats.py -q,Automated Test,Tested Pass,Docs repo stats tests verify MkDocs includes the script and the script has the expected refresh behavior.,,,,,,2026-06-23,Core/Docs Lane,Validated by focused pytest in this tracker slice.,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
|
| 160 |
-
PUBLIC-003,,docs/qa/feature-user-story-status.csv,Docs,Backup watchdog service manifests,"docs/services/systemd/claude-backup-watchdog.service, docs/services/macos/com.claude.backup.watchdog.plist
|
| 161 |
PUBLIC-004,,docs/qa/feature-user-story-status.csv,Docs,Starter toolbox template JSON,"docs/toolbox/templates/docs-review.json, docs/toolbox/templates/fresh-repo-init.json, docs/toolbox/templates/refactor-safety.json, docs/toolbox/templates/security-sweep.json, docs/toolbox/templates/ship-it.json","docs/toolbox/templates, docs/toolbox/starters.md, src/toolbox.py",Medium,As a toolbox user I can rely on public starter template JSON matching ctx-toolbox init behavior,Public starter JSON files remain in sync with embedded wheel fallback templates so docs checkout users and PyPI users seed the same starter toolboxes,Docs template assets available,python -m pytest src/tests/test_toolbox_cli.py -q,Automated Test,Tested Pass,Toolbox CLI regression compares docs/toolbox/templates JSON to the embedded fallback path used when templates are absent from installed wheels.,,,,,,2026-06-29,Core/Docs Lane,Added for public starter preset assets referenced from starter toolbox docs.,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
|
| 162 |
DASH-PAGE-001,DASH-001,docs/qa/dashboard-user-story-status.csv,Dashboard Page,Home,/,src/ctx/monitor/pages/home.py,High,As a dashboard user I can open the monitor home page,Home renders current graph stats loaded counts quick actions and health summaries without blocking on full graph parsing,ctx-monitor running,Open / and inspect cards links and number formatting,Browser/User Story,Tested Pass,"PASS: live Playwright page probe opened /, found expected page markers, and detected no traceback or server-error text; dashboard_smoke also returned HTTP 200.",,,,,,2026-06-25,Dashboard/Docs Lane,Deeper controls are tracked in dedicated function/API/mutation rows.,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
|
| 163 |
DASH-PAGE-002,DASH-002,docs/qa/dashboard-user-story-status.csv,Dashboard Page,Loaded,/loaded,src/ctx/monitor/pages/loaded.py,High,As a dashboard user I can see currently loaded skills agents and MCPs,Loaded page renders active entity state and exposes safe load or unload actions where allowed,ctx-monitor running with manifest data,Open /loaded and verify cards pagination and actions,Browser/User Story,Tested Pass,"PASS: live Playwright page probe opened /loaded, found expected page markers, and detected no traceback or server-error text; dashboard_smoke also returned HTTP 200.",,,,,,2026-06-25,Dashboard/Docs Lane,Deeper controls are tracked in dedicated function/API/mutation rows.,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
|
|
@@ -214,7 +214,7 @@ B-API-005,PYAPI-001,expert-lane/api-mcp-harness,Python API,Catalog API,list_all_
|
|
| 214 |
B-API-006,PYAPI-001,expert-lane/api-mcp-harness,Python API,Privacy telemetry wrapper,ctx.api _call telemetry wrapper,src/ctx/api.py,High,"As maintainers, we can observe API use without leaking prompts.","API telemetry hashes raw query, slug, and seeds and records route, status, and error class.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_recommendation_surfaces_golden.py src/tests/test_enterprise_telemetry.py,Automated Test,Tested Pass,"PASS: privacy-safe API telemetry covered by test_public_api.py, test_harness_ctx_core.py, test_recommendation_surfaces_golden.py, and test_enterprise_telemetry.py in API/MCP slice -> 383 passed, 1 skipped.",,,,,"PASS: API/MCP validation slice on 2026-07-01: 383 passed, 1 opt-in live MCP skip; harness recommendation slice: 15 passed; explicit live MCP compatibility check: 8 passed, 1 opt-in skip.",2026-07-01,Telemetry/Release Lane,No raw args in telemetry by design; debugging needs local reproduction.,Reviewed by no-mistakes,no-mistakes run 01KWF5NJXTAFH6FVTR96PS2B2B reached checks-passed on PR #210 before this tracker slice; OpenCodeReview LLM endpoint remains unavailable.,"Ponytail: validate first, then make the smallest behavior-preserving fix only if the repro is confirmed.",Validated by completed goal-loop and no-mistakes gate
|
| 215 |
B-MCP-001,CLI-024,expert-lane/api-mcp-harness,MCP/Core Tools,Standalone MCP discovery,ctx-mcp-server initialize/tools/list,src/ctx/mcp_server/server.py; src/ctx/mcp_server/__init__.py,High,"As an MCP host, I can discover ctx tools.",The JSON-RPC stdio server initializes and lists ctx tool schemas.,Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_mcp_server.py,Automated Test,Tested Pass,"PASS: standalone MCP discovery covered by test_mcp_server.py in API/MCP slice -> 383 passed, 1 skipped.",,,,,"PASS: API/MCP validation slice on 2026-07-01: 383 passed, 1 opt-in live MCP skip; harness recommendation slice: 15 passed; explicit live MCP compatibility check: 8 passed, 1 opt-in skip.",2026-07-01,API/MCP Lane,No MCP resources/prompts/progress/logging yet.,Reviewed by no-mistakes,no-mistakes run 01KWF5NJXTAFH6FVTR96PS2B2B reached checks-passed on PR #210 before this tracker slice; OpenCodeReview LLM endpoint remains unavailable.,"Ponytail: validate first, then make the smallest behavior-preserving fix only if the repro is confirmed.",Validated by completed goal-loop and no-mistakes gate
|
| 216 |
B-MCP-002,CLI-024,expert-lane/api-mcp-harness,MCP/Core Tools,Standalone MCP tool calls,tools/call ctx__*,src/ctx/mcp_server/server.py; src/ctx/adapters/generic/ctx_core_tools.py,High,"As an MCP host, I can call ctx capabilities.","The server validates arguments, dispatches shared toolbox tools, and returns JSON text with isError status.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_mcp_server.py src/tests/test_harness_ctx_core.py,Automated Test,Tested Pass,"PASS: standalone MCP tool calls covered by test_mcp_server.py and test_harness_ctx_core.py in API/MCP slice -> 383 passed, 1 skipped.",,,,,"PASS: API/MCP validation slice on 2026-07-01: 383 passed, 1 opt-in live MCP skip; harness recommendation slice: 15 passed; explicit live MCP compatibility check: 8 passed, 1 opt-in skip.",2026-07-01,API/MCP Lane,"Tool responses are text-wrapped JSON, not typed resource payloads.",Reviewed by no-mistakes,no-mistakes run 01KWF5NJXTAFH6FVTR96PS2B2B reached checks-passed on PR #210 before this tracker slice; OpenCodeReview LLM endpoint remains unavailable.,"Ponytail: validate first, then make the smallest behavior-preserving fix only if the repro is confirmed.",Validated by completed goal-loop and no-mistakes gate
|
| 217 |
-
B-MCP-003,MCP-003,expert-lane/api-mcp-harness,MCP Router,Generic harness MCP router,ctx run --mcp / McpRouter,src/ctx/adapters/generic/tools/mcp_router.py; src/ctx/cli/run.py; src/ctx/adapters/generic/tools/__init__.py,High,"As ctx run, I can connect external MCP tools.","The router spawns configured stdio servers, namespaces tools, routes calls, expands nonsecret env placeholders, blocks sensitive argv placeholder expansion by default with trusted opt-in, redacts literal credential env values and diagnostics, emits client-side external tool telemetry, and propagates W3C traceparent metadata to MCP servers.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_mcp_router.py src/tests/test_enterprise_telemetry.py,Automated Test,Needs Validation,"PASS LOCAL: commit 51c845d2 rejects unpublished MCP tools before RPC; lazy selective activation, schema revocation, process-tree cleanup, failed-reap retention, and hashed lifecycle events are implemented.
|
| 218 |
B-MCP-004,CLI-017,expert-lane/api-mcp-harness,MCP/Core Tools,Claude MCP install adapter,ctx-mcp-install/uninstall,src/ctx/adapters/claude_code/install/mcp_install.py,High,"As a Claude Code user, I can install catalog MCP servers.",The installer requires catalog slug plus safe argv/json command and calls claude mcp add/remove.,Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_mcp_install.py,Automated Test,Tested Pass,"PASS: Claude MCP install/uninstall adapter covered by test_mcp_install.py in API/MCP slice -> 383 passed, 1 skipped.",,,,,"PASS: API/MCP validation slice on 2026-07-01: 383 passed, 1 opt-in live MCP skip; harness recommendation slice: 15 passed; explicit live MCP compatibility check: 8 passed, 1 opt-in skip.",2026-07-01,API/MCP Lane,Command allowlist is conservative; real Claude CLI behavior needs host integration.,Reviewed by no-mistakes,no-mistakes run 01KWF5NJXTAFH6FVTR96PS2B2B reached checks-passed on PR #210 before this tracker slice; OpenCodeReview LLM endpoint remains unavailable.,"Ponytail: validate first, then make the smallest behavior-preserving fix only if the repro is confirmed.",Validated by completed goal-loop and no-mistakes gate
|
| 219 |
B-HAR-001,CLI-001,expert-lane/api-mcp-harness,Harness,Agent-loop run command,ctx run,src/ctx/cli/run.py; src/ctx/adapters/generic/adaptive_runtime.py; src/ctx/adapters/generic/loop.py; src/tests/test_adaptive_runtime.py; src/tests/test_harness_cli_run.py; src/tests/test_harness_loop.py,High,"As a user, I can run an agent loop with ctx guidance without paying recurring discovery or irrelevant-tool costs.","ctx run defaults to a graph-free adaptive host path with zero CTX schemas; it may select one strongly matched skill from trusted user/configured roots for one request within 50 ms, 128-entry, 8 KB, and 2000-estimated-token limits; selected material is merged into the request copy at user authority and removed after that provider request; unsupported secure reads abstain without restoring schemas; explicit MCP catalogues defer adaptive injection; evaluator success reports complete usage and failed orchestration marks completed-generator usage partial.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q --no-cov src/tests/test_adaptive_runtime.py src/tests/test_harness_cli_run.py src/tests/test_harness_loop.py,Automated Test,Needs Validation,"PASS FOCUSED: 198 adaptive/CLI/loop tests cover one-request bounded skill context, zero-schema fallback, strict ordering, evaluator usage, and cleanup preservation. PASS ENGINE: commit 89d7fad2 and 53 benchmark tests cover shipped production-ctx-run exact usage local-provider parity applied lifecycle ordering and fail-closed claim gating.",AUDIT-018; BENCH-008; BENCH-021,"The default overhead, unsafe replay, trust boundary, usage accounting, production engine, and local lifecycle validation defects are fixed; real-provider paired KPI and lifecycle evidence remain unverified.","Run six counterbalanced production-ctx-run baseline and ctx-light pairs then inspect every provider request, exact usage, applied lifecycle, final empty state, quality, and wall time.",Default overhead authority accounting and production engine fixed; real-provider KPI validation pending,"PASS: 198 adaptive/CLI/loop tests and 53 production benchmark tests validate bounded context, capability isolation, exact local-provider usage, applied lifecycle ordering, cleanup, and fail-closed evidence; six paired real-provider runs remain pending.",2026-07-26,Runtime/API/MCP Lane,"Bounded one-request skill context, lazy MCP activation, published-tool enforcement, applied-only lifecycle state, bounded agents, truthful usage, and the production engine are implemented. Real-provider KPI, lifecycle, and catalog-validity evidence remain open.",Approved locally; real-provider lifecycle/A-B pending,"Focused reviewers accepted the runtime boundaries and production engine; six real-provider baseline-versus-adaptive pairs remain required before an efficiency claim.","Ponytail: keep recurring CTX schemas and graph lookup off the default path, fail closed on unsafe local skills, lend one bounded skill for one request, and validate the shipped engine with exact evidence.",Focused runtime and production-engine regressions pass; fresh full integration and six real-provider KPI/lifecycle pairs remain pending
|
| 220 |
B-HAR-002,CLI-001,expert-lane/api-mcp-harness,Harness,Session resume/list commands,ctx resume/sessions,src/ctx/cli/run.py; src/ctx/adapters/generic/state.py,High,"As a user, I can resume or inspect agent sessions.","ctx resume replays JSONL messages, repairs unresolved tool tails, lists session summaries, emits failed ctx.cli.resume telemetry for early failures, and includes previous trace correlation when available.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_harness_cli_run.py src/tests/test_harness_state.py,Automated Test,Retested Pass,"PASS: ctx resume telemetry regressions cover previous_trace_id payloads, failed resume spans, redacted errors, and lifecycle child spans.",AUDIT-018,Early ctx resume failures and resumed sessions lacked reliable previous trace correlation telemetry.,Resume a recorded session or trigger resume load/attach/missing-model failures before the fix and inspect ctx.cli.resume telemetry payloads.,Fixed,PASS: .venv/bin/pytest src/tests/test_harness_cli_run.py -q --tb=short -> 73 passed.,2026-07-05,CLI Lane,Updated after CLI resume trace correlation fix.,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: report existing resume failure and previous trace metadata without restoring unsafe MCP metadata by default.,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.
|
|
@@ -257,11 +257,11 @@ LANE-D-010,DASH-API-011,expert-lane/telemetry-release-governance,Governance,Moni
|
|
| 257 |
LANE-D-011,CLI-045,expert-lane/telemetry-release-governance,Retention,Backup config privacy exclusions,backup_config.from_ctx_config,src/backup_config.py; src/config.json; docs/backup-hook-install.md,High,"As a user, I can back up ctx state while excluding credentials and invalid paths.",Backup config validates tracked files trees and top-level top_files names and always excludes credentials/auth caches.,Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_backup_mirror.py src/tests/test_backup_retention.py,Automated Test,Retested Pass,"PASS: backup config tests validate privacy exclusions, tracked file/tree filtering, malformed config fallback, and credential/auth-cache exclusion.",,,,,PASS: /tmp/ctx-verify-venv/bin/python -m pytest -q --no-cov src/tests/test_backup_config.py src/tests/test_backup_mirror.py src/tests/test_backup_retention.py src/tests/test_backup_watchdog.py -> 91 passed in 1.65s.,2026-07-02,Telemetry/Release Lane,User overrides are ignored on malformed config by design; unsafe top_files override entries are skipped with a warning.,Reviewed by no-mistakes,Focused source/test/docs read plus integration validation; no behavior fix required.,Ponytail: top_files filename validation only; no backup scope expansion.,Validated by completed goal-loop and no-mistakes gate
|
| 258 |
LANE-D-012,CLI-045,expert-lane/telemetry-release-governance,Retention,Backup mirror/hook/watchdog,backup_on_change.py; backup_mirror snapshot-if-changed/watchdog/prune,hooks/backup_on_change.py; src/backup_mirror.py; src/change_detector.py; src/backup_watchdog.py,High,"As a user, I can automatically snapshot changed ctx/Claude state.","Backups use exclusion and size-aware SHA-gated snapshots, safe restore/prune including legacy keep dry-run, non-blocking hooks, and tolerant watchdogs.",Repo checkout with Python 3.11+ dev environment.,.venv/bin/python -m pytest -q --no-cov src/tests/test_change_detector.py src/tests/test_change_detector_exclusions.py src/tests/test_backup_config.py src/tests/test_backup_mirror.py,Automated Test,Retested Pass,PASS: capture and detector parity passes main and independent focused suites including repeated-snapshot suppression.,AUDIT-070,Detector previously observed excluded historical and oversized top files that capture did not persist.,Exercise exclusion baseline and size-limited file sets across repeated snapshot-if-changed calls.,Fixed,PASS: reviewer found no P1 P2 or P3 and confirmed normal removals plus exact-limit files remain visible.,2026-07-16,Telemetry/Release Lane,Hooks remain nonblocking and change detection now compares the same persisted set as capture.,Approved by independent expert,Current baseline tree memory and top-file boundaries were independently validated.,Ponytail: capture-equivalent exclusion and size predicates.,Retested and independently approved in current audit phase
|
| 259 |
LANE-D-013,CLI-045,expert-lane/telemetry-release-governance,Retention,Backup retention policy,backup_retention.plan_prune; backup_mirror prune --policy,src/backup_retention.py; src/backup_mirror.py; docs/backup-hook-install.md,Medium,"As a user, I can keep recent/daily backups without unbounded growth.","Retention keeps the union of keep_latest and keep_daily, protects undated snapshots, and supports dry-run JSON.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_backup_retention.py src/tests/test_backup_mirror.py,Automated Test,Retested Pass,"PASS: backup retention tests validate keep_latest/keep_daily union, undated snapshot protection, prune policy, and dry-run JSON behavior.",,,,,"PASS: backup validation slice reported 91 passed in 1.65s; all-remaining integration suite reported 603 passed, 2 skipped.",2026-07-02,Telemetry/Release Lane,Retention requires policy invocation or snapshot auto-prune.,Reviewed by no-mistakes,Focused source/test/docs read plus integration validation; no behavior fix required.,Ponytail: no fix needed; validation-only row update.,Validated by completed goal-loop and no-mistakes gate
|
| 260 |
-
LANE-D-014,MAINT-003,expert-lane/telemetry-release-governance,CI/CD,Path classifier,scripts/ci_classifier.py,scripts/ci_classifier.py; .github/workflows/test.yml,High,"As a maintainer, I can run only relevant CI while keeping sensitive gates conservative.","Classifier identifies telemetry graph package docs browser source similarity
|
| 261 |
-
LANE-D-015,MAINT-005,expert-lane/telemetry-release-governance,CI/CD,Required CI aggregator,scripts/ci_required.py,scripts/ci_required.py; .github/workflows/test.yml,High,"As a maintainer, I can get one stable required check for branch protection.",Aggregator rejects failed or
|
| 262 |
LANE-D-016,MAINT-004,expert-lane/telemetry-release-governance,Governance,No-test policy,scripts/ci_no_test_policy.py,scripts/ci_no_test_policy.py; .github/workflows/test.yml,High,"As a reviewer, I can require tests for contract-affecting changes.",Policy requires tests for contract paths including release sync and graph artifact maintainer scripts unless labeled/metadata-only exceptions apply.,Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_ci_classifier.py,Automated Test,Retested Pass,PASS: no-test policy help and no-change invocation worked; tests cover workflow contract-file rejection and release-metadata exceptions.,,,,,PASS: /tmp/ctx-verify-venv/bin/python scripts/ci_no_test_policy.py --base origin/main --head HEAD --labels-json '[]'; pytest 67 passed.,2026-07-02,Telemetry/Release Lane,Exceptions remain covered by focused policy tests and maintainer script paths are contract files.,Reviewed by no-mistakes,Focused script read plus CLI and pytest validation; no behavior fix required.,Ponytail: maintainer script contract coverage only.,Validated by completed goal-loop and no-mistakes gate
|
| 263 |
LANE-D-017,MAINT-006,expert-lane/telemetry-release-governance,CI/CD,Local preflight,scripts/ci_preflight.py,scripts/ci_preflight.py,High,"As a contributor, I can reproduce CI selection locally.","Preflight runs selected static, unit, docs, graph, browser, package, and telemetry checks from classifier output.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_ci_preflight.py,Automated Test,Retested Pass,PASS: dry-run printed baseline PR checks; select_checks for workflow changes selected static/unit/canary/clean-host/telemetry/similarity/browser/package gates.,,,,,PASS: /tmp/ctx-verify-venv/bin/python scripts/ci_preflight.py --dry-run --base origin/main --profile pr --python /tmp/ctx-verify-venv/bin/python; pytest 67 passed.,2026-07-02,Telemetry/Release Lane,Requires local Python/test tooling for non-dry-run execution.,Reviewed by no-mistakes,Focused script read plus dry-run/API and pytest validation; no behavior fix required.,Ponytail: no fix needed; validation-only row update.,Validated by completed goal-loop and no-mistakes gate
|
| 264 |
-
LANE-D-018,DIST-002,expert-lane/telemetry-release-governance,CI/CD,Main test workflow,.github/workflows/test.yml,.github/workflows/test.yml; scripts/ci_*.py,High,"As a maintainer, I can gate PRs and pushes across static unit graph browser package telemetry clean-host and targeted platform checks.","Workflow is path-aware and includes coverage artifacts required aggregation no-test enforcement a
|
| 265 |
LANE-D-019,DIST-002,expert-lane/telemetry-release-governance,Telemetry,Telemetry enterprise CI gate,telemetry-enterprise job,.github/workflows/test.yml; src/tests/test_enterprise_telemetry.py,High,"As an enterprise maintainer, I can prevent telemetry/privacy regressions.",The telemetry enterprise job runs enterprise telemetry and focused harness telemetry tests for telemetry changes or pushes.,Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_ci_classifier.py src/tests/test_enterprise_telemetry.py,Automated Test,Retested Pass,PASS: telemetry-enterprise workflow/test evidence reviewed; focused telemetry/harness slice passed 67 selected tests with 65 deselected.,,,,,"PASS: /tmp/ctx-verify-venv/bin/python -m pytest -q --no-cov src/tests/test_enterprise_telemetry.py src/tests/test_harness_cli_run.py -k 'telemetry or runtime_lifecycle' -> 67 passed, 65 deselected in 0.69s.",2026-07-02,Telemetry/Release Lane,Gate is path-classifier dependent on PRs.,Reviewed by no-mistakes,Focused workflow/test read plus pytest validation; no behavior fix required.,Ponytail: no fix needed; validation-only row update.,Validated by completed goal-loop and no-mistakes gate
|
| 266 |
LANE-D-020,DIST-002,expert-lane/telemetry-release-governance,Packaging,Package build and smoke CI,package-build; package-smoke jobs,.github/workflows/test.yml; pyproject.toml,High,"As a maintainer, I can verify wheel/sdist and console scripts before release.","CI builds artifacts, uploads short-retention wheels, smoke-installs across OS, and checks console scripts.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_package_scaffold.py src/tests/test_ci_classifier.py,Automated Test,Retested Pass,PASS: package build/smoke workflow and package tests reviewed; package scaffold/CI suite passed and wheel/sdist built.,,,,,PASS: /tmp/ctx-verify-venv/bin/python -m build --outdir /tmp/ctx-release-ci-dist built claude_ctx-1.0.20.tar.gz and claude_ctx-1.0.20-py3-none-any.whl; twine check PASSED; pytest release suite 121 passed.,2026-07-02,Telemetry/Release Lane,Smoke coverage is CLI/import oriented.,Reviewed by no-mistakes,Focused workflow/test read plus pytest validation; no behavior fix required.,Ponytail: no fix needed; validation-only row update.,Validated by completed goal-loop and no-mistakes gate
|
| 267 |
LANE-D-021,DIST-005,expert-lane/telemetry-release-governance,Governance,Clean-host contract,scripts/clean_host_contract.py; clean-host-contract workflow,scripts/clean_host_contract.py; .github/workflows/clean-host-contract.yml; docs/harness/clean-host-contract.md,High,"As a maintainer, I can prove install works on a clean host without leaking real home state.","The contract builds a wheel, installs in temp venv/home, fakes Claude/LiteLLM, and runs init/scan/run/resume/deny-tool checks.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_clean_host_contract.py src/tests/test_ci_classifier.py,Automated Test,Retested Pass,PASS: clean-host workflow/script tests reviewed; clean_host_contract help works and release CI suite passed.,,,,,PASS: /tmp/ctx-verify-venv/bin/python scripts/clean_host_contract.py --help printed clean-host contract usage; pytest release suite 121 passed.,2026-07-02,Telemetry/Release Lane,Live Claude gate is optional and environment dependent.,Reviewed by no-mistakes,Focused workflow/test read plus pytest validation; no behavior fix required.,Ponytail: no fix needed; validation-only row update.,Validated by completed goal-loop and no-mistakes gate
|
|
|
|
| 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,The POSIX wrapper contract is validated on supported Linux and macOS hosts.,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/descriptive-metrics-v1.json; 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","The descriptive-metrics-v1 contract is frozen before selection and 244 benchmark tests pass locally, including all-arm retention, missingness, privacy, primary-verdict invariance, and sealed harness-failure coverage. Windows support is removed on the stacked prerequisite branch. Official evidence remains 0/10 controls, 0/30 pairs, and 0/60 arms; required CI and live validation remain.","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; BENCH-043","The authenticated framework and preselected descriptive contract are implemented locally; publication, complete exposure inventory, ten controls, 30 paired runs, failure classification, and honest product verdict remain open.","Publish and merge the POSIX-only prerequisite and descriptive contract after independent review and required CI; then authenticate every known historical exposure source and execute all controls and pairs sequentially.","Framework integration, authenticated snapshots, historical-exposure rejection, source-closure enforcement, one-shot execution, merged-main identity, authoritative verdict gates, task-disjoint-or-no-go generation, Docker/Python conformance, and descriptive missingness/privacy are fixed locally; production execution remains pending.","CURRENT STACKED CANDIDATE: 244/244 benchmark tests pass; official campaign remains 0/10 controls, 0/30 pairs, and 0/60 arms.","2026-08-01","QA/Test Gate Lane","Framework evidence proves mechanics and trust boundaries only; descriptive metrics are non-confirmatory and do not prove CTX benefit. Any outcome-informed later study requires task-disjoint tasks and may require a new pinned universe.","Methodology audits approve the fixed definitions; independent final code review, required CI, exposure inventory completeness, and live product evidence remain pending.","Do not interpret green framework or descriptive tests as product benefit. BENCH-034, BENCH-035, and BENCH-043 remain open until their live and publication gates finish.","Retain one evaluator and one frozen paired design; keep missing evidence missing, infer no semantic use from delivery, and fix only reproduced harness or CTX defects.","Pending publication, required CI, 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"
|
|
|
|
| 131 |
DOC-NAV-025,,docs/qa/feature-user-story-status.csv,Docs,Skill lifecycle and dashboard page,docs/skill-lifecycle-and-dashboard.md,mkdocs.yml nav,Medium,As a dashboard user I can understand skill lifecycle views,The page documents lifecycle states dashboard linkage and expected user workflows,Docs build environment available,python -m mkdocs build --strict --quiet plus tracker nav coverage test,Automated Test,Tested Pass,PASS: docs/skill-lifecycle-and-dashboard.md is present in mkdocs.yml nav; python -m mkdocs build --strict --quiet passed; tracker nav coverage test passed for this entrypoint.,,,,,,2026-06-29,Core/Docs Lane,Added for public MkDocs nav coverage enforcement.,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
|
| 132 |
DOC-NAV-026,,docs/qa/feature-user-story-status.csv,Docs,Skill-quality install page,docs/skill-quality-install.md,mkdocs.yml nav,Medium,As an installer I can understand skill quality install guidance,The page documents quality signals install decisions and user-visible expectations,Docs build environment available,python -m mkdocs build --strict --quiet plus tracker nav coverage test,Automated Test,Tested Pass,PASS: docs/skill-quality-install.md is present in mkdocs.yml nav; python -m mkdocs build --strict --quiet passed; tracker nav coverage test passed for this entrypoint.,,,,,,2026-06-29,Core/Docs Lane,Added for public MkDocs nav coverage enforcement.,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
|
| 133 |
DIST-001,,docs/qa/feature-user-story-status.csv,Distribution,GitHub About metadata,GitHub repository About,src/update_repo_stats.py,High,As a GitHub visitor I can understand ctx positioning and current counts from the repo About,About says ctx is a recommendation layer not a marketplace and uses shipped graph counts,GitHub CLI authenticated,python src/update_repo_stats.py --check-github-about,Manual/Documented,Retested Pass,PASS: GitHub About description is up to date on main 16c96b1.,,,,,PASS: GitHub About description is up to date on main 16c96b1.,2026-06-29,Telemetry/Release Lane,Revalidated after inventory wording merge with python src/update_repo_stats.py --check-github-about.,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
|
| 134 |
+
DIST-002,,docs/qa/feature-user-story-status.csv,Distribution,Main CI test workflow,.github/workflows/test.yml,.github/workflows/test.yml,High,As a contributor I can trust the required main test workflow,Main pushes run static unit canary package browser security telemetry Linux macOS and required aggregate gates selected from the changed surface,GitHub Actions available,.venv/bin/python -m pytest -q --no-cov src/tests/test_ci_classifier.py,Automated Test,Retested Pass,HISTORICAL PASS: GitHub Actions run 29618367990 completed successfully including CI required and native Windows high-risk importer job 88008245118.,,,,,PASS: HISTORICAL GitHub Actions run 29618367990 completed successfully including CI required and native Windows high-risk importer job 88008245118.,2026-07-20,Telemetry/Release Lane,The current required workflow supports Linux and macOS and selects focused jobs from the changed surface.,Reviewed with required CI evidence,Local classifier policy and the required aggregate contract pass.,Ponytail: retain one stable aggregate over the supported-host jobs.,Validated by focused CI policy regression and the required aggregate contract
|
| 135 |
DIST-003,,docs/qa/feature-user-story-status.csv,Distribution,Docs deploy workflow,.github/workflows/docs.yml,.github/workflows/docs.yml,High,As a docs visitor I get the current public docs after main updates,Docs workflow builds strict MkDocs and deploys GitHub Pages without stale generated content,GitHub Pages enabled,gh run view 29021393673 and curl public docs URLs,Manual/Documented,Retested Pass,PASS: Deploy docs to GitHub Pages run 29021393673 for de646b52 succeeded and the generated README/docs stats check is up to date.,,,,,PASS: Deploy docs to GitHub Pages run 29021393673 for de646b52 succeeded and the generated README/docs stats check is up to date.,2026-07-11,Telemetry/Release Lane,Public docs reflect merged main at de646b52; the volatile test inventory remains generator-owned in README and docs/index.md.,Reviewed locally,Local standards/spec review confirmed the docs run and generator-owned stats evidence; prior docs-only no-mistakes run 01KWSY6H1BV17DK8G2CJKYB23W also reached checks-passed and merged.,Ponytail: keep volatile counts in generated files instead of duplicating them in tracker prose.,README/docs stats check passes; numeric inventory is intentionally generator-owned
|
| 136 |
DIST-004,,docs/qa/feature-user-story-status.csv,Distribution,Hugging Face sync workflow,.github/workflows/huggingface-sync.yml,.github/workflows/huggingface-sync.yml and scripts/sync_huggingface.py,Critical,As a Hugging Face visitor I get the same tracked repo and graph artifacts as GitHub,Workflow hydrates graph artifacts from matching release assets or size-capped targeted LFS for full publishes while refusing stale README/docs stats and limiting card-only sync to README/CHANGELOG/docs inputs,Valid write-scoped HF_TOKEN configured in GitHub secrets,GitHub Actions Sync Hugging Face workflow on main,Automated Test,Blocked/Human Decision,FAIL: main Sync Hugging Face workflow run 28340695227 for 16c96b1 failed after README/docs stats and graph artifact hydration passed; upload to https://huggingface.co/api/datasets/Stevesolun/ctx/preupload/main returned 401 Unauthorized / Invalid username or password.,CTX-CICD-001,Post-exposure HF_TOKEN rotation remains open after successful sync proof,GitHub Actions Sync Hugging Face workflow on main,"Replace and revoke the token that was exposed during incident handling, update GitHub HF_TOKEN, then rerun the Sync Hugging Face workflow.","PASS: workflow_dispatch Sync Hugging Face run 28362276544 proved the replacement secret could publish the dataset at that time; current repo stats are enforced separately by update_repo_stats.py and PR #239 refreshed GitHub docs to 4,473 inventory.",2026-07-05,Human Owner,"Successful run proved the replacement secret worked, but the exposed credential still requires another rotation before this row can pass; workflow classifier now full-syncs source test and workflow changes.",Human-owned blocker reviewed,Imported from docs/qa/feature-user-story-status.csv; supporting status now matches canonical Blocked/Human Decision.,Human decision: HF_TOKEN rotation is intentionally out of scope for the agent.,Out of scope human-owned blocker; no-mistakes not applicable until token rotation is confirmed
|
| 137 |
DIST-005,,docs/qa/feature-user-story-status.csv,Distribution,Clean host contract workflow,.github/workflows/clean-host-contract.yml,.github/workflows/clean-host-contract.yml,High,As a new installer I can verify ctx works on a clean host,Workflow installs the package in a clean environment and runs the clean-host smoke contract,GitHub Actions available,gh run view 28340695216,Automated Test,Retested Pass,PASS: Clean host contract job 83954561453 passed inside main Tests run 28340695216 for 16c96b1.,,,,,PASS: Clean host contract job 83954561453 passed inside main Tests run 28340695216 for 16c96b1.,2026-06-29,Telemetry/Release Lane,Revalidated through the current required main workflow after the inventory wording merge.,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
|
|
|
|
| 143 |
SEC-002,,docs/qa/feature-user-story-status.csv,Distribution,No-mistakes development gate,no-mistakes axi run,imported-skills/no-mistakes and no-mistakes binary,High,As a maintainer I can gate feature branches through no-mistakes before merge,The no-mistakes pipeline runs intent rebase review test docs lint push PR and CI before changes reach main,Feature branch with committed changes,no-mistakes axi run --intent tracker-governance-change,Automated Test,Tested Pass,no-mistakes run 01KW9N9RP1F7N9T593164EPZY6 reached checks-passed and PR #206 merged after CI success.,,,,,,2026-06-29,Telemetry/Release Lane,Tracks the required development-process gate requested for enterprise readiness.,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
|
| 144 |
MAINT-001,,docs/qa/feature-user-story-status.csv,Maintainer,Backup snapshot audit,scripts/audit_backup.py,scripts/audit_backup.py,Medium,As a maintainer I can inspect backup snapshots for missing expected files,Script summarizes backup contents while accepting --help without snapshot access and flags missing graph/wiki/report artifacts without mutating the repo,Backup fixture available,python scripts/audit_backup.py --help; run script against representative backup fixture,Manual/Documented,Retested Pass,PASS: --help printed usage without touching snapshot files; temp backup fixture with BOM manifest printed entries and OK coverage; focused pytest passed.,CTX-AZ-008; CTX-QA-034,Backup audit previously rejected UTF-8 BOM manifests and treated --help as a snapshot path,python scripts/audit_backup.py --help; run script against representative backup fixture,Fixed by utf-8-sig manifest reads and snapshot-free help parsing in PR #210,PASS: /tmp/ctx-verify-venv/bin/python scripts/audit_backup.py --help; focused pytest 62 passed 1 skipped; no-mistakes run 01KWFXQTHJ83VNZ9ZJGMTAJPWC checks-passed.,2026-07-02,Core/Docs Lane,Read-only reporting; --help is snapshot-free and does not repair backup gaps.,Reviewed by no-mistakes,Run 01KWFXQTHJ83VNZ9ZJGMTAJPWC reported no findings; PR #210 merged as c61de902e8fdd2a4b2cfa061c5337a2fef078d0a.,Ponytail: minimal fix only; no behavior expansion beyond help handling.,Validated by completed goal-loop and no-mistakes gate
|
| 145 |
MAINT-002,,docs/qa/feature-user-story-status.csv,Maintainer,Dashboard graph index builder,scripts/build_dashboard_graph_index.py,scripts/build_dashboard_graph_index.py,Medium,As a dashboard user I get fast graph search and neighborhoods,Script builds the dashboard SQLite/index artifacts from graph exports for fast monitor reads,Graph fixture available,Run script against small graph fixture and query resulting index,Manual/Documented,Retested Pass,FAIL: BOM-prefixed graph.json from PowerShell Set-Content -Encoding UTF8 raised JSONDecodeError.,CTX-AZ-008,Dashboard graph index builder read graph JSON with utf-8 and rejected common Windows BOM input,Run script against small graph fixture and query resulting index,Fixed by reading graph JSON with utf-8-sig,PASS: temp graph fixture built SQLite index with 2 nodes and neighbor mcp-server:github; regression pytest passed.,2026-06-23,Core/Docs Lane,,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
|
| 146 |
+
MAINT-003,,docs/qa/feature-user-story-status.csv,Maintainer,CI change classifier,scripts/ci_classifier.py,scripts/ci_classifier.py and .github/workflows/test.yml,Medium,As a contributor I get the right CI gates for the files I changed,Classifier marks docs graph source package browser similarity telemetry and CI workflow changes conservatively,CI classifier tests available,python -m pytest src/tests/test_ci_classifier.py -q,Automated Test,Tested Pass,HISTORICAL PASS LOCAL: 70 classifier and required-policy tests covered selective Windows importer paths unrelated-path skips missing or malformed output and workflow structure.,,,,,,2026-07-16,Core/Docs Lane,Changed-surface classification keeps ordinary pull requests fast while CI policy changes fail open into required validation.,Reviewed by independent expert,Reviewer approved the supported-host classifier contract with no remaining P0 P1 P2 or P3 finding.,Ponytail: remove the retired platform-only output while preserving conservative changed-surface classification.,Validated by focused CI classifier regression
|
| 147 |
MAINT-004,,docs/qa/feature-user-story-status.csv,Maintainer,No-test policy gate,scripts/ci_no_test_policy.py,scripts/ci_no_test_policy.py and .github/workflows/test.yml,Medium,As a reviewer I can reject risky code or workflow changes without test updates,Policy fails contract changes including release sync and graph artifact maintainer scripts that omit matching tests while allowing proven metadata-only releases or maintainer-applied no-tests-needed labels for genuinely untestable changes,CI policy tests available,python -m pytest src/tests/test_ci_classifier.py src/tests/test_ci_preflight.py -q,Automated Test,Tested Pass,CI policy and preflight suites cover contract files release metadata exceptions no-tests-needed label exemptions and rejection when diff context is missing.,,,,,,2026-07-05,Core/Docs Lane,Validated after preflight started passing real per-file diffs to the policy helper and after maintainer script contract coverage expanded.,Reviewed by no-mistakes,Documentation sync verified against current policy behavior.,Ponytail: release metadata exemptions require actual diff evidence and maintainer script changes require tests unless a maintainer applies no-tests-needed.,Validated by focused policy and preflight regressions
|
| 148 |
+
MAINT-005,,docs/qa/feature-user-story-status.csv,Maintainer,Required CI aggregate,scripts/ci_required.py,scripts/ci_required.py and .github/workflows/test.yml,Medium,As a branch maintainer I can trust the required CI summary,Aggregate rejects failed missing or wrongly skipped required jobs across the supported-host pytest matrix while allowing only documented exact conditional skips,CI required tests available,python -m pytest src/tests/test_ci_classifier.py -q,Automated Test,Tested Pass,HISTORICAL PASS LOCAL: 70 tests proved the retired Windows skip was accepted only for exact false and rejected for true missing malformed or push execution.,,,,,,2026-07-16,Core/Docs Lane,Workflow needs and REQUIRED_JOBS match exactly across the current supported-host jobs.,Reviewed by independent expert,Reviewer reproduced and closed the original fail-open aggregate issue then approved with no remaining finding.,Ponytail: preserve exact required-job parity and documented conditional skips.,Validated by focused required-CI regression
|
| 149 |
MAINT-006,,docs/qa/feature-user-story-status.csv,Maintainer,CI preflight gate,scripts/ci_preflight.py,scripts/ci_preflight.py scripts/ci_classifier.py and scripts/local_fast_gate.py,Medium,As a contributor I can run the same preflight logic locally that CI uses,"Preflight classifies changes then emits source static gates (ruff format/check, ruff lint, mypy, pip check), public docs tracker including bug-smoke, feature, dashboard, and toolbox coverage, strict build, graph, browser, package, and similarity gates required; local-fast groups those same checks into isolated parallel worktree lanes before the serial gate",Repo checkout with git available,Run scripts/ci_preflight.py against representative changed files; run scripts/no_mistakes_run.sh fast before PR validation,CI/CD Gate,Tested Pass,"select_checks and workflow parity coverage confirm the public docs tracker includes bug-smoke, feature, dashboard, and toolbox checks before strict MkDocs build; local_fast_gate grouping coverage confirms graph hydration stays with graph validation and source changes split across independent lanes.",,,,,,2026-07-06,Core/Docs Lane,Validated through focused preflight tests and the first real local-fast run which exposed missing tracker coverage before the final serial gate.,Reviewed by no-mistakes,Documentation sync verified against current preflight docs-check coverage and local-fast grouping behavior.,Ponytail: public tracker coverage matches PR docs workflow while local-fast only parallelizes existing checks.,Validated by focused preflight regression and local-fast dry run
|
| 150 |
MAINT-007,,docs/qa/feature-user-story-status.csv,Maintainer,Clean host contract script,scripts/clean_host_contract.py,scripts/clean_host_contract.py and .github/workflows/clean-host-contract.yml,Medium,As a new installer I can smoke ctx on a clean host,Script builds a clean venv installs ctx and runs init scan harness and monitor checks,Network and clean temp venv available,GitHub clean-host contract or local script smoke,Automated Test,Tested Pass,Clean host contract job passed inside PR #195 required checks.,,,,,,2026-06-23,Core/Docs Lane,Workflow evidence covers the script path.,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
|
| 151 |
MAINT-008,,docs/qa/feature-user-story-status.csv,Maintainer,Dashboard smoke script,scripts/dashboard_smoke.py,scripts/dashboard_smoke.py,Medium,As a maintainer I can smoke a running monitor before release,Script probes an already running ctx-monitor base URL and checks key pages/APIs with optional warmup,Monitor running or fake HTTP fixture available,python -m pytest src/tests/test_dashboard_smoke.py -q,Automated Test,Tested Pass,Dashboard smoke test suite covers route probing warmup and failure reporting for a supplied base URL.,,,,,,2026-06-29,Core/Docs Lane,Corrected wording from starts-or-probes to probes-running-monitor; ctx-monitor startup is tracked separately by CLI-042.,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
|
|
|
|
| 157 |
MAINT-014,,docs/qa/feature-user-story-status.csv,Maintainer,Similarity threshold tuner,scripts/tune_similarity_thresholds.py,scripts/tune_similarity_thresholds.py,High,As a graph maintainer I can calibrate similarity thresholds against fixtures,Tuner prints help without loading the embedding model and sweeps threshold settings with precision/recall/F1 output without mutating graph artifacts,Similarity fixture corpus available,python scripts/tune_similarity_thresholds.py --help; run tuner against fixture corpus,Manual/Documented,Retested Pass,"PASS: --help printed usage without loading the embedder; focused pytest passed; tuner prints precision, recall, F1, and confusion counts.",CTX-QA-035,Similarity tuner --help previously loaded the embedding backend and could fail before usage output,python scripts/tune_similarity_thresholds.py --help,Fixed by model-free help handling and F1 metric reporting in PR #210,PASS: /tmp/ctx-verify-venv/bin/python scripts/tune_similarity_thresholds.py --help; focused pytest 62 passed 1 skipped; GitHub Similarity precision/recall passed.,2026-07-02,Core/Docs Lane,Full sweep still depends on embedding backend availability; --help stays model-free and CI covers fixture precision/recall/F1.,Reviewed by no-mistakes,Run 01KWFXQTHJ83VNZ9ZJGMTAJPWC reported no findings; PR #210 merged as c61de902e8fdd2a4b2cfa061c5337a2fef078d0a.,Ponytail: minimal fix only; no behavior expansion beyond help/F1 reporting.,Validated by completed goal-loop and no-mistakes gate
|
| 158 |
PUBLIC-001,,docs/qa/feature-user-story-status.csv,Docs,Public catalog search JavaScript,docs/assets/javascripts/catalog.js,docs/assets/javascripts/catalog.js and docs/catalog.md,Medium,As a GitHub Pages visitor I can filter catalog tiles without a local dashboard,JavaScript wires input and checkbox filters and updates visible catalog cards/counts client-side,Docs assets available,python -m pytest src/tests/test_docs_catalog_page.py -q,Automated Test,Tested Pass,Docs catalog page tests verify script inclusion input listener and public non-local links.,,,,,,2026-06-23,Core/Docs Lane,Validated by focused pytest in this tracker slice.,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
|
| 159 |
PUBLIC-002,,docs/qa/feature-user-story-status.csv,Docs,Public repo stats refresh JavaScript,docs/assets/javascripts/repo-stats-refresh.js,docs/assets/javascripts/repo-stats-refresh.js and mkdocs.yml,Medium,As a docs visitor I see current repo stats when GitHub allows client refresh,JavaScript is included by MkDocs and degrades safely when live repo stats cannot be fetched,Docs assets available,python -m pytest src/tests/test_docs_repo_stats.py -q,Automated Test,Tested Pass,Docs repo stats tests verify MkDocs includes the script and the script has the expected refresh behavior.,,,,,,2026-06-23,Core/Docs Lane,Validated by focused pytest in this tracker slice.,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
|
| 160 |
+
PUBLIC-003,,docs/qa/feature-user-story-status.csv,Docs,Backup watchdog service manifests,"docs/services/systemd/claude-backup-watchdog.service, docs/services/macos/com.claude.backup.watchdog.plist",docs/services and docs/backup-hook-install.md,Medium,As an operator I can install the backup watchdog as a least-privilege background service on Linux or macOS,Public service assets point at backup_mirror watchdog use user-scope execution and expose install/remove/status guidance without requiring root privileges,Docs services assets available,python -m pytest src/tests/test_feature_user_story_tracker.py src/tests/test_backup_watchdog.py -q,Automated Test,Tested Pass,Tracker enforcement covers every docs/services asset and watchdog CLI tests cover --once JSON and real snapshot behavior.,,,,,,2026-06-29,Core/Docs Lane,Added for public linked service assets referenced from backup hook install docs.,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
|
| 161 |
PUBLIC-004,,docs/qa/feature-user-story-status.csv,Docs,Starter toolbox template JSON,"docs/toolbox/templates/docs-review.json, docs/toolbox/templates/fresh-repo-init.json, docs/toolbox/templates/refactor-safety.json, docs/toolbox/templates/security-sweep.json, docs/toolbox/templates/ship-it.json","docs/toolbox/templates, docs/toolbox/starters.md, src/toolbox.py",Medium,As a toolbox user I can rely on public starter template JSON matching ctx-toolbox init behavior,Public starter JSON files remain in sync with embedded wheel fallback templates so docs checkout users and PyPI users seed the same starter toolboxes,Docs template assets available,python -m pytest src/tests/test_toolbox_cli.py -q,Automated Test,Tested Pass,Toolbox CLI regression compares docs/toolbox/templates JSON to the embedded fallback path used when templates are absent from installed wheels.,,,,,,2026-06-29,Core/Docs Lane,Added for public starter preset assets referenced from starter toolbox docs.,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
|
| 162 |
DASH-PAGE-001,DASH-001,docs/qa/dashboard-user-story-status.csv,Dashboard Page,Home,/,src/ctx/monitor/pages/home.py,High,As a dashboard user I can open the monitor home page,Home renders current graph stats loaded counts quick actions and health summaries without blocking on full graph parsing,ctx-monitor running,Open / and inspect cards links and number formatting,Browser/User Story,Tested Pass,"PASS: live Playwright page probe opened /, found expected page markers, and detected no traceback or server-error text; dashboard_smoke also returned HTTP 200.",,,,,,2026-06-25,Dashboard/Docs Lane,Deeper controls are tracked in dedicated function/API/mutation rows.,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
|
| 163 |
DASH-PAGE-002,DASH-002,docs/qa/dashboard-user-story-status.csv,Dashboard Page,Loaded,/loaded,src/ctx/monitor/pages/loaded.py,High,As a dashboard user I can see currently loaded skills agents and MCPs,Loaded page renders active entity state and exposes safe load or unload actions where allowed,ctx-monitor running with manifest data,Open /loaded and verify cards pagination and actions,Browser/User Story,Tested Pass,"PASS: live Playwright page probe opened /loaded, found expected page markers, and detected no traceback or server-error text; dashboard_smoke also returned HTTP 200.",,,,,,2026-06-25,Dashboard/Docs Lane,Deeper controls are tracked in dedicated function/API/mutation rows.,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
|
|
|
|
| 214 |
B-API-006,PYAPI-001,expert-lane/api-mcp-harness,Python API,Privacy telemetry wrapper,ctx.api _call telemetry wrapper,src/ctx/api.py,High,"As maintainers, we can observe API use without leaking prompts.","API telemetry hashes raw query, slug, and seeds and records route, status, and error class.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_recommendation_surfaces_golden.py src/tests/test_enterprise_telemetry.py,Automated Test,Tested Pass,"PASS: privacy-safe API telemetry covered by test_public_api.py, test_harness_ctx_core.py, test_recommendation_surfaces_golden.py, and test_enterprise_telemetry.py in API/MCP slice -> 383 passed, 1 skipped.",,,,,"PASS: API/MCP validation slice on 2026-07-01: 383 passed, 1 opt-in live MCP skip; harness recommendation slice: 15 passed; explicit live MCP compatibility check: 8 passed, 1 opt-in skip.",2026-07-01,Telemetry/Release Lane,No raw args in telemetry by design; debugging needs local reproduction.,Reviewed by no-mistakes,no-mistakes run 01KWF5NJXTAFH6FVTR96PS2B2B reached checks-passed on PR #210 before this tracker slice; OpenCodeReview LLM endpoint remains unavailable.,"Ponytail: validate first, then make the smallest behavior-preserving fix only if the repro is confirmed.",Validated by completed goal-loop and no-mistakes gate
|
| 215 |
B-MCP-001,CLI-024,expert-lane/api-mcp-harness,MCP/Core Tools,Standalone MCP discovery,ctx-mcp-server initialize/tools/list,src/ctx/mcp_server/server.py; src/ctx/mcp_server/__init__.py,High,"As an MCP host, I can discover ctx tools.",The JSON-RPC stdio server initializes and lists ctx tool schemas.,Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_mcp_server.py,Automated Test,Tested Pass,"PASS: standalone MCP discovery covered by test_mcp_server.py in API/MCP slice -> 383 passed, 1 skipped.",,,,,"PASS: API/MCP validation slice on 2026-07-01: 383 passed, 1 opt-in live MCP skip; harness recommendation slice: 15 passed; explicit live MCP compatibility check: 8 passed, 1 opt-in skip.",2026-07-01,API/MCP Lane,No MCP resources/prompts/progress/logging yet.,Reviewed by no-mistakes,no-mistakes run 01KWF5NJXTAFH6FVTR96PS2B2B reached checks-passed on PR #210 before this tracker slice; OpenCodeReview LLM endpoint remains unavailable.,"Ponytail: validate first, then make the smallest behavior-preserving fix only if the repro is confirmed.",Validated by completed goal-loop and no-mistakes gate
|
| 216 |
B-MCP-002,CLI-024,expert-lane/api-mcp-harness,MCP/Core Tools,Standalone MCP tool calls,tools/call ctx__*,src/ctx/mcp_server/server.py; src/ctx/adapters/generic/ctx_core_tools.py,High,"As an MCP host, I can call ctx capabilities.","The server validates arguments, dispatches shared toolbox tools, and returns JSON text with isError status.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_mcp_server.py src/tests/test_harness_ctx_core.py,Automated Test,Tested Pass,"PASS: standalone MCP tool calls covered by test_mcp_server.py and test_harness_ctx_core.py in API/MCP slice -> 383 passed, 1 skipped.",,,,,"PASS: API/MCP validation slice on 2026-07-01: 383 passed, 1 opt-in live MCP skip; harness recommendation slice: 15 passed; explicit live MCP compatibility check: 8 passed, 1 opt-in skip.",2026-07-01,API/MCP Lane,"Tool responses are text-wrapped JSON, not typed resource payloads.",Reviewed by no-mistakes,no-mistakes run 01KWF5NJXTAFH6FVTR96PS2B2B reached checks-passed on PR #210 before this tracker slice; OpenCodeReview LLM endpoint remains unavailable.,"Ponytail: validate first, then make the smallest behavior-preserving fix only if the repro is confirmed.",Validated by completed goal-loop and no-mistakes gate
|
| 217 |
+
B-MCP-003,MCP-003,expert-lane/api-mcp-harness,MCP Router,Generic harness MCP router,ctx run --mcp / McpRouter,src/ctx/adapters/generic/tools/mcp_router.py; src/ctx/cli/run.py; src/ctx/adapters/generic/tools/__init__.py,High,"As ctx run, I can connect external MCP tools.","The router spawns configured stdio servers, namespaces tools, routes calls, expands nonsecret env placeholders, blocks sensitive argv placeholder expansion by default with trusted opt-in, redacts literal credential env values and diagnostics, emits client-side external tool telemetry, and propagates W3C traceparent metadata to MCP servers.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_mcp_router.py src/tests/test_enterprise_telemetry.py,Automated Test,Needs Validation,"HISTORICAL PASS LOCAL: commit 51c845d2 rejects unpublished MCP tools before RPC; lazy selective activation, schema revocation, process-tree cleanup, failed-reap retention, and hashed lifecycle events are implemented. At that review point native Windows and remote containment validation remained pending; the unsupported Windows obligation is now retired.",AUDIT-019; AUDIT-078; AUDIT-079,Trace propagation and hidden-tool dispatch are fixed; supported-host lifecycle cleanup is implemented locally while remote POSIX validation remains open.,"Attempt an omitted published tool and a stale capability epoch, then activate and stop a stubborn MCP child on a supported POSIX host while checking schemas and descendants.",AUDIT-019 and AUDIT-078 Fixed; AUDIT-079 Fixed pending remote supported-host validation,"PASS: historical published-tool boundary focused slice reported 74 passing tests; current focused MCP router suite reported 79 passing tests with POSIX session and process-group cleanup coverage.",2026-08-01,API/MCP Lane,The exact published registry is enforced locally. Supported-host process containment and remote lifecycle validation remain the nonterminal proof obligation.,Approved locally pending remote supported-host proof,Independent reviewers closed the authorization boundary and retained AUDIT-079 as Needs Validation for remote cleanup evidence.,Ponytail: add traceparent telemetry and argv placeholder guardrails only; preserve sync stdio router behavior.,Needs remote lazy-activation and POSIX process-reaping validation on supported hosts
|
| 218 |
B-MCP-004,CLI-017,expert-lane/api-mcp-harness,MCP/Core Tools,Claude MCP install adapter,ctx-mcp-install/uninstall,src/ctx/adapters/claude_code/install/mcp_install.py,High,"As a Claude Code user, I can install catalog MCP servers.",The installer requires catalog slug plus safe argv/json command and calls claude mcp add/remove.,Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_mcp_install.py,Automated Test,Tested Pass,"PASS: Claude MCP install/uninstall adapter covered by test_mcp_install.py in API/MCP slice -> 383 passed, 1 skipped.",,,,,"PASS: API/MCP validation slice on 2026-07-01: 383 passed, 1 opt-in live MCP skip; harness recommendation slice: 15 passed; explicit live MCP compatibility check: 8 passed, 1 opt-in skip.",2026-07-01,API/MCP Lane,Command allowlist is conservative; real Claude CLI behavior needs host integration.,Reviewed by no-mistakes,no-mistakes run 01KWF5NJXTAFH6FVTR96PS2B2B reached checks-passed on PR #210 before this tracker slice; OpenCodeReview LLM endpoint remains unavailable.,"Ponytail: validate first, then make the smallest behavior-preserving fix only if the repro is confirmed.",Validated by completed goal-loop and no-mistakes gate
|
| 219 |
B-HAR-001,CLI-001,expert-lane/api-mcp-harness,Harness,Agent-loop run command,ctx run,src/ctx/cli/run.py; src/ctx/adapters/generic/adaptive_runtime.py; src/ctx/adapters/generic/loop.py; src/tests/test_adaptive_runtime.py; src/tests/test_harness_cli_run.py; src/tests/test_harness_loop.py,High,"As a user, I can run an agent loop with ctx guidance without paying recurring discovery or irrelevant-tool costs.","ctx run defaults to a graph-free adaptive host path with zero CTX schemas; it may select one strongly matched skill from trusted user/configured roots for one request within 50 ms, 128-entry, 8 KB, and 2000-estimated-token limits; selected material is merged into the request copy at user authority and removed after that provider request; unsupported secure reads abstain without restoring schemas; explicit MCP catalogues defer adaptive injection; evaluator success reports complete usage and failed orchestration marks completed-generator usage partial.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q --no-cov src/tests/test_adaptive_runtime.py src/tests/test_harness_cli_run.py src/tests/test_harness_loop.py,Automated Test,Needs Validation,"PASS FOCUSED: 198 adaptive/CLI/loop tests cover one-request bounded skill context, zero-schema fallback, strict ordering, evaluator usage, and cleanup preservation. PASS ENGINE: commit 89d7fad2 and 53 benchmark tests cover shipped production-ctx-run exact usage local-provider parity applied lifecycle ordering and fail-closed claim gating.",AUDIT-018; BENCH-008; BENCH-021,"The default overhead, unsafe replay, trust boundary, usage accounting, production engine, and local lifecycle validation defects are fixed; real-provider paired KPI and lifecycle evidence remain unverified.","Run six counterbalanced production-ctx-run baseline and ctx-light pairs then inspect every provider request, exact usage, applied lifecycle, final empty state, quality, and wall time.",Default overhead authority accounting and production engine fixed; real-provider KPI validation pending,"PASS: 198 adaptive/CLI/loop tests and 53 production benchmark tests validate bounded context, capability isolation, exact local-provider usage, applied lifecycle ordering, cleanup, and fail-closed evidence; six paired real-provider runs remain pending.",2026-07-26,Runtime/API/MCP Lane,"Bounded one-request skill context, lazy MCP activation, published-tool enforcement, applied-only lifecycle state, bounded agents, truthful usage, and the production engine are implemented. Real-provider KPI, lifecycle, and catalog-validity evidence remain open.",Approved locally; real-provider lifecycle/A-B pending,"Focused reviewers accepted the runtime boundaries and production engine; six real-provider baseline-versus-adaptive pairs remain required before an efficiency claim.","Ponytail: keep recurring CTX schemas and graph lookup off the default path, fail closed on unsafe local skills, lend one bounded skill for one request, and validate the shipped engine with exact evidence.",Focused runtime and production-engine regressions pass; fresh full integration and six real-provider KPI/lifecycle pairs remain pending
|
| 220 |
B-HAR-002,CLI-001,expert-lane/api-mcp-harness,Harness,Session resume/list commands,ctx resume/sessions,src/ctx/cli/run.py; src/ctx/adapters/generic/state.py,High,"As a user, I can resume or inspect agent sessions.","ctx resume replays JSONL messages, repairs unresolved tool tails, lists session summaries, emits failed ctx.cli.resume telemetry for early failures, and includes previous trace correlation when available.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_harness_cli_run.py src/tests/test_harness_state.py,Automated Test,Retested Pass,"PASS: ctx resume telemetry regressions cover previous_trace_id payloads, failed resume spans, redacted errors, and lifecycle child spans.",AUDIT-018,Early ctx resume failures and resumed sessions lacked reliable previous trace correlation telemetry.,Resume a recorded session or trigger resume load/attach/missing-model failures before the fix and inspect ctx.cli.resume telemetry payloads.,Fixed,PASS: .venv/bin/pytest src/tests/test_harness_cli_run.py -q --tb=short -> 73 passed.,2026-07-05,CLI Lane,Updated after CLI resume trace correlation fix.,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: report existing resume failure and previous trace metadata without restoring unsafe MCP metadata by default.,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.
|
|
|
|
| 257 |
LANE-D-011,CLI-045,expert-lane/telemetry-release-governance,Retention,Backup config privacy exclusions,backup_config.from_ctx_config,src/backup_config.py; src/config.json; docs/backup-hook-install.md,High,"As a user, I can back up ctx state while excluding credentials and invalid paths.",Backup config validates tracked files trees and top-level top_files names and always excludes credentials/auth caches.,Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_backup_mirror.py src/tests/test_backup_retention.py,Automated Test,Retested Pass,"PASS: backup config tests validate privacy exclusions, tracked file/tree filtering, malformed config fallback, and credential/auth-cache exclusion.",,,,,PASS: /tmp/ctx-verify-venv/bin/python -m pytest -q --no-cov src/tests/test_backup_config.py src/tests/test_backup_mirror.py src/tests/test_backup_retention.py src/tests/test_backup_watchdog.py -> 91 passed in 1.65s.,2026-07-02,Telemetry/Release Lane,User overrides are ignored on malformed config by design; unsafe top_files override entries are skipped with a warning.,Reviewed by no-mistakes,Focused source/test/docs read plus integration validation; no behavior fix required.,Ponytail: top_files filename validation only; no backup scope expansion.,Validated by completed goal-loop and no-mistakes gate
|
| 258 |
LANE-D-012,CLI-045,expert-lane/telemetry-release-governance,Retention,Backup mirror/hook/watchdog,backup_on_change.py; backup_mirror snapshot-if-changed/watchdog/prune,hooks/backup_on_change.py; src/backup_mirror.py; src/change_detector.py; src/backup_watchdog.py,High,"As a user, I can automatically snapshot changed ctx/Claude state.","Backups use exclusion and size-aware SHA-gated snapshots, safe restore/prune including legacy keep dry-run, non-blocking hooks, and tolerant watchdogs.",Repo checkout with Python 3.11+ dev environment.,.venv/bin/python -m pytest -q --no-cov src/tests/test_change_detector.py src/tests/test_change_detector_exclusions.py src/tests/test_backup_config.py src/tests/test_backup_mirror.py,Automated Test,Retested Pass,PASS: capture and detector parity passes main and independent focused suites including repeated-snapshot suppression.,AUDIT-070,Detector previously observed excluded historical and oversized top files that capture did not persist.,Exercise exclusion baseline and size-limited file sets across repeated snapshot-if-changed calls.,Fixed,PASS: reviewer found no P1 P2 or P3 and confirmed normal removals plus exact-limit files remain visible.,2026-07-16,Telemetry/Release Lane,Hooks remain nonblocking and change detection now compares the same persisted set as capture.,Approved by independent expert,Current baseline tree memory and top-file boundaries were independently validated.,Ponytail: capture-equivalent exclusion and size predicates.,Retested and independently approved in current audit phase
|
| 259 |
LANE-D-013,CLI-045,expert-lane/telemetry-release-governance,Retention,Backup retention policy,backup_retention.plan_prune; backup_mirror prune --policy,src/backup_retention.py; src/backup_mirror.py; docs/backup-hook-install.md,Medium,"As a user, I can keep recent/daily backups without unbounded growth.","Retention keeps the union of keep_latest and keep_daily, protects undated snapshots, and supports dry-run JSON.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_backup_retention.py src/tests/test_backup_mirror.py,Automated Test,Retested Pass,"PASS: backup retention tests validate keep_latest/keep_daily union, undated snapshot protection, prune policy, and dry-run JSON behavior.",,,,,"PASS: backup validation slice reported 91 passed in 1.65s; all-remaining integration suite reported 603 passed, 2 skipped.",2026-07-02,Telemetry/Release Lane,Retention requires policy invocation or snapshot auto-prune.,Reviewed by no-mistakes,Focused source/test/docs read plus integration validation; no behavior fix required.,Ponytail: no fix needed; validation-only row update.,Validated by completed goal-loop and no-mistakes gate
|
| 260 |
+
LANE-D-014,MAINT-003,expert-lane/telemetry-release-governance,CI/CD,Path classifier,scripts/ci_classifier.py,scripts/ci_classifier.py; .github/workflows/test.yml,High,"As a maintainer, I can run only relevant CI while keeping sensitive gates conservative.","Classifier identifies telemetry graph package docs browser source similarity and CI changes with conservative workflow handling.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_ci_classifier.py,Automated Test,Retested Pass,HISTORICAL PASS: selective importer and CI-policy paths set windows_changed while unrelated API and docs paths did not; 70 focused tests and the native Windows job passed.,,,,,PASS: classifier policy workflow YAML diff checks full mypy and GitHub Actions run 29618367990 pass.,2026-07-20,Telemetry/Release Lane,Classifier keeps ordinary pull requests fast and routes sensitive changes through supported-host gates.,Reviewed by independent expert,Independent CI reviewer approved exact conservative classification and fail-open policy behavior.,Ponytail: retain the bounded changed-surface outputs only.,Validated by focused classifier policy and clean static gates
|
| 261 |
+
LANE-D-015,MAINT-005,expert-lane/telemetry-release-governance,CI/CD,Required CI aggregator,scripts/ci_required.py,scripts/ci_required.py; .github/workflows/test.yml,High,"As a maintainer, I can get one stable required check for branch protection.",Aggregator rejects failed missing or invalidly skipped required jobs across telemetry CI and the supported-host full matrix.,Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_ci_classifier.py,Automated Test,Retested Pass,HISTORICAL PASS LOCAL: 70 CI policy tests verified required-job parity and rejected windows-high-risk skips for high-risk paths plus missing or malformed classifier output.,,,,,PASS: HISTORICAL python3 -m pytest -q --no-cov src/tests/test_ci_classifier.py reported 70 passed including exact false-only Windows skip regressions.,2026-07-16,Telemetry/Release Lane,REQUIRED_JOBS matches the current supported-host workflow needs exactly.,Reviewed by no-mistakes,Focused script and workflow review covers required-job parity and the supported-host full matrix.,Ponytail: preserve exact required-job parity and fail closed on missing or invalid job state.,Validated by focused CI policy regression
|
| 262 |
LANE-D-016,MAINT-004,expert-lane/telemetry-release-governance,Governance,No-test policy,scripts/ci_no_test_policy.py,scripts/ci_no_test_policy.py; .github/workflows/test.yml,High,"As a reviewer, I can require tests for contract-affecting changes.",Policy requires tests for contract paths including release sync and graph artifact maintainer scripts unless labeled/metadata-only exceptions apply.,Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_ci_classifier.py,Automated Test,Retested Pass,PASS: no-test policy help and no-change invocation worked; tests cover workflow contract-file rejection and release-metadata exceptions.,,,,,PASS: /tmp/ctx-verify-venv/bin/python scripts/ci_no_test_policy.py --base origin/main --head HEAD --labels-json '[]'; pytest 67 passed.,2026-07-02,Telemetry/Release Lane,Exceptions remain covered by focused policy tests and maintainer script paths are contract files.,Reviewed by no-mistakes,Focused script read plus CLI and pytest validation; no behavior fix required.,Ponytail: maintainer script contract coverage only.,Validated by completed goal-loop and no-mistakes gate
|
| 263 |
LANE-D-017,MAINT-006,expert-lane/telemetry-release-governance,CI/CD,Local preflight,scripts/ci_preflight.py,scripts/ci_preflight.py,High,"As a contributor, I can reproduce CI selection locally.","Preflight runs selected static, unit, docs, graph, browser, package, and telemetry checks from classifier output.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_ci_preflight.py,Automated Test,Retested Pass,PASS: dry-run printed baseline PR checks; select_checks for workflow changes selected static/unit/canary/clean-host/telemetry/similarity/browser/package gates.,,,,,PASS: /tmp/ctx-verify-venv/bin/python scripts/ci_preflight.py --dry-run --base origin/main --profile pr --python /tmp/ctx-verify-venv/bin/python; pytest 67 passed.,2026-07-02,Telemetry/Release Lane,Requires local Python/test tooling for non-dry-run execution.,Reviewed by no-mistakes,Focused script read plus dry-run/API and pytest validation; no behavior fix required.,Ponytail: no fix needed; validation-only row update.,Validated by completed goal-loop and no-mistakes gate
|
| 264 |
+
LANE-D-018,DIST-002,expert-lane/telemetry-release-governance,CI/CD,Main test workflow,.github/workflows/test.yml,.github/workflows/test.yml; scripts/ci_*.py,High,"As a maintainer, I can gate PRs and pushes across static unit graph browser package telemetry clean-host and targeted platform checks.","Workflow is path-aware and includes coverage artifacts required aggregation no-test enforcement and a Linux/macOS pytest matrix for CI changes.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_ci_classifier.py src/tests/test_ci_preflight.py,Automated Test,Retested Pass,HISTORICAL PASS: workflow policy tests passed and GitHub Actions run 29618367990 completed the required aggregate plus native Windows high-risk importer execution.,AUDIT-060,Native Windows importer behavior previously lacked selective required PR execution.,Change any Design Matt or Strix importer path and verify the focused Windows job becomes required and succeeds.,Fixed,PASS: HISTORICAL job 88008245118 ran all three importer suites on Windows Server 2025 with CPython 3.12.10: 214 passed and 17 skipped; full mypy was clean.,2026-07-20,Telemetry/Release Lane,Full supported-host matrix remains reserved for CI changes; ordinary changes receive only their classified focused jobs.,Reviewed by independent expert,The exact path classification workflow and required-aggregate policy are approved.,Ponytail: preserve one supported-host matrix and exact required-job parity.,Validated by local policy tests and supported-host workflow structure
|
| 265 |
LANE-D-019,DIST-002,expert-lane/telemetry-release-governance,Telemetry,Telemetry enterprise CI gate,telemetry-enterprise job,.github/workflows/test.yml; src/tests/test_enterprise_telemetry.py,High,"As an enterprise maintainer, I can prevent telemetry/privacy regressions.",The telemetry enterprise job runs enterprise telemetry and focused harness telemetry tests for telemetry changes or pushes.,Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_ci_classifier.py src/tests/test_enterprise_telemetry.py,Automated Test,Retested Pass,PASS: telemetry-enterprise workflow/test evidence reviewed; focused telemetry/harness slice passed 67 selected tests with 65 deselected.,,,,,"PASS: /tmp/ctx-verify-venv/bin/python -m pytest -q --no-cov src/tests/test_enterprise_telemetry.py src/tests/test_harness_cli_run.py -k 'telemetry or runtime_lifecycle' -> 67 passed, 65 deselected in 0.69s.",2026-07-02,Telemetry/Release Lane,Gate is path-classifier dependent on PRs.,Reviewed by no-mistakes,Focused workflow/test read plus pytest validation; no behavior fix required.,Ponytail: no fix needed; validation-only row update.,Validated by completed goal-loop and no-mistakes gate
|
| 266 |
LANE-D-020,DIST-002,expert-lane/telemetry-release-governance,Packaging,Package build and smoke CI,package-build; package-smoke jobs,.github/workflows/test.yml; pyproject.toml,High,"As a maintainer, I can verify wheel/sdist and console scripts before release.","CI builds artifacts, uploads short-retention wheels, smoke-installs across OS, and checks console scripts.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_package_scaffold.py src/tests/test_ci_classifier.py,Automated Test,Retested Pass,PASS: package build/smoke workflow and package tests reviewed; package scaffold/CI suite passed and wheel/sdist built.,,,,,PASS: /tmp/ctx-verify-venv/bin/python -m build --outdir /tmp/ctx-release-ci-dist built claude_ctx-1.0.20.tar.gz and claude_ctx-1.0.20-py3-none-any.whl; twine check PASSED; pytest release suite 121 passed.,2026-07-02,Telemetry/Release Lane,Smoke coverage is CLI/import oriented.,Reviewed by no-mistakes,Focused workflow/test read plus pytest validation; no behavior fix required.,Ponytail: no fix needed; validation-only row update.,Validated by completed goal-loop and no-mistakes gate
|
| 267 |
LANE-D-021,DIST-005,expert-lane/telemetry-release-governance,Governance,Clean-host contract,scripts/clean_host_contract.py; clean-host-contract workflow,scripts/clean_host_contract.py; .github/workflows/clean-host-contract.yml; docs/harness/clean-host-contract.md,High,"As a maintainer, I can prove install works on a clean host without leaking real home state.","The contract builds a wheel, installs in temp venv/home, fakes Claude/LiteLLM, and runs init/scan/run/resume/deny-tool checks.",Repo checkout with Python 3.11+ dev environment.,python -m pytest -q src/tests/test_clean_host_contract.py src/tests/test_ci_classifier.py,Automated Test,Retested Pass,PASS: clean-host workflow/script tests reviewed; clean_host_contract help works and release CI suite passed.,,,,,PASS: /tmp/ctx-verify-venv/bin/python scripts/clean_host_contract.py --help printed clean-host contract usage; pytest release suite 121 passed.,2026-07-02,Telemetry/Release Lane,Live Claude gate is optional and environment dependent.,Reviewed by no-mistakes,Focused workflow/test read plus pytest validation; no behavior fix required.,Ponytail: no fix needed; validation-only row update.,Validated by completed goal-loop and no-mistakes gate
|
scripts/ci_classifier.py
CHANGED
|
@@ -20,7 +20,6 @@ OUTPUT_NAMES = (
|
|
| 20 |
"similarity_changed",
|
| 21 |
"source_changed",
|
| 22 |
"telemetry_changed",
|
| 23 |
-
"windows_changed",
|
| 24 |
)
|
| 25 |
|
| 26 |
DOCS_PATTERNS = (
|
|
@@ -114,21 +113,6 @@ TELEMETRY_PATTERNS = (
|
|
| 114 |
"src/tests/test_mcp_server.py",
|
| 115 |
"src/tests/test_public_api.py",
|
| 116 |
)
|
| 117 |
-
WINDOWS_PATTERNS = (
|
| 118 |
-
".github/workflows/test.yml",
|
| 119 |
-
"scripts/ctx_ab_benchmark.py",
|
| 120 |
-
"scripts/ctx_ab_swebench.py",
|
| 121 |
-
"scripts/ci_classifier.py",
|
| 122 |
-
"scripts/ci_required.py",
|
| 123 |
-
"src/import_designdotmd_skills.py",
|
| 124 |
-
"src/import_mattpocock_skills.py",
|
| 125 |
-
"src/import_strix_skills.py",
|
| 126 |
-
"src/tests/test_import_designdotmd_skills.py",
|
| 127 |
-
"src/tests/test_import_mattpocock_skills.py",
|
| 128 |
-
"src/tests/test_import_strix_skills.py",
|
| 129 |
-
"src/tests/test_ctx_ab_benchmark.py",
|
| 130 |
-
"src/tests/test_ctx_ab_swebench.py",
|
| 131 |
-
)
|
| 132 |
|
| 133 |
|
| 134 |
def _matches(path: str, patterns: Iterable[str]) -> bool:
|
|
@@ -165,7 +149,6 @@ def classify_paths(paths: Iterable[str]) -> dict[str, bool]:
|
|
| 165 |
"source_changed": ci_changed or any(_matches(path, SOURCE_PATTERNS) for path in files),
|
| 166 |
"telemetry_changed": ci_changed
|
| 167 |
or any(_matches(path, TELEMETRY_PATTERNS) for path in files),
|
| 168 |
-
"windows_changed": any(_matches(path, WINDOWS_PATTERNS) for path in files),
|
| 169 |
}
|
| 170 |
|
| 171 |
|
|
|
|
| 20 |
"similarity_changed",
|
| 21 |
"source_changed",
|
| 22 |
"telemetry_changed",
|
|
|
|
| 23 |
)
|
| 24 |
|
| 25 |
DOCS_PATTERNS = (
|
|
|
|
| 113 |
"src/tests/test_mcp_server.py",
|
| 114 |
"src/tests/test_public_api.py",
|
| 115 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
|
| 118 |
def _matches(path: str, patterns: Iterable[str]) -> bool:
|
|
|
|
| 149 |
"source_changed": ci_changed or any(_matches(path, SOURCE_PATTERNS) for path in files),
|
| 150 |
"telemetry_changed": ci_changed
|
| 151 |
or any(_matches(path, TELEMETRY_PATTERNS) for path in files),
|
|
|
|
| 152 |
}
|
| 153 |
|
| 154 |
|
scripts/ci_preflight.py
CHANGED
|
@@ -295,8 +295,8 @@ def select_checks(
|
|
| 295 |
Check("repo stats", (python, "src/update_repo_stats.py", "--check")),
|
| 296 |
]
|
| 297 |
notes = [
|
| 298 |
-
"GitHub
|
| 299 |
-
"
|
| 300 |
]
|
| 301 |
|
| 302 |
smoke_profile = profile == "smoke"
|
|
|
|
| 295 |
Check("repo stats", (python, "src/update_repo_stats.py", "--check")),
|
| 296 |
]
|
| 297 |
notes = [
|
| 298 |
+
"GitHub runs Linux/macOS matrix jobs; local preflight covers the same "
|
| 299 |
+
"contracts on this host."
|
| 300 |
]
|
| 301 |
|
| 302 |
smoke_profile = profile == "smoke"
|
scripts/ci_required.py
CHANGED
|
@@ -32,7 +32,6 @@ REQUIRED_JOBS = {
|
|
| 32 |
"telemetry-enterprise",
|
| 33 |
"test",
|
| 34 |
"unit-linux",
|
| 35 |
-
"windows-high-risk",
|
| 36 |
}
|
| 37 |
|
| 38 |
|
|
@@ -78,7 +77,6 @@ def failed_required_jobs(
|
|
| 78 |
and _job_output(needs, "classify", "telemetry_changed") == "true"
|
| 79 |
)
|
| 80 |
package_changed_output = _job_output(needs, "classify", "package_changed")
|
| 81 |
-
windows_changed_output = _job_output(needs, "classify", "windows_changed")
|
| 82 |
cheap_pr = docs_only_pr or graph_only_pr
|
| 83 |
for name, details in sorted(needs.items()):
|
| 84 |
result = details.get("result")
|
|
@@ -86,7 +84,7 @@ def failed_required_jobs(
|
|
| 86 |
continue
|
| 87 |
if (
|
| 88 |
event_name != "pull_request"
|
| 89 |
-
and name in {"docs-check", "graph-check", "no-test-no-merge"
|
| 90 |
and result == "skipped"
|
| 91 |
):
|
| 92 |
continue
|
|
@@ -141,13 +139,6 @@ def failed_required_jobs(
|
|
| 141 |
continue
|
| 142 |
if event_name == "pull_request" and name == "test" and result == "skipped":
|
| 143 |
continue
|
| 144 |
-
if (
|
| 145 |
-
event_name == "pull_request"
|
| 146 |
-
and name == "windows-high-risk"
|
| 147 |
-
and result == "skipped"
|
| 148 |
-
and windows_changed_output == "false"
|
| 149 |
-
):
|
| 150 |
-
continue
|
| 151 |
failures[name] = result
|
| 152 |
return failures
|
| 153 |
|
|
|
|
| 32 |
"telemetry-enterprise",
|
| 33 |
"test",
|
| 34 |
"unit-linux",
|
|
|
|
| 35 |
}
|
| 36 |
|
| 37 |
|
|
|
|
| 77 |
and _job_output(needs, "classify", "telemetry_changed") == "true"
|
| 78 |
)
|
| 79 |
package_changed_output = _job_output(needs, "classify", "package_changed")
|
|
|
|
| 80 |
cheap_pr = docs_only_pr or graph_only_pr
|
| 81 |
for name, details in sorted(needs.items()):
|
| 82 |
result = details.get("result")
|
|
|
|
| 84 |
continue
|
| 85 |
if (
|
| 86 |
event_name != "pull_request"
|
| 87 |
+
and name in {"docs-check", "graph-check", "no-test-no-merge"}
|
| 88 |
and result == "skipped"
|
| 89 |
):
|
| 90 |
continue
|
|
|
|
| 139 |
continue
|
| 140 |
if event_name == "pull_request" and name == "test" and result == "skipped":
|
| 141 |
continue
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
failures[name] = result
|
| 143 |
return failures
|
| 144 |
|
scripts/clean_host_contract.py
CHANGED
|
@@ -214,21 +214,11 @@ def live_claude_env(paths: ContractPaths) -> dict[str, str]:
|
|
| 214 |
|
| 215 |
|
| 216 |
def venv_python(venv: Path) -> Path:
|
| 217 |
-
if os.name == "nt":
|
| 218 |
-
return venv / "Scripts" / "python.exe"
|
| 219 |
return venv / "bin" / "python"
|
| 220 |
|
| 221 |
|
| 222 |
def venv_script(venv: Path, name: str) -> Path:
|
| 223 |
-
|
| 224 |
-
[venv / "Scripts" / f"{name}.exe", venv / "Scripts" / name]
|
| 225 |
-
if os.name == "nt"
|
| 226 |
-
else [venv / "bin" / name]
|
| 227 |
-
)
|
| 228 |
-
for candidate in candidates:
|
| 229 |
-
if candidate.exists():
|
| 230 |
-
return candidate
|
| 231 |
-
return candidates[0]
|
| 232 |
|
| 233 |
|
| 234 |
def write_fake_litellm(fake_modules: Path) -> Path:
|
|
@@ -434,8 +424,6 @@ def _assert_fake_claude_hook_output(stdout: str) -> None:
|
|
| 434 |
|
| 435 |
def _quote_command(parts: Sequence[str | Path]) -> str:
|
| 436 |
values = [str(part) for part in parts]
|
| 437 |
-
if os.name == "nt":
|
| 438 |
-
return subprocess.list2cmdline(values)
|
| 439 |
return " ".join(shlex.quote(part) for part in values)
|
| 440 |
|
| 441 |
|
|
|
|
| 214 |
|
| 215 |
|
| 216 |
def venv_python(venv: Path) -> Path:
|
|
|
|
|
|
|
| 217 |
return venv / "bin" / "python"
|
| 218 |
|
| 219 |
|
| 220 |
def venv_script(venv: Path, name: str) -> Path:
|
| 221 |
+
return venv / "bin" / name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
|
| 223 |
|
| 224 |
def write_fake_litellm(fake_modules: Path) -> Path:
|
|
|
|
| 424 |
|
| 425 |
def _quote_command(parts: Sequence[str | Path]) -> str:
|
| 426 |
values = [str(part) for part in parts]
|
|
|
|
|
|
|
| 427 |
return " ".join(shlex.quote(part) for part in values)
|
| 428 |
|
| 429 |
|
scripts/ctx_ab_benchmark.py
CHANGED
|
@@ -26,7 +26,7 @@ import unicodedata
|
|
| 26 |
from collections.abc import Mapping, Sequence
|
| 27 |
from dataclasses import dataclass
|
| 28 |
from datetime import UTC, datetime
|
| 29 |
-
from math import comb
|
| 30 |
from pathlib import Path, PurePosixPath
|
| 31 |
from statistics import median
|
| 32 |
from typing import Any
|
|
@@ -35,6 +35,10 @@ import yaml
|
|
| 35 |
|
| 36 |
ROOT = Path(__file__).resolve().parents[1]
|
| 37 |
DEFAULT_SCENARIOS = ROOT / "benchmarks" / "ctx_ab" / "scenarios.yaml"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
ORIGINAL_CODEX_HOME = os.environ.get("CODEX_HOME", str(Path.home() / ".codex"))
|
| 39 |
SAFE_NAME = re.compile(r"^[a-z0-9][a-z0-9_-]{0,127}$")
|
| 40 |
GITHUB_REPO_URL = re.compile(r"https://github\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+\.git")
|
|
@@ -94,6 +98,9 @@ OFFICIAL_CONFIRMATORY_TRIALS = 3
|
|
| 94 |
OFFICIAL_CONFIRMATORY_PAIRS = 30
|
| 95 |
OFFICIAL_CONFIRMATORY_FIRST_ARM_COUNT = 15
|
| 96 |
OFFICIAL_SANDBOX_CONTRACT = "codex-managed-workspace-write-network-denied-v1"
|
|
|
|
|
|
|
|
|
|
| 97 |
PRODUCT_CLAIM_MIN_SCENARIOS = 6
|
| 98 |
PRODUCT_CLAIM_MIN_REPOSITORIES = 5
|
| 99 |
PRODUCT_CLAIM_MIN_TRIALS = 6
|
|
@@ -642,7 +649,7 @@ def _authenticated_artifact(
|
|
| 642 |
raise ValueError(f"{label} is unavailable") from exc
|
| 643 |
if not stat.S_ISREG(mode):
|
| 644 |
raise ValueError(f"{label} must be a regular file")
|
| 645 |
-
if private and
|
| 646 |
raise ValueError(f"{label} must be owner-only")
|
| 647 |
observed = _sha256_bytes(data)
|
| 648 |
if not secrets.compare_digest(observed, expected):
|
|
@@ -1807,8 +1814,6 @@ def verify_scenario_independence_attestation(
|
|
| 1807 |
|
| 1808 |
|
| 1809 |
def _descendant_pids(root_pid: int) -> list[int]:
|
| 1810 |
-
if os.name == "nt":
|
| 1811 |
-
return []
|
| 1812 |
try:
|
| 1813 |
result = subprocess.run(
|
| 1814 |
["/bin/ps", "-axo", "pid=,ppid="],
|
|
@@ -1837,17 +1842,6 @@ def _descendant_pids(root_pid: int) -> list[int]:
|
|
| 1837 |
|
| 1838 |
|
| 1839 |
def _signal_process_tree(process: subprocess.Popen[str], sig: signal.Signals) -> None:
|
| 1840 |
-
if os.name == "nt":
|
| 1841 |
-
try:
|
| 1842 |
-
subprocess.run(
|
| 1843 |
-
["taskkill", "/PID", str(process.pid), "/T", "/F"],
|
| 1844 |
-
check=False,
|
| 1845 |
-
capture_output=True,
|
| 1846 |
-
timeout=5,
|
| 1847 |
-
)
|
| 1848 |
-
except (OSError, subprocess.SubprocessError):
|
| 1849 |
-
process.kill()
|
| 1850 |
-
return
|
| 1851 |
descendants = _descendant_pids(process.pid)
|
| 1852 |
try:
|
| 1853 |
os.killpg(process.pid, sig)
|
|
@@ -1882,8 +1876,6 @@ def _terminate_process_tree(process: subprocess.Popen[str]) -> tuple[str, str]:
|
|
| 1882 |
|
| 1883 |
|
| 1884 |
def _marked_process_pids(token: str) -> tuple[set[int], str | None]:
|
| 1885 |
-
if os.name == "nt":
|
| 1886 |
-
return set(), None
|
| 1887 |
try:
|
| 1888 |
result = subprocess.run(
|
| 1889 |
["/bin/ps", "eww", "-A", "-o", "pid=", "-o", "args="],
|
|
@@ -1971,8 +1963,8 @@ def run_process(
|
|
| 1971 |
stdin=subprocess.PIPE if input_text is not None else subprocess.DEVNULL,
|
| 1972 |
stdout=subprocess.PIPE,
|
| 1973 |
stderr=subprocess.PIPE,
|
| 1974 |
-
start_new_session=
|
| 1975 |
-
preexec_fn=_verification_limits if resource_limits
|
| 1976 |
)
|
| 1977 |
timed_out = False
|
| 1978 |
reaped = 0
|
|
@@ -2201,7 +2193,7 @@ def _open_relative_parent(
|
|
| 2201 |
parts = Path(safe_relative).parts
|
| 2202 |
if not parts:
|
| 2203 |
raise RuntimeError("benchmark-owned test path has no filename")
|
| 2204 |
-
if
|
| 2205 |
raise RuntimeError("secure evaluator path operations are unavailable")
|
| 2206 |
flags = os.O_RDONLY | getattr(os, "O_CLOEXEC", 0) | os.O_DIRECTORY | os.O_NOFOLLOW
|
| 2207 |
descriptor = os.open(workspace, flags)
|
|
@@ -2222,25 +2214,6 @@ def _open_relative_parent(
|
|
| 2222 |
|
| 2223 |
|
| 2224 |
def _relative_regular_bytes(workspace: Path, relative: str) -> bytes | None:
|
| 2225 |
-
if os.name == "nt":
|
| 2226 |
-
path = workspace / _safe_relative_path(relative, field="benchmark-owned test path")
|
| 2227 |
-
workspace_root = workspace.resolve()
|
| 2228 |
-
try:
|
| 2229 |
-
resolved_parent = path.parent.resolve(strict=True)
|
| 2230 |
-
except FileNotFoundError:
|
| 2231 |
-
return None
|
| 2232 |
-
if resolved_parent != workspace_root and workspace_root not in resolved_parent.parents:
|
| 2233 |
-
raise RuntimeError("benchmark-owned test path escapes the workspace")
|
| 2234 |
-
if path.is_symlink():
|
| 2235 |
-
raise RuntimeError("benchmark-owned test path is a symlink")
|
| 2236 |
-
try:
|
| 2237 |
-
file_stat = path.stat()
|
| 2238 |
-
except FileNotFoundError:
|
| 2239 |
-
return None
|
| 2240 |
-
if not stat.S_ISREG(file_stat.st_mode):
|
| 2241 |
-
raise RuntimeError("benchmark-owned test path is not a regular file")
|
| 2242 |
-
return path.read_bytes()
|
| 2243 |
-
|
| 2244 |
try:
|
| 2245 |
parent_fd, leaf = _open_relative_parent(workspace, relative, create=False)
|
| 2246 |
except FileNotFoundError:
|
|
@@ -2264,59 +2237,38 @@ def _relative_regular_bytes(workspace: Path, relative: str) -> bytes | None:
|
|
| 2264 |
|
| 2265 |
|
| 2266 |
def _write_evaluator_atomically(workspace: Path, relative: str, body: bytes) -> None:
|
| 2267 |
-
|
| 2268 |
-
|
| 2269 |
-
|
| 2270 |
-
|
| 2271 |
-
|
| 2272 |
-
|
| 2273 |
-
raise RuntimeError("benchmark-owned test path escapes the workspace")
|
| 2274 |
-
if path.is_symlink() or (path.exists() and not path.is_file()):
|
| 2275 |
-
raise RuntimeError("benchmark-owned test path is a symlink or unsafe file")
|
| 2276 |
-
temporary_path = path.with_name(f".{path.name}.ctx-{secrets.token_hex(8)}")
|
| 2277 |
-
try:
|
| 2278 |
-
with temporary_path.open("xb") as fh:
|
| 2279 |
-
fh.write(body)
|
| 2280 |
-
fh.flush()
|
| 2281 |
-
os.fsync(fh.fileno())
|
| 2282 |
-
os.replace(temporary_path, path)
|
| 2283 |
-
finally:
|
| 2284 |
-
temporary_path.unlink(missing_ok=True)
|
| 2285 |
-
else:
|
| 2286 |
-
try:
|
| 2287 |
-
parent_fd, leaf = _open_relative_parent(workspace, relative, create=True)
|
| 2288 |
-
except OSError as exc:
|
| 2289 |
-
raise RuntimeError("benchmark-owned test path contains an unsafe component") from exc
|
| 2290 |
-
temporary_entry = f".{leaf}.ctx-{secrets.token_hex(8)}"
|
| 2291 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2292 |
try:
|
| 2293 |
-
|
| 2294 |
except FileNotFoundError:
|
| 2295 |
-
|
| 2296 |
-
|
| 2297 |
-
raise RuntimeError("benchmark-owned test path is a symlink or unsafe file")
|
| 2298 |
-
flags = (
|
| 2299 |
-
os.O_WRONLY | os.O_CREAT | os.O_EXCL | getattr(os, "O_CLOEXEC", 0) | os.O_NOFOLLOW
|
| 2300 |
-
)
|
| 2301 |
-
descriptor = os.open(temporary_entry, flags, 0o600, dir_fd=parent_fd)
|
| 2302 |
-
with os.fdopen(descriptor, "wb") as fh:
|
| 2303 |
-
fh.write(body)
|
| 2304 |
-
fh.flush()
|
| 2305 |
-
os.fsync(fh.fileno())
|
| 2306 |
-
os.replace(
|
| 2307 |
-
temporary_entry,
|
| 2308 |
-
leaf,
|
| 2309 |
-
src_dir_fd=parent_fd,
|
| 2310 |
-
dst_dir_fd=parent_fd,
|
| 2311 |
-
)
|
| 2312 |
-
temporary_entry = ""
|
| 2313 |
-
finally:
|
| 2314 |
-
if temporary_entry:
|
| 2315 |
-
try:
|
| 2316 |
-
os.unlink(temporary_entry, dir_fd=parent_fd)
|
| 2317 |
-
except FileNotFoundError:
|
| 2318 |
-
pass
|
| 2319 |
-
os.close(parent_fd)
|
| 2320 |
|
| 2321 |
materialized = _relative_regular_bytes(workspace, relative)
|
| 2322 |
if materialized != body:
|
|
@@ -2800,23 +2752,18 @@ def _ctx_env(home: Path, lifecycle_root: Path) -> dict[str, str]:
|
|
| 2800 |
env = {
|
| 2801 |
key: os.environ[key]
|
| 2802 |
for key in (
|
| 2803 |
-
"COMSPEC",
|
| 2804 |
"LANG",
|
| 2805 |
"LC_ALL",
|
| 2806 |
"LC_CTYPE",
|
| 2807 |
"PATH",
|
| 2808 |
-
"PATHEXT",
|
| 2809 |
"SSL_CERT_DIR",
|
| 2810 |
"SSL_CERT_FILE",
|
| 2811 |
-
"SYSTEMROOT",
|
| 2812 |
-
"WINDIR",
|
| 2813 |
)
|
| 2814 |
if os.environ.get(key)
|
| 2815 |
}
|
| 2816 |
env.update(
|
| 2817 |
{
|
| 2818 |
"HOME": str(home),
|
| 2819 |
-
"USERPROFILE": str(home),
|
| 2820 |
"TEMP": str(tmp),
|
| 2821 |
"TMP": str(tmp),
|
| 2822 |
"TMPDIR": str(tmp),
|
|
@@ -3791,6 +3738,37 @@ def _jsonl_events(stdout: str) -> list[dict[str, Any]]:
|
|
| 3791 |
return events
|
| 3792 |
|
| 3793 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3794 |
def extract_token_usage(stdout: str) -> dict[str, Any]:
|
| 3795 |
terminal: list[tuple[int, dict[str, Any]]] = []
|
| 3796 |
for index, event in enumerate(_jsonl_events(stdout)):
|
|
@@ -3827,31 +3805,61 @@ def extract_token_usage(stdout: str) -> dict[str, Any]:
|
|
| 3827 |
}
|
| 3828 |
|
| 3829 |
|
| 3830 |
-
def extract_trace_efficiency(stdout: str) -> dict[str, int]:
|
|
|
|
| 3831 |
completed_items = [
|
| 3832 |
event["item"]
|
| 3833 |
-
for event in
|
| 3834 |
if event.get("type") == "item.completed" and isinstance(event.get("item"), dict)
|
| 3835 |
]
|
| 3836 |
commands = [item for item in completed_items if item.get("type") == "command_execution"]
|
| 3837 |
messages = [item for item in completed_items if item.get("type") == "agent_message"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3838 |
command_outputs = [
|
| 3839 |
-
len(
|
|
|
|
|
|
|
| 3840 |
]
|
| 3841 |
-
normalized_commands = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3842 |
return {
|
| 3843 |
-
"
|
| 3844 |
-
"
|
| 3845 |
-
"
|
| 3846 |
-
"
|
| 3847 |
-
"
|
| 3848 |
-
"
|
| 3849 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3850 |
),
|
| 3851 |
-
"repeated_tool_command_count":
|
| 3852 |
-
|
| 3853 |
-
|
| 3854 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3855 |
),
|
| 3856 |
}
|
| 3857 |
|
|
@@ -4139,7 +4147,6 @@ def production_agent_env(
|
|
| 4139 |
{
|
| 4140 |
"CODEX_HOME": str(home),
|
| 4141 |
"HOME": str(home),
|
| 4142 |
-
"USERPROFILE": str(home),
|
| 4143 |
"TEMP": str(temp),
|
| 4144 |
"TMP": str(temp),
|
| 4145 |
"TMPDIR": str(temp),
|
|
@@ -5733,8 +5740,6 @@ def python_dependencies_sha256(python_executable: str | Path) -> str:
|
|
| 5733 |
|
| 5734 |
|
| 5735 |
def _fsync_directory(path: Path) -> None:
|
| 5736 |
-
if os.name == "nt":
|
| 5737 |
-
return
|
| 5738 |
if not hasattr(os, "O_DIRECTORY") or not hasattr(os, "O_NOFOLLOW"):
|
| 5739 |
raise RuntimeError("durable official campaign state is unavailable")
|
| 5740 |
flags = os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW | getattr(os, "O_CLOEXEC", 0)
|
|
@@ -5777,9 +5782,7 @@ def _ensure_owner_only_directory(path: Path, *, label: str) -> Path:
|
|
| 5777 |
raise RuntimeError(f"{label} must be a directory")
|
| 5778 |
if created:
|
| 5779 |
directory.chmod(stat.S_IRWXU)
|
| 5780 |
-
if
|
| 5781 |
-
stat.S_IRWXG | stat.S_IRWXO
|
| 5782 |
-
):
|
| 5783 |
raise RuntimeError(f"{label} must be owner-only")
|
| 5784 |
resolved_directory = directory.resolve(strict=True)
|
| 5785 |
_fsync_directory(resolved_directory)
|
|
@@ -5787,7 +5790,7 @@ def _ensure_owner_only_directory(path: Path, *, label: str) -> Path:
|
|
| 5787 |
|
| 5788 |
if path.is_symlink() or not path.is_dir():
|
| 5789 |
raise RuntimeError(f"{label} must be a directory")
|
| 5790 |
-
if
|
| 5791 |
raise RuntimeError(f"{label} must be owner-only")
|
| 5792 |
resolved = path.resolve(strict=True)
|
| 5793 |
_fsync_directory(resolved)
|
|
@@ -7321,6 +7324,10 @@ def run_trial(
|
|
| 7321 |
"delivered_ids": delivered_ids,
|
| 7322 |
"adopted_ids": used_ids,
|
| 7323 |
"used_ids": used_ids,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7324 |
"context_delivery_verified": (context_delivery_verified if ctx_enabled else None),
|
| 7325 |
"policy_abstention_applied": (policy_abstention_applied if ctx_enabled else None),
|
| 7326 |
"policy_abstention_verified": (policy_abstention_verified if ctx_enabled else None),
|
|
@@ -8494,6 +8501,342 @@ def write_performance_report(
|
|
| 8494 |
return report
|
| 8495 |
|
| 8496 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8497 |
def build_public_holdout_summary(
|
| 8498 |
results: Sequence[Mapping[str, Any]],
|
| 8499 |
performance: Mapping[str, Any],
|
|
@@ -8501,6 +8844,8 @@ def build_public_holdout_summary(
|
|
| 8501 |
) -> dict[str, Any]:
|
| 8502 |
"""Build an aggregate summary with no task, repository, identifier, patch, or path data."""
|
| 8503 |
_require_authenticated_holdout_snapshot(holdout)
|
|
|
|
|
|
|
| 8504 |
|
| 8505 |
def numeric_values(arm: str, field: str) -> list[float]:
|
| 8506 |
return [
|
|
@@ -8509,6 +8854,7 @@ def build_public_holdout_summary(
|
|
| 8509 |
if row.get("arm") == arm
|
| 8510 |
and isinstance(row.get(field), int | float)
|
| 8511 |
and not isinstance(row.get(field), bool)
|
|
|
|
| 8512 |
]
|
| 8513 |
|
| 8514 |
arm_summary: dict[str, Any] = {}
|
|
@@ -8549,36 +8895,67 @@ def build_public_holdout_summary(
|
|
| 8549 |
)
|
| 8550 |
for field in activity_fields
|
| 8551 |
}
|
| 8552 |
-
|
| 8553 |
-
|
| 8554 |
-
|
| 8555 |
-
if
|
| 8556 |
-
|
| 8557 |
-
|
| 8558 |
-
|
| 8559 |
-
|
| 8560 |
-
|
| 8561 |
-
|
| 8562 |
-
|
| 8563 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8564 |
"verification_backend": OFFICIAL_HOLDOUT_BACKEND,
|
| 8565 |
"assigned_arm_count": len(results),
|
| 8566 |
"expected_pair_count": OFFICIAL_CONFIRMATORY_PAIRS,
|
| 8567 |
-
"execution_complete_pair_count":
|
| 8568 |
-
"quality_complete_pair_count":
|
| 8569 |
-
"experiment_valid":
|
| 8570 |
"quality_gate": {
|
| 8571 |
"label": "observed quality preservation",
|
| 8572 |
"criterion": "all assigned arm outcomes observed and passed",
|
| 8573 |
-
"passed":
|
| 8574 |
},
|
| 8575 |
-
"benefit_verdict":
|
| 8576 |
-
"product_benefit_verdict":
|
| 8577 |
"official_repository_claim": official_repository_claim,
|
| 8578 |
-
"median_development_time_ratio":
|
| 8579 |
-
"median_uncached_token_ratio":
|
| 8580 |
"arms": arm_summary,
|
| 8581 |
"entity_type_activity": activity,
|
|
|
|
| 8582 |
"privacy": {
|
| 8583 |
"contains_scenario_identifiers": False,
|
| 8584 |
"contains_repository_identifiers": False,
|
|
@@ -8586,8 +8963,15 @@ def build_public_holdout_summary(
|
|
| 8586 |
"contains_hidden_tests": False,
|
| 8587 |
"contains_reference_or_model_patches": False,
|
| 8588 |
"contains_private_paths": False,
|
|
|
|
| 8589 |
},
|
| 8590 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8591 |
|
| 8592 |
|
| 8593 |
def write_public_holdout_summary(
|
|
@@ -9295,12 +9679,16 @@ def _run_main(
|
|
| 9295 |
)
|
| 9296 |
result = {
|
| 9297 |
"scenario": scenario.id,
|
|
|
|
| 9298 |
"arm": arm,
|
| 9299 |
"trial": trial,
|
| 9300 |
"retry": retry,
|
| 9301 |
"attempt": attempt,
|
| 9302 |
"status": "harness_error",
|
| 9303 |
"error": f"{type(exc).__name__}: {exc}",
|
|
|
|
|
|
|
|
|
|
| 9304 |
"endpoint_class": "not_evaluated",
|
| 9305 |
"evidence_level": "harness_error",
|
| 9306 |
"production_efficiency_eligible": False,
|
|
@@ -9312,10 +9700,7 @@ def _run_main(
|
|
| 9312 |
"provider_authentication_verified": False,
|
| 9313 |
"provider_response_success": False,
|
| 9314 |
}
|
| 9315 |
-
if
|
| 9316 |
-
args.engine == PRODUCTION_CATALOG_ENGINE
|
| 9317 |
-
and result.get("status") != "harness_error"
|
| 9318 |
-
):
|
| 9319 |
result = _VerifiedProductionResult(result)
|
| 9320 |
results.append(result)
|
| 9321 |
write_summary(output, results)
|
|
|
|
| 26 |
from collections.abc import Mapping, Sequence
|
| 27 |
from dataclasses import dataclass
|
| 28 |
from datetime import UTC, datetime
|
| 29 |
+
from math import comb, isfinite
|
| 30 |
from pathlib import Path, PurePosixPath
|
| 31 |
from statistics import median
|
| 32 |
from typing import Any
|
|
|
|
| 35 |
|
| 36 |
ROOT = Path(__file__).resolve().parents[1]
|
| 37 |
DEFAULT_SCENARIOS = ROOT / "benchmarks" / "ctx_ab" / "scenarios.yaml"
|
| 38 |
+
DESCRIPTIVE_METRICS_CONTRACT = ROOT / "benchmarks" / "ctx_ab" / "descriptive-metrics-v1.json"
|
| 39 |
+
DESCRIPTIVE_METRICS_CONTRACT_SHA256 = (
|
| 40 |
+
"e230e1d6667d36e0890fff94603c156fd918652ad83aab6e7df5542b71b8c3e4"
|
| 41 |
+
)
|
| 42 |
ORIGINAL_CODEX_HOME = os.environ.get("CODEX_HOME", str(Path.home() / ".codex"))
|
| 43 |
SAFE_NAME = re.compile(r"^[a-z0-9][a-z0-9_-]{0,127}$")
|
| 44 |
GITHUB_REPO_URL = re.compile(r"https://github\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+\.git")
|
|
|
|
| 98 |
OFFICIAL_CONFIRMATORY_PAIRS = 30
|
| 99 |
OFFICIAL_CONFIRMATORY_FIRST_ARM_COUNT = 15
|
| 100 |
OFFICIAL_SANDBOX_CONTRACT = "codex-managed-workspace-write-network-denied-v1"
|
| 101 |
+
DESCRIPTIVE_RECORD_SCHEMA_VERSION = 1
|
| 102 |
+
DESCRIPTIVE_PUBLIC_SCHEMA_VERSION = 1
|
| 103 |
+
PUBLIC_HOLDOUT_SUMMARY_SCHEMA_VERSION = 2
|
| 104 |
PRODUCT_CLAIM_MIN_SCENARIOS = 6
|
| 105 |
PRODUCT_CLAIM_MIN_REPOSITORIES = 5
|
| 106 |
PRODUCT_CLAIM_MIN_TRIALS = 6
|
|
|
|
| 649 |
raise ValueError(f"{label} is unavailable") from exc
|
| 650 |
if not stat.S_ISREG(mode):
|
| 651 |
raise ValueError(f"{label} must be a regular file")
|
| 652 |
+
if private and stat.S_IMODE(mode) & (stat.S_IRWXG | stat.S_IRWXO):
|
| 653 |
raise ValueError(f"{label} must be owner-only")
|
| 654 |
observed = _sha256_bytes(data)
|
| 655 |
if not secrets.compare_digest(observed, expected):
|
|
|
|
| 1814 |
|
| 1815 |
|
| 1816 |
def _descendant_pids(root_pid: int) -> list[int]:
|
|
|
|
|
|
|
| 1817 |
try:
|
| 1818 |
result = subprocess.run(
|
| 1819 |
["/bin/ps", "-axo", "pid=,ppid="],
|
|
|
|
| 1842 |
|
| 1843 |
|
| 1844 |
def _signal_process_tree(process: subprocess.Popen[str], sig: signal.Signals) -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1845 |
descendants = _descendant_pids(process.pid)
|
| 1846 |
try:
|
| 1847 |
os.killpg(process.pid, sig)
|
|
|
|
| 1876 |
|
| 1877 |
|
| 1878 |
def _marked_process_pids(token: str) -> tuple[set[int], str | None]:
|
|
|
|
|
|
|
| 1879 |
try:
|
| 1880 |
result = subprocess.run(
|
| 1881 |
["/bin/ps", "eww", "-A", "-o", "pid=", "-o", "args="],
|
|
|
|
| 1963 |
stdin=subprocess.PIPE if input_text is not None else subprocess.DEVNULL,
|
| 1964 |
stdout=subprocess.PIPE,
|
| 1965 |
stderr=subprocess.PIPE,
|
| 1966 |
+
start_new_session=True,
|
| 1967 |
+
preexec_fn=_verification_limits if resource_limits else None,
|
| 1968 |
)
|
| 1969 |
timed_out = False
|
| 1970 |
reaped = 0
|
|
|
|
| 2193 |
parts = Path(safe_relative).parts
|
| 2194 |
if not parts:
|
| 2195 |
raise RuntimeError("benchmark-owned test path has no filename")
|
| 2196 |
+
if not hasattr(os, "O_DIRECTORY") or not hasattr(os, "O_NOFOLLOW"):
|
| 2197 |
raise RuntimeError("secure evaluator path operations are unavailable")
|
| 2198 |
flags = os.O_RDONLY | getattr(os, "O_CLOEXEC", 0) | os.O_DIRECTORY | os.O_NOFOLLOW
|
| 2199 |
descriptor = os.open(workspace, flags)
|
|
|
|
| 2214 |
|
| 2215 |
|
| 2216 |
def _relative_regular_bytes(workspace: Path, relative: str) -> bytes | None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2217 |
try:
|
| 2218 |
parent_fd, leaf = _open_relative_parent(workspace, relative, create=False)
|
| 2219 |
except FileNotFoundError:
|
|
|
|
| 2237 |
|
| 2238 |
|
| 2239 |
def _write_evaluator_atomically(workspace: Path, relative: str, body: bytes) -> None:
|
| 2240 |
+
try:
|
| 2241 |
+
parent_fd, leaf = _open_relative_parent(workspace, relative, create=True)
|
| 2242 |
+
except OSError as exc:
|
| 2243 |
+
raise RuntimeError("benchmark-owned test path contains an unsafe component") from exc
|
| 2244 |
+
temporary_entry = f".{leaf}.ctx-{secrets.token_hex(8)}"
|
| 2245 |
+
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2246 |
try:
|
| 2247 |
+
existing = os.stat(leaf, dir_fd=parent_fd, follow_symlinks=False)
|
| 2248 |
+
except FileNotFoundError:
|
| 2249 |
+
existing = None
|
| 2250 |
+
if existing is not None and not stat.S_ISREG(existing.st_mode):
|
| 2251 |
+
raise RuntimeError("benchmark-owned test path is a symlink or unsafe file")
|
| 2252 |
+
flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL | getattr(os, "O_CLOEXEC", 0) | os.O_NOFOLLOW
|
| 2253 |
+
descriptor = os.open(temporary_entry, flags, 0o600, dir_fd=parent_fd)
|
| 2254 |
+
with os.fdopen(descriptor, "wb") as fh:
|
| 2255 |
+
fh.write(body)
|
| 2256 |
+
fh.flush()
|
| 2257 |
+
os.fsync(fh.fileno())
|
| 2258 |
+
os.replace(
|
| 2259 |
+
temporary_entry,
|
| 2260 |
+
leaf,
|
| 2261 |
+
src_dir_fd=parent_fd,
|
| 2262 |
+
dst_dir_fd=parent_fd,
|
| 2263 |
+
)
|
| 2264 |
+
temporary_entry = ""
|
| 2265 |
+
finally:
|
| 2266 |
+
if temporary_entry:
|
| 2267 |
try:
|
| 2268 |
+
os.unlink(temporary_entry, dir_fd=parent_fd)
|
| 2269 |
except FileNotFoundError:
|
| 2270 |
+
pass
|
| 2271 |
+
os.close(parent_fd)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2272 |
|
| 2273 |
materialized = _relative_regular_bytes(workspace, relative)
|
| 2274 |
if materialized != body:
|
|
|
|
| 2752 |
env = {
|
| 2753 |
key: os.environ[key]
|
| 2754 |
for key in (
|
|
|
|
| 2755 |
"LANG",
|
| 2756 |
"LC_ALL",
|
| 2757 |
"LC_CTYPE",
|
| 2758 |
"PATH",
|
|
|
|
| 2759 |
"SSL_CERT_DIR",
|
| 2760 |
"SSL_CERT_FILE",
|
|
|
|
|
|
|
| 2761 |
)
|
| 2762 |
if os.environ.get(key)
|
| 2763 |
}
|
| 2764 |
env.update(
|
| 2765 |
{
|
| 2766 |
"HOME": str(home),
|
|
|
|
| 2767 |
"TEMP": str(tmp),
|
| 2768 |
"TMP": str(tmp),
|
| 2769 |
"TMPDIR": str(tmp),
|
|
|
|
| 3738 |
return events
|
| 3739 |
|
| 3740 |
|
| 3741 |
+
def _complete_jsonl_trace(stdout: str) -> tuple[list[dict[str, Any]], bool]:
|
| 3742 |
+
"""Parse a complete Codex JSONL trace without hiding malformed records."""
|
| 3743 |
+
events: list[dict[str, Any]] = []
|
| 3744 |
+
malformed = False
|
| 3745 |
+
for line in stdout.splitlines():
|
| 3746 |
+
if not line.strip():
|
| 3747 |
+
continue
|
| 3748 |
+
try:
|
| 3749 |
+
value = json.loads(line)
|
| 3750 |
+
except json.JSONDecodeError:
|
| 3751 |
+
malformed = True
|
| 3752 |
+
continue
|
| 3753 |
+
if not isinstance(value, dict):
|
| 3754 |
+
malformed = True
|
| 3755 |
+
continue
|
| 3756 |
+
event_type = value.get("type")
|
| 3757 |
+
if not isinstance(event_type, str) or not event_type:
|
| 3758 |
+
malformed = True
|
| 3759 |
+
if event_type == "item.completed":
|
| 3760 |
+
item = value.get("item")
|
| 3761 |
+
if (
|
| 3762 |
+
not isinstance(item, dict)
|
| 3763 |
+
or not isinstance(item.get("type"), str)
|
| 3764 |
+
or not item.get("type")
|
| 3765 |
+
):
|
| 3766 |
+
malformed = True
|
| 3767 |
+
events.append(value)
|
| 3768 |
+
terminal = bool(events and events[-1].get("type") == "turn.completed")
|
| 3769 |
+
return events, bool(events and terminal and not malformed)
|
| 3770 |
+
|
| 3771 |
+
|
| 3772 |
def extract_token_usage(stdout: str) -> dict[str, Any]:
|
| 3773 |
terminal: list[tuple[int, dict[str, Any]]] = []
|
| 3774 |
for index, event in enumerate(_jsonl_events(stdout)):
|
|
|
|
| 3805 |
}
|
| 3806 |
|
| 3807 |
|
| 3808 |
+
def extract_trace_efficiency(stdout: str) -> dict[str, int | bool | None]:
|
| 3809 |
+
events, trace_complete = _complete_jsonl_trace(stdout)
|
| 3810 |
completed_items = [
|
| 3811 |
event["item"]
|
| 3812 |
+
for event in events
|
| 3813 |
if event.get("type") == "item.completed" and isinstance(event.get("item"), dict)
|
| 3814 |
]
|
| 3815 |
commands = [item for item in completed_items if item.get("type") == "command_execution"]
|
| 3816 |
messages = [item for item in completed_items if item.get("type") == "agent_message"]
|
| 3817 |
+
exit_codes = [
|
| 3818 |
+
item["exit_code"]
|
| 3819 |
+
for item in commands
|
| 3820 |
+
if isinstance(item.get("exit_code"), int) and not isinstance(item.get("exit_code"), bool)
|
| 3821 |
+
]
|
| 3822 |
command_outputs = [
|
| 3823 |
+
len(item["aggregated_output"].encode("utf-8"))
|
| 3824 |
+
for item in commands
|
| 3825 |
+
if isinstance(item.get("aggregated_output"), str)
|
| 3826 |
]
|
| 3827 |
+
normalized_commands = [
|
| 3828 |
+
" ".join(item["command"].split())
|
| 3829 |
+
for item in commands
|
| 3830 |
+
if isinstance(item.get("command"), str)
|
| 3831 |
+
]
|
| 3832 |
+
exit_codes_complete = trace_complete and len(exit_codes) == len(commands)
|
| 3833 |
+
outputs_complete = trace_complete and len(command_outputs) == len(commands)
|
| 3834 |
+
command_text_complete = trace_complete and len(normalized_commands) == len(commands)
|
| 3835 |
return {
|
| 3836 |
+
"descriptive_record_schema_version": DESCRIPTIVE_RECORD_SCHEMA_VERSION,
|
| 3837 |
+
"descriptive_trace_complete": trace_complete,
|
| 3838 |
+
"completed_item_count": len(completed_items) if trace_complete else None,
|
| 3839 |
+
"tool_command_count": len(commands) if trace_complete else None,
|
| 3840 |
+
"tool_command_exit_code_known_count": len(exit_codes),
|
| 3841 |
+
"tool_command_output_known_count": len(command_outputs),
|
| 3842 |
+
"tool_command_text_known_count": len(normalized_commands),
|
| 3843 |
+
"tool_failure_count": (
|
| 3844 |
+
sum(exit_code != 0 for exit_code in exit_codes) if exit_codes_complete else None
|
| 3845 |
+
),
|
| 3846 |
+
"tool_output_bytes": sum(command_outputs) if outputs_complete else None,
|
| 3847 |
+
"max_tool_output_bytes": max(command_outputs, default=0) if outputs_complete else None,
|
| 3848 |
+
"oversized_tool_output_count": (
|
| 3849 |
+
sum(size > PRODUCTION_TOOL_OUTPUT_LIMIT_BYTES for size in command_outputs)
|
| 3850 |
+
if outputs_complete
|
| 3851 |
+
else None
|
| 3852 |
),
|
| 3853 |
+
"repeated_tool_command_count": (
|
| 3854 |
+
len(normalized_commands) - len(set(normalized_commands))
|
| 3855 |
+
if command_text_complete
|
| 3856 |
+
else None
|
| 3857 |
+
),
|
| 3858 |
+
"agent_message_count": len(messages) if trace_complete else None,
|
| 3859 |
+
"agent_message_bytes": (
|
| 3860 |
+
sum(len(str(item.get("text") or "").encode("utf-8")) for item in messages)
|
| 3861 |
+
if trace_complete
|
| 3862 |
+
else None
|
| 3863 |
),
|
| 3864 |
}
|
| 3865 |
|
|
|
|
| 4147 |
{
|
| 4148 |
"CODEX_HOME": str(home),
|
| 4149 |
"HOME": str(home),
|
|
|
|
| 4150 |
"TEMP": str(temp),
|
| 4151 |
"TMP": str(temp),
|
| 4152 |
"TMPDIR": str(temp),
|
|
|
|
| 5740 |
|
| 5741 |
|
| 5742 |
def _fsync_directory(path: Path) -> None:
|
|
|
|
|
|
|
| 5743 |
if not hasattr(os, "O_DIRECTORY") or not hasattr(os, "O_NOFOLLOW"):
|
| 5744 |
raise RuntimeError("durable official campaign state is unavailable")
|
| 5745 |
flags = os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW | getattr(os, "O_CLOEXEC", 0)
|
|
|
|
| 5782 |
raise RuntimeError(f"{label} must be a directory")
|
| 5783 |
if created:
|
| 5784 |
directory.chmod(stat.S_IRWXU)
|
| 5785 |
+
if stat.S_IMODE(directory.stat().st_mode) & (stat.S_IRWXG | stat.S_IRWXO):
|
|
|
|
|
|
|
| 5786 |
raise RuntimeError(f"{label} must be owner-only")
|
| 5787 |
resolved_directory = directory.resolve(strict=True)
|
| 5788 |
_fsync_directory(resolved_directory)
|
|
|
|
| 5790 |
|
| 5791 |
if path.is_symlink() or not path.is_dir():
|
| 5792 |
raise RuntimeError(f"{label} must be a directory")
|
| 5793 |
+
if stat.S_IMODE(path.stat().st_mode) & (stat.S_IRWXG | stat.S_IRWXO):
|
| 5794 |
raise RuntimeError(f"{label} must be owner-only")
|
| 5795 |
resolved = path.resolve(strict=True)
|
| 5796 |
_fsync_directory(resolved)
|
|
|
|
| 7324 |
"delivered_ids": delivered_ids,
|
| 7325 |
"adopted_ids": used_ids,
|
| 7326 |
"used_ids": used_ids,
|
| 7327 |
+
"recommendation_invocation_verified": (
|
| 7328 |
+
bool(catalog is not None) if production_catalog and ctx_enabled else None
|
| 7329 |
+
),
|
| 7330 |
+
"semantic_context_use_verified": None,
|
| 7331 |
"context_delivery_verified": (context_delivery_verified if ctx_enabled else None),
|
| 7332 |
"policy_abstention_applied": (policy_abstention_applied if ctx_enabled else None),
|
| 7333 |
"policy_abstention_verified": (policy_abstention_verified if ctx_enabled else None),
|
|
|
|
| 8501 |
return report
|
| 8502 |
|
| 8503 |
|
| 8504 |
+
def _nonnegative_int(value: object) -> int | None:
|
| 8505 |
+
if isinstance(value, int) and not isinstance(value, bool) and value >= 0:
|
| 8506 |
+
return value
|
| 8507 |
+
return None
|
| 8508 |
+
|
| 8509 |
+
|
| 8510 |
+
def _descriptive_metrics_contract() -> Mapping[str, Any]:
|
| 8511 |
+
try:
|
| 8512 |
+
content = DESCRIPTIVE_METRICS_CONTRACT.read_bytes()
|
| 8513 |
+
except OSError as exc:
|
| 8514 |
+
raise ValueError("descriptive metrics contract is unavailable") from exc
|
| 8515 |
+
if not secrets.compare_digest(
|
| 8516 |
+
hashlib.sha256(content).hexdigest(),
|
| 8517 |
+
DESCRIPTIVE_METRICS_CONTRACT_SHA256,
|
| 8518 |
+
):
|
| 8519 |
+
raise ValueError("descriptive metrics contract changed after preregistration")
|
| 8520 |
+
try:
|
| 8521 |
+
contract = json.loads(content)
|
| 8522 |
+
except json.JSONDecodeError as exc:
|
| 8523 |
+
raise ValueError("descriptive metrics contract is invalid JSON") from exc
|
| 8524 |
+
if not isinstance(contract, dict):
|
| 8525 |
+
raise ValueError("descriptive metrics contract must be an object")
|
| 8526 |
+
return contract
|
| 8527 |
+
|
| 8528 |
+
|
| 8529 |
+
def _valid_string_list(value: object) -> list[str] | None:
|
| 8530 |
+
if (
|
| 8531 |
+
isinstance(value, list)
|
| 8532 |
+
and all(isinstance(item, str) and item for item in value)
|
| 8533 |
+
and len(set(value)) == len(value)
|
| 8534 |
+
):
|
| 8535 |
+
return value
|
| 8536 |
+
return None
|
| 8537 |
+
|
| 8538 |
+
|
| 8539 |
+
def _descriptive_arm_rows(
|
| 8540 |
+
results: Sequence[Mapping[str, Any]],
|
| 8541 |
+
holdout: ExecutionFrozenHoldout,
|
| 8542 |
+
) -> dict[tuple[str, int, str], Mapping[str, Any]] | None:
|
| 8543 |
+
expected = {
|
| 8544 |
+
(str(assignment["scenario"]), int(assignment["trial"]), str(arm))
|
| 8545 |
+
for assignment in holdout.schedule.assignments
|
| 8546 |
+
for arm in assignment["arms"]
|
| 8547 |
+
}
|
| 8548 |
+
observed: dict[tuple[str, int, str], Mapping[str, Any]] = {}
|
| 8549 |
+
for row in results:
|
| 8550 |
+
scenario = row.get("scenario")
|
| 8551 |
+
trial = row.get("trial")
|
| 8552 |
+
arm = row.get("arm")
|
| 8553 |
+
if (
|
| 8554 |
+
not isinstance(scenario, str)
|
| 8555 |
+
or not isinstance(trial, int)
|
| 8556 |
+
or isinstance(trial, bool)
|
| 8557 |
+
or arm not in OFFICIAL_TREATMENT_ARMS
|
| 8558 |
+
):
|
| 8559 |
+
continue
|
| 8560 |
+
key = (scenario, trial, str(arm))
|
| 8561 |
+
if key in observed:
|
| 8562 |
+
raise ValueError("duplicate descriptive arm record")
|
| 8563 |
+
observed[key] = row
|
| 8564 |
+
if set(observed) != expected or len(results) != len(expected):
|
| 8565 |
+
return None
|
| 8566 |
+
if any(
|
| 8567 |
+
not isinstance(row, _VerifiedProductionResult) or not row.is_sealed()
|
| 8568 |
+
for row in observed.values()
|
| 8569 |
+
):
|
| 8570 |
+
return None
|
| 8571 |
+
return observed
|
| 8572 |
+
|
| 8573 |
+
|
| 8574 |
+
def _command_metric(row: Mapping[str, Any], field: str) -> int | None:
|
| 8575 |
+
if (
|
| 8576 |
+
row.get("descriptive_record_schema_version") != DESCRIPTIVE_RECORD_SCHEMA_VERSION
|
| 8577 |
+
or row.get("descriptive_trace_complete") is not True
|
| 8578 |
+
):
|
| 8579 |
+
return None
|
| 8580 |
+
command_count = _nonnegative_int(row.get("tool_command_count"))
|
| 8581 |
+
if command_count is None:
|
| 8582 |
+
return None
|
| 8583 |
+
if field == "tool_command_count":
|
| 8584 |
+
return command_count
|
| 8585 |
+
if field == "tool_command_exit_code_known_count":
|
| 8586 |
+
known_count = _nonnegative_int(row.get(field))
|
| 8587 |
+
return known_count if known_count is not None and known_count <= command_count else None
|
| 8588 |
+
required_known_field = {
|
| 8589 |
+
"tool_failure_count": "tool_command_exit_code_known_count",
|
| 8590 |
+
"tool_output_bytes": "tool_command_output_known_count",
|
| 8591 |
+
"repeated_tool_command_count": "tool_command_text_known_count",
|
| 8592 |
+
}[field]
|
| 8593 |
+
if _nonnegative_int(row.get(required_known_field)) != command_count:
|
| 8594 |
+
return None
|
| 8595 |
+
value = _nonnegative_int(row.get(field))
|
| 8596 |
+
if value is None:
|
| 8597 |
+
return None
|
| 8598 |
+
if field in {"tool_failure_count", "repeated_tool_command_count"} and value > command_count:
|
| 8599 |
+
return None
|
| 8600 |
+
return value
|
| 8601 |
+
|
| 8602 |
+
|
| 8603 |
+
def _arm_count_summary(
|
| 8604 |
+
rows: Sequence[Mapping[str, Any]],
|
| 8605 |
+
getter: Any,
|
| 8606 |
+
) -> dict[str, int | float | None]:
|
| 8607 |
+
values = [value for row in rows if (value := getter(row)) is not None]
|
| 8608 |
+
return {
|
| 8609 |
+
"assigned_n": len(rows),
|
| 8610 |
+
"known_n": len(values),
|
| 8611 |
+
"missing_n": len(rows) - len(values),
|
| 8612 |
+
"total": sum(values) if values else None,
|
| 8613 |
+
"median": round(float(median(values)), 6) if values else None,
|
| 8614 |
+
}
|
| 8615 |
+
|
| 8616 |
+
|
| 8617 |
+
def _paired_difference_summary(
|
| 8618 |
+
rows: Mapping[tuple[str, int, str], Mapping[str, Any]],
|
| 8619 |
+
getter: Any,
|
| 8620 |
+
) -> dict[str, int | float | None]:
|
| 8621 |
+
pair_keys = sorted({(scenario, trial) for scenario, trial, _arm in rows})
|
| 8622 |
+
differences: list[int] = []
|
| 8623 |
+
for scenario, trial in pair_keys:
|
| 8624 |
+
baseline = getter(rows[(scenario, trial, "baseline")])
|
| 8625 |
+
ctx_light = getter(rows[(scenario, trial, "ctx-light")])
|
| 8626 |
+
if baseline is not None and ctx_light is not None:
|
| 8627 |
+
differences.append(ctx_light - baseline)
|
| 8628 |
+
return {
|
| 8629 |
+
"assigned_pair_n": len(pair_keys),
|
| 8630 |
+
"complete_pair_n": len(differences),
|
| 8631 |
+
"missing_pair_n": len(pair_keys) - len(differences),
|
| 8632 |
+
"median_ctx_minus_baseline": (
|
| 8633 |
+
round(float(median(differences)), 6) if differences else None
|
| 8634 |
+
),
|
| 8635 |
+
"ctx_lower_pair_n": sum(value < 0 for value in differences),
|
| 8636 |
+
"equal_pair_n": sum(value == 0 for value in differences),
|
| 8637 |
+
"ctx_higher_pair_n": sum(value > 0 for value in differences),
|
| 8638 |
+
}
|
| 8639 |
+
|
| 8640 |
+
|
| 8641 |
+
def _both_arm_metric(
|
| 8642 |
+
rows: Mapping[tuple[str, int, str], Mapping[str, Any]],
|
| 8643 |
+
getter: Any,
|
| 8644 |
+
) -> dict[str, Any]:
|
| 8645 |
+
return {
|
| 8646 |
+
"arms": {
|
| 8647 |
+
arm: _arm_count_summary(
|
| 8648 |
+
[row for (_scenario, _trial, row_arm), row in rows.items() if row_arm == arm],
|
| 8649 |
+
getter,
|
| 8650 |
+
)
|
| 8651 |
+
for arm in OFFICIAL_TREATMENT_ARMS
|
| 8652 |
+
},
|
| 8653 |
+
"pairs": _paired_difference_summary(rows, getter),
|
| 8654 |
+
}
|
| 8655 |
+
|
| 8656 |
+
|
| 8657 |
+
def _binary_pair_summary(
|
| 8658 |
+
rows: Mapping[tuple[str, int, str], Mapping[str, Any]],
|
| 8659 |
+
getter: Any,
|
| 8660 |
+
) -> dict[str, int]:
|
| 8661 |
+
pair_keys = sorted({(scenario, trial) for scenario, trial, _arm in rows})
|
| 8662 |
+
pairs: list[tuple[int, int]] = []
|
| 8663 |
+
for scenario, trial in pair_keys:
|
| 8664 |
+
baseline = getter(rows[(scenario, trial, "baseline")])
|
| 8665 |
+
ctx_light = getter(rows[(scenario, trial, "ctx-light")])
|
| 8666 |
+
if baseline is not None and ctx_light is not None:
|
| 8667 |
+
pairs.append((baseline, ctx_light))
|
| 8668 |
+
return {
|
| 8669 |
+
"assigned_pair_n": len(pair_keys),
|
| 8670 |
+
"complete_pair_n": len(pairs),
|
| 8671 |
+
"missing_pair_n": len(pair_keys) - len(pairs),
|
| 8672 |
+
"baseline_false_ctx_false_n": pairs.count((0, 0)),
|
| 8673 |
+
"baseline_true_ctx_false_n": pairs.count((1, 0)),
|
| 8674 |
+
"baseline_false_ctx_true_n": pairs.count((0, 1)),
|
| 8675 |
+
"baseline_true_ctx_true_n": pairs.count((1, 1)),
|
| 8676 |
+
}
|
| 8677 |
+
|
| 8678 |
+
|
| 8679 |
+
def _ctx_recommendation_invocation(row: Mapping[str, Any]) -> int | None:
|
| 8680 |
+
return 1 if row.get("recommendation_invocation_verified") is True else None
|
| 8681 |
+
|
| 8682 |
+
|
| 8683 |
+
def _ctx_candidate_count(row: Mapping[str, Any]) -> int | None:
|
| 8684 |
+
if row.get("recommendation_invocation_verified") is not True:
|
| 8685 |
+
return None
|
| 8686 |
+
values = _valid_string_list(row.get("candidate_ids"))
|
| 8687 |
+
return len(values) if values is not None else None
|
| 8688 |
+
|
| 8689 |
+
|
| 8690 |
+
def _ctx_selected_count(row: Mapping[str, Any]) -> int | None:
|
| 8691 |
+
if row.get("policy_abstention_verified") is True:
|
| 8692 |
+
values = _valid_string_list(row.get("selected_ids"))
|
| 8693 |
+
return 0 if values == [] else None
|
| 8694 |
+
if row.get("context_delivery_verified") is not True:
|
| 8695 |
+
return None
|
| 8696 |
+
values = _valid_string_list(row.get("selected_ids"))
|
| 8697 |
+
return len(values) if values is not None else None
|
| 8698 |
+
|
| 8699 |
+
|
| 8700 |
+
def _ctx_delivered_count(row: Mapping[str, Any]) -> int | None:
|
| 8701 |
+
if row.get("policy_abstention_verified") is True:
|
| 8702 |
+
values = _valid_string_list(row.get("delivered_ids"))
|
| 8703 |
+
return 0 if values == [] else None
|
| 8704 |
+
if row.get("context_delivery_verified") is not True:
|
| 8705 |
+
return None
|
| 8706 |
+
values = _valid_string_list(row.get("delivered_ids"))
|
| 8707 |
+
return len(values) if values is not None else None
|
| 8708 |
+
|
| 8709 |
+
|
| 8710 |
+
def _ctx_semantic_use_count(row: Mapping[str, Any]) -> int | None:
|
| 8711 |
+
if row.get("policy_abstention_verified") is True:
|
| 8712 |
+
values = _valid_string_list(row.get("used_ids"))
|
| 8713 |
+
return 0 if values == [] else None
|
| 8714 |
+
if (
|
| 8715 |
+
row.get("context_delivery_verified") is not True
|
| 8716 |
+
or row.get("semantic_context_use_verified") is not True
|
| 8717 |
+
):
|
| 8718 |
+
return None
|
| 8719 |
+
values = _valid_string_list(row.get("used_ids"))
|
| 8720 |
+
return len(values) if values is not None else None
|
| 8721 |
+
|
| 8722 |
+
|
| 8723 |
+
def _closed_lifecycle_actions(row: Mapping[str, Any]) -> list[str] | None:
|
| 8724 |
+
actions = row.get("lifecycle_actions")
|
| 8725 |
+
digest = row.get("lifecycle_sha256")
|
| 8726 |
+
if (
|
| 8727 |
+
not isinstance(actions, list)
|
| 8728 |
+
or not actions
|
| 8729 |
+
or not all(isinstance(action, str) for action in actions)
|
| 8730 |
+
or actions[-1] != "session_end"
|
| 8731 |
+
or not isinstance(digest, str)
|
| 8732 |
+
or re.fullmatch(r"[0-9a-f]{64}", digest) is None
|
| 8733 |
+
or not isinstance(row.get("lifecycle_session_status"), str)
|
| 8734 |
+
or not row.get("lifecycle_session_status")
|
| 8735 |
+
or row.get("final_loaded") != []
|
| 8736 |
+
):
|
| 8737 |
+
return None
|
| 8738 |
+
return actions
|
| 8739 |
+
|
| 8740 |
+
|
| 8741 |
+
def _lifecycle_action_count(row: Mapping[str, Any], action: str) -> int | None:
|
| 8742 |
+
actions = _closed_lifecycle_actions(row)
|
| 8743 |
+
return actions.count(action) if actions is not None else None
|
| 8744 |
+
|
| 8745 |
+
|
| 8746 |
+
def _boolean_event(row: Mapping[str, Any], field: str) -> int | None:
|
| 8747 |
+
value = row.get(field)
|
| 8748 |
+
return int(value) if isinstance(value, bool) else None
|
| 8749 |
+
|
| 8750 |
+
|
| 8751 |
+
def _nonzero_returncode(row: Mapping[str, Any], field: str) -> int | None:
|
| 8752 |
+
value = row.get(field)
|
| 8753 |
+
if not isinstance(value, int) or isinstance(value, bool):
|
| 8754 |
+
return None
|
| 8755 |
+
return int(value != 0)
|
| 8756 |
+
|
| 8757 |
+
|
| 8758 |
+
def _harness_error(row: Mapping[str, Any]) -> int | None:
|
| 8759 |
+
status = row.get("status")
|
| 8760 |
+
if status not in {"passed", "failed", "harness_error"}:
|
| 8761 |
+
return None
|
| 8762 |
+
return int(status == "harness_error")
|
| 8763 |
+
|
| 8764 |
+
|
| 8765 |
+
def _descriptive_holdout_metrics(
|
| 8766 |
+
rows: Mapping[tuple[str, int, str], Mapping[str, Any]],
|
| 8767 |
+
contract: Mapping[str, Any],
|
| 8768 |
+
) -> dict[str, Any]:
|
| 8769 |
+
ctx_rows = [row for (_scenario, _trial, arm), row in rows.items() if arm == "ctx-light"]
|
| 8770 |
+
raw_contract = contract["raw_arm_record"]
|
| 8771 |
+
command_contract = raw_contract["completed_shell_command_executions"]
|
| 8772 |
+
command_fields = {
|
| 8773 |
+
"calls": command_contract["calls_field"],
|
| 8774 |
+
"exit_code_known_calls": command_contract["exit_code_known_calls_field"],
|
| 8775 |
+
"failed_calls": command_contract["failed_calls_field"],
|
| 8776 |
+
"output_bytes": command_contract["output_bytes_field"],
|
| 8777 |
+
"repeated_calls": command_contract["repeated_calls_field"],
|
| 8778 |
+
}
|
| 8779 |
+
error_getters = {
|
| 8780 |
+
"harness_error": _harness_error,
|
| 8781 |
+
"agent_timeout": lambda row: _boolean_event(row, "agent_timed_out"),
|
| 8782 |
+
"agent_nonzero_returncode": lambda row: _nonzero_returncode(row, "agent_returncode"),
|
| 8783 |
+
"verifier_nonzero_returncode": lambda row: _nonzero_returncode(
|
| 8784 |
+
row, "verification_returncode"
|
| 8785 |
+
),
|
| 8786 |
+
}
|
| 8787 |
+
return {
|
| 8788 |
+
"schema_version": contract["schema_version"],
|
| 8789 |
+
"analysis_role": contract["analysis_role"],
|
| 8790 |
+
"causal_interpretation": contract["causal_interpretation"],
|
| 8791 |
+
"used_by_primary_verdict": contract["used_by_primary_verdict"],
|
| 8792 |
+
"thresholds": contract["thresholds"],
|
| 8793 |
+
"population": {
|
| 8794 |
+
"assigned_arm_n": len(rows),
|
| 8795 |
+
"assigned_pair_n": len(rows) // 2,
|
| 8796 |
+
"outcome_filtering": "none",
|
| 8797 |
+
},
|
| 8798 |
+
"completed_shell_command_executions": {
|
| 8799 |
+
"definition": command_contract["definition"],
|
| 8800 |
+
**{
|
| 8801 |
+
public_name: _both_arm_metric(
|
| 8802 |
+
rows,
|
| 8803 |
+
lambda row, field=raw_field: _command_metric(row, field),
|
| 8804 |
+
)
|
| 8805 |
+
for public_name, raw_field in command_fields.items()
|
| 8806 |
+
},
|
| 8807 |
+
},
|
| 8808 |
+
"ctx_funnel": {
|
| 8809 |
+
"scope": "ctx-light assigned arms",
|
| 8810 |
+
"recommendation_invocation_count": _arm_count_summary(
|
| 8811 |
+
ctx_rows, _ctx_recommendation_invocation
|
| 8812 |
+
),
|
| 8813 |
+
"candidate_count": _arm_count_summary(ctx_rows, _ctx_candidate_count),
|
| 8814 |
+
"selected_count": _arm_count_summary(ctx_rows, _ctx_selected_count),
|
| 8815 |
+
"delivered_count": _arm_count_summary(ctx_rows, _ctx_delivered_count),
|
| 8816 |
+
"semantic_use_count": _arm_count_summary(ctx_rows, _ctx_semantic_use_count),
|
| 8817 |
+
},
|
| 8818 |
+
"lifecycle_events": {
|
| 8819 |
+
"scope": "ctx-light arms with a closed authenticated lifecycle",
|
| 8820 |
+
**{
|
| 8821 |
+
f"{action}_count": _arm_count_summary(
|
| 8822 |
+
ctx_rows,
|
| 8823 |
+
lambda row, lifecycle_action=action: _lifecycle_action_count(
|
| 8824 |
+
row, lifecycle_action
|
| 8825 |
+
),
|
| 8826 |
+
)
|
| 8827 |
+
for action in ("load_applied", "used", "unload_applied")
|
| 8828 |
+
},
|
| 8829 |
+
},
|
| 8830 |
+
"errors": {
|
| 8831 |
+
name: {
|
| 8832 |
+
"arms": _both_arm_metric(rows, getter)["arms"],
|
| 8833 |
+
"pairs": _binary_pair_summary(rows, getter),
|
| 8834 |
+
}
|
| 8835 |
+
for name, getter in error_getters.items()
|
| 8836 |
+
},
|
| 8837 |
+
}
|
| 8838 |
+
|
| 8839 |
+
|
| 8840 |
def build_public_holdout_summary(
|
| 8841 |
results: Sequence[Mapping[str, Any]],
|
| 8842 |
performance: Mapping[str, Any],
|
|
|
|
| 8844 |
) -> dict[str, Any]:
|
| 8845 |
"""Build an aggregate summary with no task, repository, identifier, patch, or path data."""
|
| 8846 |
_require_authenticated_holdout_snapshot(holdout)
|
| 8847 |
+
descriptive_contract = _descriptive_metrics_contract()
|
| 8848 |
+
descriptive_rows = _descriptive_arm_rows(results, holdout)
|
| 8849 |
|
| 8850 |
def numeric_values(arm: str, field: str) -> list[float]:
|
| 8851 |
return [
|
|
|
|
| 8854 |
if row.get("arm") == arm
|
| 8855 |
and isinstance(row.get(field), int | float)
|
| 8856 |
and not isinstance(row.get(field), bool)
|
| 8857 |
+
and isfinite(float(row[field]))
|
| 8858 |
]
|
| 8859 |
|
| 8860 |
arm_summary: dict[str, Any] = {}
|
|
|
|
| 8895 |
)
|
| 8896 |
for field in activity_fields
|
| 8897 |
}
|
| 8898 |
+
|
| 8899 |
+
def public_bool(field: str) -> bool | None:
|
| 8900 |
+
value = performance.get(field)
|
| 8901 |
+
return value if isinstance(value, bool) else None
|
| 8902 |
+
|
| 8903 |
+
def safe_public_number(value: object) -> int | float | None:
|
| 8904 |
+
if (
|
| 8905 |
+
isinstance(value, int | float)
|
| 8906 |
+
and not isinstance(value, bool)
|
| 8907 |
+
and isfinite(float(value))
|
| 8908 |
+
):
|
| 8909 |
+
return value
|
| 8910 |
+
return None
|
| 8911 |
+
|
| 8912 |
+
def public_number(field: str) -> int | float | None:
|
| 8913 |
+
return safe_public_number(performance.get(field))
|
| 8914 |
+
|
| 8915 |
+
def public_verdict(field: str) -> str | None:
|
| 8916 |
+
value = performance.get(field)
|
| 8917 |
+
return value if value in {"beneficial", "not_beneficial"} else None
|
| 8918 |
+
|
| 8919 |
+
raw_claim = performance.get("official_repository_claim")
|
| 8920 |
+
official_repository_claim: dict[str, Any] | None = None
|
| 8921 |
+
if isinstance(raw_claim, Mapping):
|
| 8922 |
+
official_repository_claim = {}
|
| 8923 |
+
for field in (
|
| 8924 |
+
"benefiting_repositories",
|
| 8925 |
+
"exact_one_sided_sign_p",
|
| 8926 |
+
"overall_time_ratio",
|
| 8927 |
+
"overall_token_ratio",
|
| 8928 |
+
"verified_delivery_repositories",
|
| 8929 |
+
):
|
| 8930 |
+
official_repository_claim[field] = safe_public_number(raw_claim.get(field))
|
| 8931 |
+
for field in ("evidence_complete", "incident_free", "passed"):
|
| 8932 |
+
value = raw_claim.get(field)
|
| 8933 |
+
official_repository_claim[field] = value if isinstance(value, bool) else None
|
| 8934 |
+
quality = raw_claim.get("quality_preserved")
|
| 8935 |
+
official_repository_claim["observed_quality_preservation"] = (
|
| 8936 |
+
quality if isinstance(quality, bool) else None
|
| 8937 |
+
)
|
| 8938 |
+
summary = {
|
| 8939 |
+
"schema_version": PUBLIC_HOLDOUT_SUMMARY_SCHEMA_VERSION,
|
| 8940 |
"verification_backend": OFFICIAL_HOLDOUT_BACKEND,
|
| 8941 |
"assigned_arm_count": len(results),
|
| 8942 |
"expected_pair_count": OFFICIAL_CONFIRMATORY_PAIRS,
|
| 8943 |
+
"execution_complete_pair_count": public_number("execution_complete_pair_count"),
|
| 8944 |
+
"quality_complete_pair_count": public_number("quality_complete_pair_count"),
|
| 8945 |
+
"experiment_valid": public_bool("experiment_valid"),
|
| 8946 |
"quality_gate": {
|
| 8947 |
"label": "observed quality preservation",
|
| 8948 |
"criterion": "all assigned arm outcomes observed and passed",
|
| 8949 |
+
"passed": public_bool("quality_preserved"),
|
| 8950 |
},
|
| 8951 |
+
"benefit_verdict": public_verdict("benefit_verdict"),
|
| 8952 |
+
"product_benefit_verdict": public_verdict("product_benefit_verdict"),
|
| 8953 |
"official_repository_claim": official_repository_claim,
|
| 8954 |
+
"median_development_time_ratio": public_number("median_time_ratio"),
|
| 8955 |
+
"median_uncached_token_ratio": public_number("median_uncached_token_ratio"),
|
| 8956 |
"arms": arm_summary,
|
| 8957 |
"entity_type_activity": activity,
|
| 8958 |
+
"descriptive_metrics_published": descriptive_rows is not None,
|
| 8959 |
"privacy": {
|
| 8960 |
"contains_scenario_identifiers": False,
|
| 8961 |
"contains_repository_identifiers": False,
|
|
|
|
| 8963 |
"contains_hidden_tests": False,
|
| 8964 |
"contains_reference_or_model_patches": False,
|
| 8965 |
"contains_private_paths": False,
|
| 8966 |
+
"contains_protocol_identifiers_or_per_run_hashes": False,
|
| 8967 |
},
|
| 8968 |
}
|
| 8969 |
+
if descriptive_rows is not None:
|
| 8970 |
+
summary["descriptive_metrics"] = _descriptive_holdout_metrics(
|
| 8971 |
+
descriptive_rows,
|
| 8972 |
+
descriptive_contract,
|
| 8973 |
+
)
|
| 8974 |
+
return summary
|
| 8975 |
|
| 8976 |
|
| 8977 |
def write_public_holdout_summary(
|
|
|
|
| 9679 |
)
|
| 9680 |
result = {
|
| 9681 |
"scenario": scenario.id,
|
| 9682 |
+
"engine": args.engine,
|
| 9683 |
"arm": arm,
|
| 9684 |
"trial": trial,
|
| 9685 |
"retry": retry,
|
| 9686 |
"attempt": attempt,
|
| 9687 |
"status": "harness_error",
|
| 9688 |
"error": f"{type(exc).__name__}: {exc}",
|
| 9689 |
+
"verification_backend": (
|
| 9690 |
+
OFFICIAL_HOLDOUT_BACKEND if official_holdout is not None else None
|
| 9691 |
+
),
|
| 9692 |
"endpoint_class": "not_evaluated",
|
| 9693 |
"evidence_level": "harness_error",
|
| 9694 |
"production_efficiency_eligible": False,
|
|
|
|
| 9700 |
"provider_authentication_verified": False,
|
| 9701 |
"provider_response_success": False,
|
| 9702 |
}
|
| 9703 |
+
if args.engine == PRODUCTION_CATALOG_ENGINE:
|
|
|
|
|
|
|
|
|
|
| 9704 |
result = _VerifiedProductionResult(result)
|
| 9705 |
results.append(result)
|
| 9706 |
write_summary(output, results)
|
scripts/ctx_ab_exposure_ledger.py
CHANGED
|
@@ -18,7 +18,6 @@ from typing import Any, Iterable
|
|
| 18 |
|
| 19 |
ROOT = Path(__file__).resolve().parents[1]
|
| 20 |
PRIVATE_ROOT = ROOT / ".gate" / "ctx-ab-private"
|
| 21 |
-
_IS_WINDOWS = os.name == "nt"
|
| 22 |
SHA256 = re.compile(r"^[0-9a-f]{64}$")
|
| 23 |
SCHEMA_KEYS = {
|
| 24 |
"schema_version",
|
|
@@ -101,7 +100,7 @@ def _validate_private_path(path: Path, *, must_exist: bool) -> None:
|
|
| 101 |
raise ValueError("private input must be a single-link regular file")
|
| 102 |
if metadata.st_size > MAX_PRIVATE_INPUT_BYTES:
|
| 103 |
raise ValueError("private input exceeds the size limit")
|
| 104 |
-
if
|
| 105 |
stat.S_IMODE(metadata.st_mode) & 0o077
|
| 106 |
or stat.S_IMODE(path.parent.stat().st_mode) & 0o077
|
| 107 |
):
|
|
@@ -282,12 +281,12 @@ def _require_distinct_paths(paths: Iterable[Path]) -> None:
|
|
| 282 |
def _write_private_ledger(path: Path, payload: bytes) -> None:
|
| 283 |
_validate_private_path(path, must_exist=False)
|
| 284 |
path.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
|
| 285 |
-
if
|
| 286 |
raise ValueError("exposure ledger parent must be owner-only")
|
| 287 |
if path.exists() or path.is_symlink():
|
| 288 |
if path.is_symlink() or not path.is_file() or path.stat().st_nlink != 1:
|
| 289 |
raise ValueError("exposure ledger output must be a single-link regular file")
|
| 290 |
-
if
|
| 291 |
raise ValueError("exposure ledger output must be owner-only")
|
| 292 |
temporary = path.with_name(f".{path.name}.{os.getpid()}.{secrets.token_hex(8)}.tmp")
|
| 293 |
flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL
|
|
@@ -295,8 +294,7 @@ def _write_private_ledger(path: Path, payload: bytes) -> None:
|
|
| 295 |
flags |= os.O_NOFOLLOW
|
| 296 |
descriptor = os.open(temporary, flags, 0o600)
|
| 297 |
try:
|
| 298 |
-
|
| 299 |
-
os.fchmod(descriptor, 0o600)
|
| 300 |
with os.fdopen(descriptor, "wb", closefd=True) as handle:
|
| 301 |
descriptor = -1
|
| 302 |
handle.write(payload)
|
|
|
|
| 18 |
|
| 19 |
ROOT = Path(__file__).resolve().parents[1]
|
| 20 |
PRIVATE_ROOT = ROOT / ".gate" / "ctx-ab-private"
|
|
|
|
| 21 |
SHA256 = re.compile(r"^[0-9a-f]{64}$")
|
| 22 |
SCHEMA_KEYS = {
|
| 23 |
"schema_version",
|
|
|
|
| 100 |
raise ValueError("private input must be a single-link regular file")
|
| 101 |
if metadata.st_size > MAX_PRIVATE_INPUT_BYTES:
|
| 102 |
raise ValueError("private input exceeds the size limit")
|
| 103 |
+
if (
|
| 104 |
stat.S_IMODE(metadata.st_mode) & 0o077
|
| 105 |
or stat.S_IMODE(path.parent.stat().st_mode) & 0o077
|
| 106 |
):
|
|
|
|
| 281 |
def _write_private_ledger(path: Path, payload: bytes) -> None:
|
| 282 |
_validate_private_path(path, must_exist=False)
|
| 283 |
path.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
|
| 284 |
+
if stat.S_IMODE(path.parent.stat().st_mode) & 0o077:
|
| 285 |
raise ValueError("exposure ledger parent must be owner-only")
|
| 286 |
if path.exists() or path.is_symlink():
|
| 287 |
if path.is_symlink() or not path.is_file() or path.stat().st_nlink != 1:
|
| 288 |
raise ValueError("exposure ledger output must be a single-link regular file")
|
| 289 |
+
if stat.S_IMODE(path.stat().st_mode) & 0o077:
|
| 290 |
raise ValueError("exposure ledger output must be owner-only")
|
| 291 |
temporary = path.with_name(f".{path.name}.{os.getpid()}.{secrets.token_hex(8)}.tmp")
|
| 292 |
flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL
|
|
|
|
| 294 |
flags |= os.O_NOFOLLOW
|
| 295 |
descriptor = os.open(temporary, flags, 0o600)
|
| 296 |
try:
|
| 297 |
+
os.fchmod(descriptor, 0o600)
|
|
|
|
| 298 |
with os.fdopen(descriptor, "wb", closefd=True) as handle:
|
| 299 |
descriptor = -1
|
| 300 |
handle.write(payload)
|
scripts/ctx_ab_holdout.py
CHANGED
|
@@ -27,7 +27,6 @@ except ImportError: # pragma: no cover - direct script execution
|
|
| 27 |
ROOT = Path(__file__).resolve().parents[1]
|
| 28 |
DEFAULT_PROTOCOL = ROOT / "benchmarks" / "ctx_ab" / "holdout-protocol-v1.json"
|
| 29 |
PRIVATE_ROOT = ROOT / ".gate" / "ctx-ab-private"
|
| 30 |
-
_IS_WINDOWS = os.name == "nt"
|
| 31 |
V2_CANDIDATE_PARTITION_PREFIX = b"ctx-holdout-candidate-partition-v2\0"
|
| 32 |
HISTORICAL_EXPOSURE_REJECTION_CODE = "historical-exposure"
|
| 33 |
SHA1 = re.compile(r"^[0-9a-f]{40}$")
|
|
@@ -863,7 +862,7 @@ def _private_text_handle(path: Path) -> TextIO:
|
|
| 863 |
if ROOT.resolve() in resolved.parents and private_root not in resolved.parents:
|
| 864 |
raise ValueError("holdout evidence inside the repository must use .gate/ctx-ab-private")
|
| 865 |
path.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
|
| 866 |
-
if
|
| 867 |
raise ValueError("holdout evidence parent must be owner-only")
|
| 868 |
if path.is_symlink() or (path.exists() and not path.is_file()):
|
| 869 |
raise ValueError("holdout evidence path must be a regular file")
|
|
@@ -875,8 +874,7 @@ def _private_text_handle(path: Path) -> TextIO:
|
|
| 875 |
if hasattr(os, "O_NOFOLLOW"):
|
| 876 |
flags |= os.O_NOFOLLOW
|
| 877 |
descriptor = os.open(path, flags, 0o600)
|
| 878 |
-
|
| 879 |
-
os.fchmod(descriptor, 0o600)
|
| 880 |
return os.fdopen(descriptor, "w", encoding="utf-8", newline="")
|
| 881 |
|
| 882 |
|
|
@@ -897,7 +895,7 @@ def _remove_stale_selection(path: Path) -> None:
|
|
| 897 |
private_root = PRIVATE_ROOT.resolve()
|
| 898 |
if ROOT.resolve() in resolved.parents and private_root not in resolved.parents:
|
| 899 |
raise ValueError("stale selection inside the repository must use .gate/ctx-ab-private")
|
| 900 |
-
if
|
| 901 |
raise ValueError("stale selection parent must be owner-only")
|
| 902 |
if path.is_symlink() or not path.is_file() or path.stat().st_nlink != 1:
|
| 903 |
raise ValueError("stale selection must be a single-link regular file")
|
|
|
|
| 27 |
ROOT = Path(__file__).resolve().parents[1]
|
| 28 |
DEFAULT_PROTOCOL = ROOT / "benchmarks" / "ctx_ab" / "holdout-protocol-v1.json"
|
| 29 |
PRIVATE_ROOT = ROOT / ".gate" / "ctx-ab-private"
|
|
|
|
| 30 |
V2_CANDIDATE_PARTITION_PREFIX = b"ctx-holdout-candidate-partition-v2\0"
|
| 31 |
HISTORICAL_EXPOSURE_REJECTION_CODE = "historical-exposure"
|
| 32 |
SHA1 = re.compile(r"^[0-9a-f]{40}$")
|
|
|
|
| 862 |
if ROOT.resolve() in resolved.parents and private_root not in resolved.parents:
|
| 863 |
raise ValueError("holdout evidence inside the repository must use .gate/ctx-ab-private")
|
| 864 |
path.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
|
| 865 |
+
if stat.S_IMODE(path.parent.stat().st_mode) != 0o700:
|
| 866 |
raise ValueError("holdout evidence parent must be owner-only")
|
| 867 |
if path.is_symlink() or (path.exists() and not path.is_file()):
|
| 868 |
raise ValueError("holdout evidence path must be a regular file")
|
|
|
|
| 874 |
if hasattr(os, "O_NOFOLLOW"):
|
| 875 |
flags |= os.O_NOFOLLOW
|
| 876 |
descriptor = os.open(path, flags, 0o600)
|
| 877 |
+
os.fchmod(descriptor, 0o600)
|
|
|
|
| 878 |
return os.fdopen(descriptor, "w", encoding="utf-8", newline="")
|
| 879 |
|
| 880 |
|
|
|
|
| 895 |
private_root = PRIVATE_ROOT.resolve()
|
| 896 |
if ROOT.resolve() in resolved.parents and private_root not in resolved.parents:
|
| 897 |
raise ValueError("stale selection inside the repository must use .gate/ctx-ab-private")
|
| 898 |
+
if stat.S_IMODE(path.parent.stat().st_mode) != 0o700:
|
| 899 |
raise ValueError("stale selection parent must be owner-only")
|
| 900 |
if path.is_symlink() or not path.is_file() or path.stat().st_nlink != 1:
|
| 901 |
raise ValueError("stale selection must be a single-link regular file")
|
scripts/ctx_ab_holdout_acquire.py
CHANGED
|
@@ -19,7 +19,6 @@ from typing import Any, TextIO
|
|
| 19 |
|
| 20 |
ROOT = Path(__file__).resolve().parents[1]
|
| 21 |
PRIVATE_ROOT = ROOT / ".gate" / "ctx-ab-private"
|
| 22 |
-
_IS_WINDOWS = os.name == "nt"
|
| 23 |
SHA256 = re.compile(r"^[0-9a-f]{64}$")
|
| 24 |
|
| 25 |
|
|
@@ -37,7 +36,7 @@ def _private_text_handle(path: Path) -> TextIO:
|
|
| 37 |
if ROOT.resolve() in resolved.parents and private_root not in resolved.parents:
|
| 38 |
raise ValueError("holdout evidence inside the repository must use .gate/ctx-ab-private")
|
| 39 |
path.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
|
| 40 |
-
if
|
| 41 |
raise ValueError("holdout evidence parent must be owner-only")
|
| 42 |
if path.is_symlink() or (path.exists() and not path.is_file()):
|
| 43 |
raise ValueError("holdout evidence path must be a regular file")
|
|
@@ -49,8 +48,7 @@ def _private_text_handle(path: Path) -> TextIO:
|
|
| 49 |
if hasattr(os, "O_NOFOLLOW"):
|
| 50 |
flags |= os.O_NOFOLLOW
|
| 51 |
descriptor = os.open(path, flags, 0o600)
|
| 52 |
-
|
| 53 |
-
os.fchmod(descriptor, 0o600)
|
| 54 |
return os.fdopen(descriptor, "w", encoding="utf-8", newline="")
|
| 55 |
|
| 56 |
|
|
@@ -122,7 +120,7 @@ def canonicalize_parquet(
|
|
| 122 |
if _sha256(duckdb_gzip_path) != expected_gzip_sha256:
|
| 123 |
raise ValueError("DuckDB CLI gzip does not match the frozen SHA-256")
|
| 124 |
private_root.mkdir(mode=0o700, parents=True, exist_ok=True)
|
| 125 |
-
if
|
| 126 |
raise ValueError("acquisition work directory must be owner-only")
|
| 127 |
with tempfile.TemporaryDirectory(dir=private_root) as temporary:
|
| 128 |
temp = Path(temporary)
|
|
|
|
| 19 |
|
| 20 |
ROOT = Path(__file__).resolve().parents[1]
|
| 21 |
PRIVATE_ROOT = ROOT / ".gate" / "ctx-ab-private"
|
|
|
|
| 22 |
SHA256 = re.compile(r"^[0-9a-f]{64}$")
|
| 23 |
|
| 24 |
|
|
|
|
| 36 |
if ROOT.resolve() in resolved.parents and private_root not in resolved.parents:
|
| 37 |
raise ValueError("holdout evidence inside the repository must use .gate/ctx-ab-private")
|
| 38 |
path.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
|
| 39 |
+
if stat.S_IMODE(path.parent.stat().st_mode) != 0o700:
|
| 40 |
raise ValueError("holdout evidence parent must be owner-only")
|
| 41 |
if path.is_symlink() or (path.exists() and not path.is_file()):
|
| 42 |
raise ValueError("holdout evidence path must be a regular file")
|
|
|
|
| 48 |
if hasattr(os, "O_NOFOLLOW"):
|
| 49 |
flags |= os.O_NOFOLLOW
|
| 50 |
descriptor = os.open(path, flags, 0o600)
|
| 51 |
+
os.fchmod(descriptor, 0o600)
|
|
|
|
| 52 |
return os.fdopen(descriptor, "w", encoding="utf-8", newline="")
|
| 53 |
|
| 54 |
|
|
|
|
| 120 |
if _sha256(duckdb_gzip_path) != expected_gzip_sha256:
|
| 121 |
raise ValueError("DuckDB CLI gzip does not match the frozen SHA-256")
|
| 122 |
private_root.mkdir(mode=0o700, parents=True, exist_ok=True)
|
| 123 |
+
if stat.S_IMODE(private_root.stat().st_mode) != 0o700:
|
| 124 |
raise ValueError("acquisition work directory must be owner-only")
|
| 125 |
with tempfile.TemporaryDirectory(dir=private_root) as temporary:
|
| 126 |
temp = Path(temporary)
|
scripts/ctx_ab_holdout_freeze.py
CHANGED
|
@@ -27,7 +27,6 @@ from scripts import ctx_ab_holdout as holdout
|
|
| 27 |
|
| 28 |
ROOT = Path(__file__).resolve().parents[1]
|
| 29 |
PRIVATE_ROOT = ROOT / ".gate" / "ctx-ab-private"
|
| 30 |
-
_IS_WINDOWS = os.name == "nt"
|
| 31 |
V1_PROTOCOL_PATH = ROOT / "benchmarks" / "ctx_ab" / "holdout-protocol-v1.json"
|
| 32 |
V1_PROTOCOL_SHA256 = "14c3e623b6a3dced3b41769a9e8b60faed5c921aa4f1456d4bde907f1f8a60fa"
|
| 33 |
PROTOCOL_ID = "production-graph-holdout-v2"
|
|
@@ -484,11 +483,7 @@ def _read_regular_bytes(path: Path, *, label: str, private: bool) -> bytes:
|
|
| 484 |
if (
|
| 485 |
not stat.S_ISREG(metadata.st_mode)
|
| 486 |
or metadata.st_nlink != 1
|
| 487 |
-
or (
|
| 488 |
-
private
|
| 489 |
-
and os.name != "nt"
|
| 490 |
-
and stat.S_IMODE(metadata.st_mode) & (stat.S_IRWXG | stat.S_IRWXO)
|
| 491 |
-
)
|
| 492 |
):
|
| 493 |
raise FreezeError(f"{label} must be an owner-only single-link regular file")
|
| 494 |
if private:
|
|
@@ -528,11 +523,7 @@ def _regular_file_sha256(path: Path, *, label: str, private: bool) -> str:
|
|
| 528 |
if (
|
| 529 |
not stat.S_ISREG(metadata.st_mode)
|
| 530 |
or metadata.st_nlink != 1
|
| 531 |
-
or (
|
| 532 |
-
private
|
| 533 |
-
and os.name != "nt"
|
| 534 |
-
and stat.S_IMODE(metadata.st_mode) & (stat.S_IRWXG | stat.S_IRWXO)
|
| 535 |
-
)
|
| 536 |
):
|
| 537 |
raise FreezeError(f"{label} must be an owner-only single-link regular file")
|
| 538 |
if private:
|
|
@@ -1271,7 +1262,7 @@ def _ensure_output_parent(path: Path, *, private: bool) -> None:
|
|
| 1271 |
path.parent.mkdir(mode=0o700 if private else 0o755, parents=True, exist_ok=True)
|
| 1272 |
except OSError as exc:
|
| 1273 |
raise FreezeError("output parent is unavailable") from exc
|
| 1274 |
-
if private and
|
| 1275 |
raise FreezeError("private output parent must be owner-only")
|
| 1276 |
|
| 1277 |
|
|
@@ -1279,8 +1270,7 @@ def _stage_bytes(path: Path, data: bytes, *, mode: int) -> Path:
|
|
| 1279 |
descriptor, temporary = tempfile.mkstemp(prefix=f".{path.name}.", dir=path.parent)
|
| 1280 |
temporary_path = Path(temporary)
|
| 1281 |
try:
|
| 1282 |
-
|
| 1283 |
-
os.fchmod(descriptor, mode)
|
| 1284 |
with os.fdopen(descriptor, "wb") as handle:
|
| 1285 |
descriptor = -1
|
| 1286 |
handle.write(data)
|
|
|
|
| 27 |
|
| 28 |
ROOT = Path(__file__).resolve().parents[1]
|
| 29 |
PRIVATE_ROOT = ROOT / ".gate" / "ctx-ab-private"
|
|
|
|
| 30 |
V1_PROTOCOL_PATH = ROOT / "benchmarks" / "ctx_ab" / "holdout-protocol-v1.json"
|
| 31 |
V1_PROTOCOL_SHA256 = "14c3e623b6a3dced3b41769a9e8b60faed5c921aa4f1456d4bde907f1f8a60fa"
|
| 32 |
PROTOCOL_ID = "production-graph-holdout-v2"
|
|
|
|
| 483 |
if (
|
| 484 |
not stat.S_ISREG(metadata.st_mode)
|
| 485 |
or metadata.st_nlink != 1
|
| 486 |
+
or (private and stat.S_IMODE(metadata.st_mode) & (stat.S_IRWXG | stat.S_IRWXO))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 487 |
):
|
| 488 |
raise FreezeError(f"{label} must be an owner-only single-link regular file")
|
| 489 |
if private:
|
|
|
|
| 523 |
if (
|
| 524 |
not stat.S_ISREG(metadata.st_mode)
|
| 525 |
or metadata.st_nlink != 1
|
| 526 |
+
or (private and stat.S_IMODE(metadata.st_mode) & (stat.S_IRWXG | stat.S_IRWXO))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 527 |
):
|
| 528 |
raise FreezeError(f"{label} must be an owner-only single-link regular file")
|
| 529 |
if private:
|
|
|
|
| 1262 |
path.parent.mkdir(mode=0o700 if private else 0o755, parents=True, exist_ok=True)
|
| 1263 |
except OSError as exc:
|
| 1264 |
raise FreezeError("output parent is unavailable") from exc
|
| 1265 |
+
if private and stat.S_IMODE(path.parent.stat().st_mode) != 0o700:
|
| 1266 |
raise FreezeError("private output parent must be owner-only")
|
| 1267 |
|
| 1268 |
|
|
|
|
| 1270 |
descriptor, temporary = tempfile.mkstemp(prefix=f".{path.name}.", dir=path.parent)
|
| 1271 |
temporary_path = Path(temporary)
|
| 1272 |
try:
|
| 1273 |
+
os.fchmod(descriptor, mode)
|
|
|
|
| 1274 |
with os.fdopen(descriptor, "wb") as handle:
|
| 1275 |
descriptor = -1
|
| 1276 |
handle.write(data)
|
scripts/ctx_ab_holdout_materialize.py
CHANGED
|
@@ -132,11 +132,6 @@ def _run(
|
|
| 132 |
input_text: str | None = None,
|
| 133 |
env: dict[str, str] | None = None,
|
| 134 |
) -> ProcessResult:
|
| 135 |
-
kwargs: dict[str, Any] = {}
|
| 136 |
-
if os.name == "nt":
|
| 137 |
-
kwargs["creationflags"] = getattr(subprocess, "CREATE_NEW_PROCESS_GROUP", 0)
|
| 138 |
-
else:
|
| 139 |
-
kwargs["start_new_session"] = True
|
| 140 |
process = subprocess.Popen(
|
| 141 |
argv,
|
| 142 |
cwd=cwd,
|
|
@@ -145,16 +140,13 @@ def _run(
|
|
| 145 |
stdout=subprocess.PIPE,
|
| 146 |
stderr=subprocess.PIPE,
|
| 147 |
text=True,
|
| 148 |
-
|
| 149 |
)
|
| 150 |
try:
|
| 151 |
stdout, stderr = process.communicate(input_text, timeout=_remaining(deadline))
|
| 152 |
return ProcessResult(process.returncode, stdout, stderr, False)
|
| 153 |
except subprocess.TimeoutExpired:
|
| 154 |
-
|
| 155 |
-
process.kill()
|
| 156 |
-
else:
|
| 157 |
-
os.killpg(process.pid, signal.SIGKILL)
|
| 158 |
stdout, stderr = process.communicate()
|
| 159 |
return ProcessResult(process.returncode, stdout, stderr, True)
|
| 160 |
|
|
@@ -773,7 +765,7 @@ def _write_artifacts(
|
|
| 773 |
for key, data in artifacts.items():
|
| 774 |
path = temp / OUTPUT_FILES[key]
|
| 775 |
_private_write(path, data)
|
| 776 |
-
if
|
| 777 |
raise MaterializationError("private artifact permissions are unsafe")
|
| 778 |
retained_evidence.rename(temp / VERIFICATION_DIR)
|
| 779 |
temp.rename(output)
|
|
|
|
| 132 |
input_text: str | None = None,
|
| 133 |
env: dict[str, str] | None = None,
|
| 134 |
) -> ProcessResult:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
process = subprocess.Popen(
|
| 136 |
argv,
|
| 137 |
cwd=cwd,
|
|
|
|
| 140 |
stdout=subprocess.PIPE,
|
| 141 |
stderr=subprocess.PIPE,
|
| 142 |
text=True,
|
| 143 |
+
start_new_session=True,
|
| 144 |
)
|
| 145 |
try:
|
| 146 |
stdout, stderr = process.communicate(input_text, timeout=_remaining(deadline))
|
| 147 |
return ProcessResult(process.returncode, stdout, stderr, False)
|
| 148 |
except subprocess.TimeoutExpired:
|
| 149 |
+
os.killpg(process.pid, signal.SIGKILL)
|
|
|
|
|
|
|
|
|
|
| 150 |
stdout, stderr = process.communicate()
|
| 151 |
return ProcessResult(process.returncode, stdout, stderr, True)
|
| 152 |
|
|
|
|
| 765 |
for key, data in artifacts.items():
|
| 766 |
path = temp / OUTPUT_FILES[key]
|
| 767 |
_private_write(path, data)
|
| 768 |
+
if stat.S_IMODE(path.stat().st_mode) != 0o600:
|
| 769 |
raise MaterializationError("private artifact permissions are unsafe")
|
| 770 |
retained_evidence.rename(temp / VERIFICATION_DIR)
|
| 771 |
temp.rename(output)
|
scripts/ctx_ab_holdout_prepare.py
CHANGED
|
@@ -46,7 +46,6 @@ PAIR_COUNT = 30
|
|
| 46 |
TRIALS_PER_SCENARIO = freezer.TRIALS_PER_SCENARIO
|
| 47 |
PRIVATE_FILE_MODE = 0o600
|
| 48 |
PRIVATE_DIRECTORY_MODE = 0o700
|
| 49 |
-
_IS_WINDOWS = os.name == "nt"
|
| 50 |
|
| 51 |
|
| 52 |
class PrepareError(RuntimeError):
|
|
@@ -270,11 +269,7 @@ def _read_regular_bytes(
|
|
| 270 |
raise PrepareError(f"{label} must be a single-link regular file")
|
| 271 |
if executable and not os.access(resolved, os.X_OK):
|
| 272 |
raise PrepareError(f"{label} must be executable")
|
| 273 |
-
if (
|
| 274 |
-
private
|
| 275 |
-
and os.name != "nt"
|
| 276 |
-
and stat.S_IMODE(metadata.st_mode) & (stat.S_IRWXG | stat.S_IRWXO)
|
| 277 |
-
):
|
| 278 |
raise PrepareError(f"{label} must be owner-only")
|
| 279 |
with os.fdopen(descriptor, "rb") as handle:
|
| 280 |
descriptor = -1
|
|
@@ -301,9 +296,7 @@ def _private_parent(path: Path) -> Path:
|
|
| 301 |
if parent != candidate.parent or not parent.is_dir():
|
| 302 |
raise PrepareError("preparation output parent must not use symlinks")
|
| 303 |
metadata = parent.stat()
|
| 304 |
-
if
|
| 305 |
-
stat.S_IMODE(metadata.st_mode) != PRIVATE_DIRECTORY_MODE or metadata.st_uid != os.getuid()
|
| 306 |
-
):
|
| 307 |
raise PrepareError("preparation output parent must be owner-only")
|
| 308 |
return candidate
|
| 309 |
|
|
@@ -325,8 +318,7 @@ def _atomic_private_write(path: Path, data: bytes) -> Path:
|
|
| 325 |
temporary = Path(temporary_name)
|
| 326 |
installed = False
|
| 327 |
try:
|
| 328 |
-
|
| 329 |
-
os.fchmod(descriptor, PRIVATE_FILE_MODE)
|
| 330 |
with os.fdopen(descriptor, "wb") as handle:
|
| 331 |
descriptor = -1
|
| 332 |
handle.write(data)
|
|
@@ -342,7 +334,7 @@ def _atomic_private_write(path: Path, data: bytes) -> Path:
|
|
| 342 |
if (
|
| 343 |
not stat.S_ISREG(metadata.st_mode)
|
| 344 |
or metadata.st_nlink != 1
|
| 345 |
-
or
|
| 346 |
):
|
| 347 |
raise PrepareError("preparation output permissions are unsafe")
|
| 348 |
return destination
|
|
@@ -996,9 +988,7 @@ def _ensure_private_directory_parent(path: Path) -> Path:
|
|
| 996 |
if parent != candidate.parent:
|
| 997 |
raise PrepareError("source cache parent must not use symlinks")
|
| 998 |
metadata = parent.stat()
|
| 999 |
-
if
|
| 1000 |
-
stat.S_IMODE(metadata.st_mode) != PRIVATE_DIRECTORY_MODE or metadata.st_uid != os.getuid()
|
| 1001 |
-
):
|
| 1002 |
raise PrepareError("source cache parent must be owner-only")
|
| 1003 |
return candidate
|
| 1004 |
|
|
|
|
| 46 |
TRIALS_PER_SCENARIO = freezer.TRIALS_PER_SCENARIO
|
| 47 |
PRIVATE_FILE_MODE = 0o600
|
| 48 |
PRIVATE_DIRECTORY_MODE = 0o700
|
|
|
|
| 49 |
|
| 50 |
|
| 51 |
class PrepareError(RuntimeError):
|
|
|
|
| 269 |
raise PrepareError(f"{label} must be a single-link regular file")
|
| 270 |
if executable and not os.access(resolved, os.X_OK):
|
| 271 |
raise PrepareError(f"{label} must be executable")
|
| 272 |
+
if private and stat.S_IMODE(metadata.st_mode) & (stat.S_IRWXG | stat.S_IRWXO):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
raise PrepareError(f"{label} must be owner-only")
|
| 274 |
with os.fdopen(descriptor, "rb") as handle:
|
| 275 |
descriptor = -1
|
|
|
|
| 296 |
if parent != candidate.parent or not parent.is_dir():
|
| 297 |
raise PrepareError("preparation output parent must not use symlinks")
|
| 298 |
metadata = parent.stat()
|
| 299 |
+
if stat.S_IMODE(metadata.st_mode) != PRIVATE_DIRECTORY_MODE or metadata.st_uid != os.getuid():
|
|
|
|
|
|
|
| 300 |
raise PrepareError("preparation output parent must be owner-only")
|
| 301 |
return candidate
|
| 302 |
|
|
|
|
| 318 |
temporary = Path(temporary_name)
|
| 319 |
installed = False
|
| 320 |
try:
|
| 321 |
+
os.fchmod(descriptor, PRIVATE_FILE_MODE)
|
|
|
|
| 322 |
with os.fdopen(descriptor, "wb") as handle:
|
| 323 |
descriptor = -1
|
| 324 |
handle.write(data)
|
|
|
|
| 334 |
if (
|
| 335 |
not stat.S_ISREG(metadata.st_mode)
|
| 336 |
or metadata.st_nlink != 1
|
| 337 |
+
or stat.S_IMODE(metadata.st_mode) != PRIVATE_FILE_MODE
|
| 338 |
):
|
| 339 |
raise PrepareError("preparation output permissions are unsafe")
|
| 340 |
return destination
|
|
|
|
| 988 |
if parent != candidate.parent:
|
| 989 |
raise PrepareError("source cache parent must not use symlinks")
|
| 990 |
metadata = parent.stat()
|
| 991 |
+
if stat.S_IMODE(metadata.st_mode) != PRIVATE_DIRECTORY_MODE or metadata.st_uid != os.getuid():
|
|
|
|
|
|
|
| 992 |
raise PrepareError("source cache parent must be owner-only")
|
| 993 |
return candidate
|
| 994 |
|
scripts/ctx_ab_swebench.py
CHANGED
|
@@ -42,11 +42,6 @@ CONTAINER_PIDS_LIMIT = 2048
|
|
| 42 |
CONTAINER_SECURITY_OPT = "no-new-privileges:true"
|
| 43 |
RUN_LABEL = "ctx.benchmark.run_id"
|
| 44 |
PROCESS_MARKER = "CTX_SWEBENCH_PROCESS_TOKEN"
|
| 45 |
-
WINDOWS_CREATE_SUSPENDED = 0x00000004
|
| 46 |
-
WINDOWS_JOB_OBJECT_BASIC_PROCESS_ID_LIST = 3
|
| 47 |
-
WINDOWS_JOB_OBJECT_EXTENDED_LIMIT_INFORMATION = 9
|
| 48 |
-
WINDOWS_JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 0x00002000
|
| 49 |
-
WINDOWS_MAX_JOB_PROCESSES = 65536
|
| 50 |
REQUIRED_ARTIFACTS = (
|
| 51 |
"report.json",
|
| 52 |
"raw-status.json",
|
|
@@ -112,19 +107,6 @@ def _descendant_pids(root_pid: int) -> list[int]:
|
|
| 112 |
|
| 113 |
|
| 114 |
def _signal_process_tree(process: subprocess.Popen[str], sig: signal.Signals) -> None:
|
| 115 |
-
if os.name == "nt":
|
| 116 |
-
try:
|
| 117 |
-
result = subprocess.run(
|
| 118 |
-
["taskkill", "/PID", str(process.pid), "/T", "/F"],
|
| 119 |
-
check=False,
|
| 120 |
-
capture_output=True,
|
| 121 |
-
timeout=5,
|
| 122 |
-
)
|
| 123 |
-
if result.returncode:
|
| 124 |
-
_kill_windows_root_if_running(process)
|
| 125 |
-
except (OSError, subprocess.SubprocessError):
|
| 126 |
-
_kill_windows_root_if_running(process)
|
| 127 |
-
return
|
| 128 |
descendants = _descendant_pids(process.pid)
|
| 129 |
try:
|
| 130 |
os.killpg(process.pid, sig)
|
|
@@ -137,18 +119,6 @@ def _signal_process_tree(process: subprocess.Popen[str], sig: signal.Signals) ->
|
|
| 137 |
pass
|
| 138 |
|
| 139 |
|
| 140 |
-
def _kill_windows_root_if_running(
|
| 141 |
-
process: subprocess.Popen[str],
|
| 142 |
-
) -> None: # pragma: no cover - Windows only
|
| 143 |
-
if process.poll() is not None:
|
| 144 |
-
return
|
| 145 |
-
try:
|
| 146 |
-
process.kill()
|
| 147 |
-
except OSError:
|
| 148 |
-
if process.poll() is None:
|
| 149 |
-
raise
|
| 150 |
-
|
| 151 |
-
|
| 152 |
def _terminate_process_tree(process: subprocess.Popen[str]) -> tuple[str, str]:
|
| 153 |
_signal_process_tree(process, signal.SIGTERM)
|
| 154 |
try:
|
|
@@ -226,315 +196,6 @@ def _cleanup_marked_processes(token: str) -> tuple[int, tuple[int, ...], str | N
|
|
| 226 |
return len(signaled), tuple(sorted(residual)), error
|
| 227 |
|
| 228 |
|
| 229 |
-
def _windows_api_error(action: str) -> OSError: # pragma: no cover - Windows only
|
| 230 |
-
import ctypes
|
| 231 |
-
|
| 232 |
-
error = getattr(ctypes, "get_last_error")()
|
| 233 |
-
message = getattr(ctypes, "FormatError")(error)
|
| 234 |
-
return OSError(error, f"{action} failed: {message}")
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
def _close_windows_handle(handle: int) -> None: # pragma: no cover - Windows only
|
| 238 |
-
import ctypes
|
| 239 |
-
|
| 240 |
-
kernel32 = getattr(ctypes, "WinDLL")("kernel32", use_last_error=True)
|
| 241 |
-
close_handle = kernel32.CloseHandle
|
| 242 |
-
close_handle.argtypes = (ctypes.c_void_p,)
|
| 243 |
-
close_handle.restype = ctypes.c_int
|
| 244 |
-
if not close_handle(ctypes.c_void_p(handle)):
|
| 245 |
-
raise _windows_api_error("CloseHandle")
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
def _create_windows_kill_job() -> int: # pragma: no cover - Windows only
|
| 249 |
-
import ctypes
|
| 250 |
-
|
| 251 |
-
class BasicLimitInformation(ctypes.Structure):
|
| 252 |
-
_fields_ = (
|
| 253 |
-
("PerProcessUserTimeLimit", ctypes.c_int64),
|
| 254 |
-
("PerJobUserTimeLimit", ctypes.c_int64),
|
| 255 |
-
("LimitFlags", ctypes.c_uint32),
|
| 256 |
-
("MinimumWorkingSetSize", ctypes.c_size_t),
|
| 257 |
-
("MaximumWorkingSetSize", ctypes.c_size_t),
|
| 258 |
-
("ActiveProcessLimit", ctypes.c_uint32),
|
| 259 |
-
("Affinity", ctypes.c_size_t),
|
| 260 |
-
("PriorityClass", ctypes.c_uint32),
|
| 261 |
-
("SchedulingClass", ctypes.c_uint32),
|
| 262 |
-
)
|
| 263 |
-
|
| 264 |
-
class IoCounters(ctypes.Structure):
|
| 265 |
-
_fields_ = (
|
| 266 |
-
("ReadOperationCount", ctypes.c_uint64),
|
| 267 |
-
("WriteOperationCount", ctypes.c_uint64),
|
| 268 |
-
("OtherOperationCount", ctypes.c_uint64),
|
| 269 |
-
("ReadTransferCount", ctypes.c_uint64),
|
| 270 |
-
("WriteTransferCount", ctypes.c_uint64),
|
| 271 |
-
("OtherTransferCount", ctypes.c_uint64),
|
| 272 |
-
)
|
| 273 |
-
|
| 274 |
-
class ExtendedLimitInformation(ctypes.Structure):
|
| 275 |
-
_fields_ = (
|
| 276 |
-
("BasicLimitInformation", BasicLimitInformation),
|
| 277 |
-
("IoInfo", IoCounters),
|
| 278 |
-
("ProcessMemoryLimit", ctypes.c_size_t),
|
| 279 |
-
("JobMemoryLimit", ctypes.c_size_t),
|
| 280 |
-
("PeakProcessMemoryUsed", ctypes.c_size_t),
|
| 281 |
-
("PeakJobMemoryUsed", ctypes.c_size_t),
|
| 282 |
-
)
|
| 283 |
-
|
| 284 |
-
kernel32 = getattr(ctypes, "WinDLL")("kernel32", use_last_error=True)
|
| 285 |
-
create_job = kernel32.CreateJobObjectW
|
| 286 |
-
create_job.argtypes = (ctypes.c_void_p, ctypes.c_wchar_p)
|
| 287 |
-
create_job.restype = ctypes.c_void_p
|
| 288 |
-
set_information = kernel32.SetInformationJobObject
|
| 289 |
-
set_information.argtypes = (
|
| 290 |
-
ctypes.c_void_p,
|
| 291 |
-
ctypes.c_int,
|
| 292 |
-
ctypes.c_void_p,
|
| 293 |
-
ctypes.c_uint32,
|
| 294 |
-
)
|
| 295 |
-
set_information.restype = ctypes.c_int
|
| 296 |
-
|
| 297 |
-
handle = create_job(None, None)
|
| 298 |
-
if not handle:
|
| 299 |
-
raise _windows_api_error("CreateJobObjectW")
|
| 300 |
-
job_handle = int(handle)
|
| 301 |
-
limits = ExtendedLimitInformation()
|
| 302 |
-
limits.BasicLimitInformation.LimitFlags = WINDOWS_JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE
|
| 303 |
-
if not set_information(
|
| 304 |
-
ctypes.c_void_p(job_handle),
|
| 305 |
-
WINDOWS_JOB_OBJECT_EXTENDED_LIMIT_INFORMATION,
|
| 306 |
-
ctypes.byref(limits),
|
| 307 |
-
ctypes.sizeof(limits),
|
| 308 |
-
):
|
| 309 |
-
error = _windows_api_error("SetInformationJobObject")
|
| 310 |
-
try:
|
| 311 |
-
_close_windows_handle(job_handle)
|
| 312 |
-
except OSError:
|
| 313 |
-
pass
|
| 314 |
-
raise error
|
| 315 |
-
return job_handle
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
def _assign_windows_kill_job(
|
| 319 |
-
job_handle: int,
|
| 320 |
-
process_id: int,
|
| 321 |
-
) -> None: # pragma: no cover - Windows only
|
| 322 |
-
import ctypes
|
| 323 |
-
|
| 324 |
-
kernel32 = getattr(ctypes, "WinDLL")("kernel32", use_last_error=True)
|
| 325 |
-
open_process = kernel32.OpenProcess
|
| 326 |
-
open_process.argtypes = (ctypes.c_uint32, ctypes.c_int, ctypes.c_uint32)
|
| 327 |
-
open_process.restype = ctypes.c_void_p
|
| 328 |
-
assign_process = kernel32.AssignProcessToJobObject
|
| 329 |
-
assign_process.argtypes = (ctypes.c_void_p, ctypes.c_void_p)
|
| 330 |
-
assign_process.restype = ctypes.c_int
|
| 331 |
-
process_handle = open_process(0x0101, 0, process_id)
|
| 332 |
-
if not process_handle:
|
| 333 |
-
raise _windows_api_error("OpenProcess")
|
| 334 |
-
try:
|
| 335 |
-
if not assign_process(
|
| 336 |
-
ctypes.c_void_p(job_handle),
|
| 337 |
-
ctypes.c_void_p(int(process_handle)),
|
| 338 |
-
):
|
| 339 |
-
raise _windows_api_error("AssignProcessToJobObject")
|
| 340 |
-
finally:
|
| 341 |
-
_close_windows_handle(int(process_handle))
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
def _resume_windows_process(process_id: int) -> None: # pragma: no cover - Windows only
|
| 345 |
-
import ctypes
|
| 346 |
-
|
| 347 |
-
class ThreadEntry(ctypes.Structure):
|
| 348 |
-
_fields_ = (
|
| 349 |
-
("dwSize", ctypes.c_uint32),
|
| 350 |
-
("cntUsage", ctypes.c_uint32),
|
| 351 |
-
("th32ThreadID", ctypes.c_uint32),
|
| 352 |
-
("th32OwnerProcessID", ctypes.c_uint32),
|
| 353 |
-
("tpBasePri", ctypes.c_int32),
|
| 354 |
-
("tpDeltaPri", ctypes.c_int32),
|
| 355 |
-
("dwFlags", ctypes.c_uint32),
|
| 356 |
-
)
|
| 357 |
-
|
| 358 |
-
kernel32 = getattr(ctypes, "WinDLL")("kernel32", use_last_error=True)
|
| 359 |
-
create_snapshot = kernel32.CreateToolhelp32Snapshot
|
| 360 |
-
create_snapshot.argtypes = (ctypes.c_uint32, ctypes.c_uint32)
|
| 361 |
-
create_snapshot.restype = ctypes.c_void_p
|
| 362 |
-
thread_first = kernel32.Thread32First
|
| 363 |
-
thread_first.argtypes = (ctypes.c_void_p, ctypes.c_void_p)
|
| 364 |
-
thread_first.restype = ctypes.c_int
|
| 365 |
-
thread_next = kernel32.Thread32Next
|
| 366 |
-
thread_next.argtypes = (ctypes.c_void_p, ctypes.c_void_p)
|
| 367 |
-
thread_next.restype = ctypes.c_int
|
| 368 |
-
snapshot = create_snapshot(0x00000004, 0)
|
| 369 |
-
invalid_handle = ctypes.c_void_p(-1).value
|
| 370 |
-
if snapshot in (None, invalid_handle):
|
| 371 |
-
raise _windows_api_error("CreateToolhelp32Snapshot")
|
| 372 |
-
snapshot_handle = int(snapshot)
|
| 373 |
-
thread_ids: list[int] = []
|
| 374 |
-
try:
|
| 375 |
-
entry = ThreadEntry()
|
| 376 |
-
entry.dwSize = ctypes.sizeof(entry)
|
| 377 |
-
available = bool(thread_first(ctypes.c_void_p(snapshot_handle), ctypes.byref(entry)))
|
| 378 |
-
if not available and getattr(ctypes, "get_last_error")() != 18:
|
| 379 |
-
raise _windows_api_error("Thread32First")
|
| 380 |
-
while available:
|
| 381 |
-
if entry.th32OwnerProcessID == process_id:
|
| 382 |
-
thread_ids.append(int(entry.th32ThreadID))
|
| 383 |
-
entry.dwSize = ctypes.sizeof(entry)
|
| 384 |
-
available = bool(thread_next(ctypes.c_void_p(snapshot_handle), ctypes.byref(entry)))
|
| 385 |
-
if not available and getattr(ctypes, "get_last_error")() != 18:
|
| 386 |
-
raise _windows_api_error("Thread32Next")
|
| 387 |
-
finally:
|
| 388 |
-
_close_windows_handle(snapshot_handle)
|
| 389 |
-
if len(thread_ids) != 1:
|
| 390 |
-
raise OSError(
|
| 391 |
-
f"expected one suspended thread for Windows process {process_id}; "
|
| 392 |
-
f"found {len(thread_ids)}"
|
| 393 |
-
)
|
| 394 |
-
|
| 395 |
-
open_thread = kernel32.OpenThread
|
| 396 |
-
open_thread.argtypes = (ctypes.c_uint32, ctypes.c_int, ctypes.c_uint32)
|
| 397 |
-
open_thread.restype = ctypes.c_void_p
|
| 398 |
-
resume_thread = kernel32.ResumeThread
|
| 399 |
-
resume_thread.argtypes = (ctypes.c_void_p,)
|
| 400 |
-
resume_thread.restype = ctypes.c_uint32
|
| 401 |
-
thread_handle = open_thread(0x0002, 0, thread_ids[0])
|
| 402 |
-
if not thread_handle:
|
| 403 |
-
raise _windows_api_error("OpenThread")
|
| 404 |
-
try:
|
| 405 |
-
previous_suspend_count = resume_thread(ctypes.c_void_p(int(thread_handle)))
|
| 406 |
-
if previous_suspend_count != 1:
|
| 407 |
-
if previous_suspend_count == 0xFFFFFFFF:
|
| 408 |
-
raise _windows_api_error("ResumeThread")
|
| 409 |
-
raise OSError(f"unexpected Windows thread suspend count {previous_suspend_count}")
|
| 410 |
-
finally:
|
| 411 |
-
_close_windows_handle(int(thread_handle))
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
def _windows_job_process_ids(job_handle: int) -> tuple[int, ...]: # pragma: no cover
|
| 415 |
-
import ctypes
|
| 416 |
-
|
| 417 |
-
kernel32 = getattr(ctypes, "WinDLL")("kernel32", use_last_error=True)
|
| 418 |
-
query_information = kernel32.QueryInformationJobObject
|
| 419 |
-
query_information.argtypes = (
|
| 420 |
-
ctypes.c_void_p,
|
| 421 |
-
ctypes.c_int,
|
| 422 |
-
ctypes.c_void_p,
|
| 423 |
-
ctypes.c_uint32,
|
| 424 |
-
ctypes.c_void_p,
|
| 425 |
-
)
|
| 426 |
-
query_information.restype = ctypes.c_int
|
| 427 |
-
capacity = 64
|
| 428 |
-
while capacity <= WINDOWS_MAX_JOB_PROCESSES:
|
| 429 |
-
|
| 430 |
-
class ProcessIdList(ctypes.Structure):
|
| 431 |
-
_fields_ = (
|
| 432 |
-
("NumberOfAssignedProcesses", ctypes.c_uint32),
|
| 433 |
-
("NumberOfProcessIdsInList", ctypes.c_uint32),
|
| 434 |
-
("ProcessIdList", ctypes.c_size_t * capacity),
|
| 435 |
-
)
|
| 436 |
-
|
| 437 |
-
process_ids = ProcessIdList()
|
| 438 |
-
returned = ctypes.c_uint32()
|
| 439 |
-
success = query_information(
|
| 440 |
-
ctypes.c_void_p(job_handle),
|
| 441 |
-
WINDOWS_JOB_OBJECT_BASIC_PROCESS_ID_LIST,
|
| 442 |
-
ctypes.byref(process_ids),
|
| 443 |
-
ctypes.sizeof(process_ids),
|
| 444 |
-
ctypes.byref(returned),
|
| 445 |
-
)
|
| 446 |
-
if success:
|
| 447 |
-
assigned = int(process_ids.NumberOfAssignedProcesses)
|
| 448 |
-
listed = int(process_ids.NumberOfProcessIdsInList)
|
| 449 |
-
if assigned <= listed:
|
| 450 |
-
return tuple(int(process_ids.ProcessIdList[index]) for index in range(listed))
|
| 451 |
-
capacity = max(capacity * 2, assigned)
|
| 452 |
-
continue
|
| 453 |
-
error = getattr(ctypes, "get_last_error")()
|
| 454 |
-
if error not in {122, 234}:
|
| 455 |
-
raise _windows_api_error("QueryInformationJobObject")
|
| 456 |
-
capacity *= 2
|
| 457 |
-
raise OSError("Windows job process list exceeded its containment limit")
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
def _terminate_windows_job(
|
| 461 |
-
job_handle: int,
|
| 462 |
-
*,
|
| 463 |
-
exit_code: int = 1,
|
| 464 |
-
) -> None: # pragma: no cover - Windows only
|
| 465 |
-
import ctypes
|
| 466 |
-
|
| 467 |
-
kernel32 = getattr(ctypes, "WinDLL")("kernel32", use_last_error=True)
|
| 468 |
-
terminate_job = kernel32.TerminateJobObject
|
| 469 |
-
terminate_job.argtypes = (ctypes.c_void_p, ctypes.c_uint32)
|
| 470 |
-
terminate_job.restype = ctypes.c_int
|
| 471 |
-
if not terminate_job(ctypes.c_void_p(job_handle), exit_code):
|
| 472 |
-
raise _windows_api_error("TerminateJobObject")
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
def _cleanup_windows_job(
|
| 476 |
-
job_handle: int,
|
| 477 |
-
root_pid: int,
|
| 478 |
-
) -> tuple[int, tuple[int, ...], str | None]: # pragma: no cover - Windows only
|
| 479 |
-
seen: set[int] = set()
|
| 480 |
-
residual: set[int] = set()
|
| 481 |
-
active: set[int] = set()
|
| 482 |
-
error: str | None = None
|
| 483 |
-
try:
|
| 484 |
-
try:
|
| 485 |
-
active = set(_windows_job_process_ids(job_handle))
|
| 486 |
-
residual = set(active)
|
| 487 |
-
residual.discard(root_pid)
|
| 488 |
-
seen.update(residual)
|
| 489 |
-
if active:
|
| 490 |
-
_terminate_windows_job(job_handle, exit_code=124)
|
| 491 |
-
deadline = time.monotonic() + 5
|
| 492 |
-
while active and time.monotonic() < deadline:
|
| 493 |
-
time.sleep(0.05)
|
| 494 |
-
active = set(_windows_job_process_ids(job_handle))
|
| 495 |
-
residual = set(active)
|
| 496 |
-
residual.discard(root_pid)
|
| 497 |
-
seen.update(residual)
|
| 498 |
-
if active:
|
| 499 |
-
error = f"Windows job retained processes: {sorted(active)}"
|
| 500 |
-
except OSError as exc:
|
| 501 |
-
error = str(exc)
|
| 502 |
-
finally:
|
| 503 |
-
try:
|
| 504 |
-
_close_windows_handle(job_handle)
|
| 505 |
-
except OSError as exc:
|
| 506 |
-
error = error or str(exc)
|
| 507 |
-
return len(seen), tuple(sorted(residual)), error
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
def _terminate_uncontained_windows_process(
|
| 511 |
-
process: subprocess.Popen[str],
|
| 512 |
-
) -> None: # pragma: no cover - Windows only
|
| 513 |
-
try:
|
| 514 |
-
_kill_windows_root_if_running(process)
|
| 515 |
-
except OSError as first_error:
|
| 516 |
-
try:
|
| 517 |
-
result = subprocess.run(
|
| 518 |
-
["taskkill", "/PID", str(process.pid), "/T", "/F"],
|
| 519 |
-
check=False,
|
| 520 |
-
capture_output=True,
|
| 521 |
-
timeout=5,
|
| 522 |
-
)
|
| 523 |
-
except (OSError, subprocess.SubprocessError) as fallback_error:
|
| 524 |
-
raise OSError("suspended Windows process could not be terminated") from (fallback_error)
|
| 525 |
-
if result.returncode:
|
| 526 |
-
raise OSError(
|
| 527 |
-
f"taskkill failed for suspended Windows process {process.pid}"
|
| 528 |
-
) from first_error
|
| 529 |
-
try:
|
| 530 |
-
process.communicate(timeout=5)
|
| 531 |
-
except subprocess.TimeoutExpired:
|
| 532 |
-
process.kill()
|
| 533 |
-
process.communicate(timeout=5)
|
| 534 |
-
if process.returncode is None:
|
| 535 |
-
raise OSError(f"suspended Windows process {process.pid} did not terminate")
|
| 536 |
-
|
| 537 |
-
|
| 538 |
def _run_process(
|
| 539 |
argv: list[str],
|
| 540 |
*,
|
|
@@ -550,118 +211,32 @@ def _run_process(
|
|
| 550 |
if process_token is not None:
|
| 551 |
child_env = dict(os.environ if env is None else env)
|
| 552 |
child_env[PROCESS_MARKER] = process_token
|
| 553 |
-
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
)
|
| 564 |
-
process_kwargs["creationflags"] = creationflags
|
| 565 |
-
else:
|
| 566 |
-
process_kwargs["start_new_session"] = True
|
| 567 |
-
try:
|
| 568 |
-
process = subprocess.Popen(
|
| 569 |
-
argv,
|
| 570 |
-
cwd=cwd,
|
| 571 |
-
env=child_env,
|
| 572 |
-
text=True,
|
| 573 |
-
stdin=subprocess.PIPE if input_text is not None else subprocess.DEVNULL,
|
| 574 |
-
stdout=subprocess.PIPE,
|
| 575 |
-
stderr=subprocess.PIPE,
|
| 576 |
-
**process_kwargs,
|
| 577 |
-
)
|
| 578 |
-
except BaseException:
|
| 579 |
-
if windows_job is not None:
|
| 580 |
-
_close_windows_handle(windows_job)
|
| 581 |
-
raise
|
| 582 |
-
if windows_job is not None:
|
| 583 |
-
job_assigned = False
|
| 584 |
-
try:
|
| 585 |
-
_assign_windows_kill_job(windows_job, process.pid)
|
| 586 |
-
job_assigned = True
|
| 587 |
-
_resume_windows_process(process.pid)
|
| 588 |
-
except BaseException:
|
| 589 |
-
setup_cleanup_error: BaseException | None = None
|
| 590 |
-
try:
|
| 591 |
-
if job_assigned:
|
| 592 |
-
_, remaining, error = _cleanup_windows_job(
|
| 593 |
-
windows_job,
|
| 594 |
-
process.pid,
|
| 595 |
-
)
|
| 596 |
-
if error or remaining:
|
| 597 |
-
detail = error or f"residual descendants: {list(remaining)}"
|
| 598 |
-
setup_cleanup_error = OSError(detail)
|
| 599 |
-
else:
|
| 600 |
-
_terminate_uncontained_windows_process(process)
|
| 601 |
-
except BaseException as exc:
|
| 602 |
-
setup_cleanup_error = exc
|
| 603 |
-
finally:
|
| 604 |
-
if not job_assigned:
|
| 605 |
-
try:
|
| 606 |
-
_close_windows_handle(windows_job)
|
| 607 |
-
except BaseException as exc:
|
| 608 |
-
setup_cleanup_error = setup_cleanup_error or exc
|
| 609 |
-
if setup_cleanup_error is not None:
|
| 610 |
-
raise RuntimeError(
|
| 611 |
-
"Windows process containment setup cleanup failed"
|
| 612 |
-
) from setup_cleanup_error
|
| 613 |
-
raise
|
| 614 |
timed_out = False
|
| 615 |
reaped = 0
|
| 616 |
residual: tuple[int, ...] = ()
|
| 617 |
cleanup_error: str | None = None
|
| 618 |
-
windows_job_cleaned = False
|
| 619 |
|
| 620 |
def cleanup_marked_processes() -> None:
|
| 621 |
-
nonlocal reaped, residual, cleanup_error
|
| 622 |
if process_token is None:
|
| 623 |
return
|
| 624 |
-
if windows_job is not None:
|
| 625 |
-
if windows_job_cleaned:
|
| 626 |
-
return
|
| 627 |
-
windows_job_cleaned = True
|
| 628 |
-
count, remaining, error = _cleanup_windows_job(windows_job, process.pid)
|
| 629 |
-
reaped += count
|
| 630 |
-
residual = remaining
|
| 631 |
-
cleanup_error = cleanup_error or error
|
| 632 |
-
return
|
| 633 |
count, remaining, error = _cleanup_marked_processes(process_token)
|
| 634 |
reaped += count
|
| 635 |
residual = remaining
|
| 636 |
cleanup_error = cleanup_error or error
|
| 637 |
|
| 638 |
-
def communicate_process() -> tuple[str, str]:
|
| 639 |
-
if windows_job is None:
|
| 640 |
-
return process.communicate(input=input_text, timeout=timeout)
|
| 641 |
-
deadline = time.monotonic() + timeout
|
| 642 |
-
pending_input = input_text
|
| 643 |
-
while True:
|
| 644 |
-
if process.poll() is not None:
|
| 645 |
-
cleanup_marked_processes()
|
| 646 |
-
return process.communicate(timeout=5)
|
| 647 |
-
remaining = deadline - time.monotonic()
|
| 648 |
-
if remaining <= 0:
|
| 649 |
-
raise subprocess.TimeoutExpired(argv, timeout)
|
| 650 |
-
try:
|
| 651 |
-
return process.communicate(
|
| 652 |
-
input=pending_input,
|
| 653 |
-
timeout=min(remaining, 0.1),
|
| 654 |
-
)
|
| 655 |
-
except subprocess.TimeoutExpired:
|
| 656 |
-
pending_input = None
|
| 657 |
-
if process.poll() is not None:
|
| 658 |
-
cleanup_marked_processes()
|
| 659 |
-
return process.communicate(timeout=5)
|
| 660 |
-
if time.monotonic() >= deadline:
|
| 661 |
-
raise
|
| 662 |
-
|
| 663 |
try:
|
| 664 |
-
stdout, stderr =
|
| 665 |
except subprocess.TimeoutExpired:
|
| 666 |
timed_out = True
|
| 667 |
cleanup_marked_processes()
|
|
|
|
| 42 |
CONTAINER_SECURITY_OPT = "no-new-privileges:true"
|
| 43 |
RUN_LABEL = "ctx.benchmark.run_id"
|
| 44 |
PROCESS_MARKER = "CTX_SWEBENCH_PROCESS_TOKEN"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
REQUIRED_ARTIFACTS = (
|
| 46 |
"report.json",
|
| 47 |
"raw-status.json",
|
|
|
|
| 107 |
|
| 108 |
|
| 109 |
def _signal_process_tree(process: subprocess.Popen[str], sig: signal.Signals) -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
descendants = _descendant_pids(process.pid)
|
| 111 |
try:
|
| 112 |
os.killpg(process.pid, sig)
|
|
|
|
| 119 |
pass
|
| 120 |
|
| 121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
def _terminate_process_tree(process: subprocess.Popen[str]) -> tuple[str, str]:
|
| 123 |
_signal_process_tree(process, signal.SIGTERM)
|
| 124 |
try:
|
|
|
|
| 196 |
return len(signaled), tuple(sorted(residual)), error
|
| 197 |
|
| 198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
def _run_process(
|
| 200 |
argv: list[str],
|
| 201 |
*,
|
|
|
|
| 211 |
if process_token is not None:
|
| 212 |
child_env = dict(os.environ if env is None else env)
|
| 213 |
child_env[PROCESS_MARKER] = process_token
|
| 214 |
+
process = subprocess.Popen(
|
| 215 |
+
argv,
|
| 216 |
+
cwd=cwd,
|
| 217 |
+
env=child_env,
|
| 218 |
+
text=True,
|
| 219 |
+
stdin=subprocess.PIPE if input_text is not None else subprocess.DEVNULL,
|
| 220 |
+
stdout=subprocess.PIPE,
|
| 221 |
+
stderr=subprocess.PIPE,
|
| 222 |
+
start_new_session=True,
|
| 223 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
timed_out = False
|
| 225 |
reaped = 0
|
| 226 |
residual: tuple[int, ...] = ()
|
| 227 |
cleanup_error: str | None = None
|
|
|
|
| 228 |
|
| 229 |
def cleanup_marked_processes() -> None:
|
| 230 |
+
nonlocal reaped, residual, cleanup_error
|
| 231 |
if process_token is None:
|
| 232 |
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
count, remaining, error = _cleanup_marked_processes(process_token)
|
| 234 |
reaped += count
|
| 235 |
residual = remaining
|
| 236 |
cleanup_error = cleanup_error or error
|
| 237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
try:
|
| 239 |
+
stdout, stderr = process.communicate(input=input_text, timeout=timeout)
|
| 240 |
except subprocess.TimeoutExpired:
|
| 241 |
timed_out = True
|
| 242 |
cleanup_marked_processes()
|
src/backup_mirror.py
CHANGED
|
@@ -76,7 +76,7 @@ from typing import TYPE_CHECKING, Iterable
|
|
| 76 |
# paying a per-call config read.
|
| 77 |
from ctx.utils._fs_utils import (
|
| 78 |
_fsync_parent_dir,
|
| 79 |
-
|
| 80 |
atomic_write_text as _atomic_write_text,
|
| 81 |
)
|
| 82 |
from backup_config import BackupConfig, from_ctx_config
|
|
@@ -236,8 +236,7 @@ def _atomic_copy(src: Path, dest: Path) -> None:
|
|
| 236 |
try:
|
| 237 |
os.close(fd)
|
| 238 |
# copy2 calls open(); after the symlink check above, opening the
|
| 239 |
-
# regular file is safe on
|
| 240 |
-
# privilege so this is additionally defended by ACL.
|
| 241 |
shutil.copy2(str(src), tmp, follow_symlinks=False)
|
| 242 |
os.replace(tmp, dest)
|
| 243 |
except Exception:
|
|
@@ -278,8 +277,8 @@ def _validate_manifest_dest(dest_rel: str) -> Path:
|
|
| 278 |
# ── Create ──────────────────────────────────────────────────────────────────
|
| 279 |
|
| 280 |
|
| 281 |
-
# Filesystem-safe reason slug: reasons flow into directory names, so
|
| 282 |
-
#
|
| 283 |
_REASON_SAFE_CHARS = "-_."
|
| 284 |
|
| 285 |
|
|
@@ -318,7 +317,7 @@ def _new_snapshot_id(now: float | None = None, reason: str | None = None) -> str
|
|
| 318 |
def _publish_snapshot_dir(tmp_path: Path, snap_path: Path) -> None:
|
| 319 |
if snap_path.exists():
|
| 320 |
raise FileExistsError(snap_path)
|
| 321 |
-
|
| 322 |
_fsync_parent_dir(snap_path.parent)
|
| 323 |
|
| 324 |
|
|
|
|
| 76 |
# paying a per-call config read.
|
| 77 |
from ctx.utils._fs_utils import (
|
| 78 |
_fsync_parent_dir,
|
| 79 |
+
_replace_atomically,
|
| 80 |
atomic_write_text as _atomic_write_text,
|
| 81 |
)
|
| 82 |
from backup_config import BackupConfig, from_ctx_config
|
|
|
|
| 236 |
try:
|
| 237 |
os.close(fd)
|
| 238 |
# copy2 calls open(); after the symlink check above, opening the
|
| 239 |
+
# regular file is safe on the supported POSIX hosts.
|
|
|
|
| 240 |
shutil.copy2(str(src), tmp, follow_symlinks=False)
|
| 241 |
os.replace(tmp, dest)
|
| 242 |
except Exception:
|
|
|
|
| 277 |
# ── Create ──────────────────────────────────────────────────────────────────
|
| 278 |
|
| 279 |
|
| 280 |
+
# Filesystem-safe reason slug: reasons flow into directory names, so strip
|
| 281 |
+
# separators and punctuation that could create traversal or ambiguous names.
|
| 282 |
_REASON_SAFE_CHARS = "-_."
|
| 283 |
|
| 284 |
|
|
|
|
| 317 |
def _publish_snapshot_dir(tmp_path: Path, snap_path: Path) -> None:
|
| 318 |
if snap_path.exists():
|
| 319 |
raise FileExistsError(snap_path)
|
| 320 |
+
_replace_atomically(tmp_path, snap_path)
|
| 321 |
_fsync_parent_dir(snap_path.parent)
|
| 322 |
|
| 323 |
|
src/backup_watchdog.py
CHANGED
|
@@ -26,8 +26,8 @@ Run it by hand::
|
|
| 26 |
|
| 27 |
python src/backup_mirror.py watchdog --interval 60
|
| 28 |
|
| 29 |
-
Or register it as a background service using
|
| 30 |
-
(
|
| 31 |
``docs/backup-hook-install.md``.
|
| 32 |
|
| 33 |
Exit codes:
|
|
|
|
| 26 |
|
| 27 |
python src/backup_mirror.py watchdog --interval 60
|
| 28 |
|
| 29 |
+
Or register it as a background service using the supported host init system
|
| 30 |
+
(systemd on Linux or launchd on macOS). See
|
| 31 |
``docs/backup-hook-install.md``.
|
| 32 |
|
| 33 |
Exit codes:
|
src/corpus_cache.py
CHANGED
|
@@ -56,9 +56,8 @@ DEFAULT_CACHE_ROOT = Path(os.path.expanduser("~/.claude/skills/_embeddings"))
|
|
| 56 |
# via crafted skill/agent IDs.
|
| 57 |
_SUBJECT_ID_RE = re.compile(r"^[a-zA-Z0-9][a-zA-Z0-9_\-\.]{0,127}$")
|
| 58 |
|
| 59 |
-
# Backend names like "sentence-transformers:all-MiniLM-L6-v2" contain
|
| 60 |
-
#
|
| 61 |
-
# before using the name as a directory component.
|
| 62 |
_BACKEND_UNSAFE_RE = re.compile(r"[^a-zA-Z0-9_\-\.]")
|
| 63 |
|
| 64 |
# 64 bits of content hash in the filename. Within a single subject_id
|
|
|
|
| 56 |
# via crafted skill/agent IDs.
|
| 57 |
_SUBJECT_ID_RE = re.compile(r"^[a-zA-Z0-9][a-zA-Z0-9_\-\.]{0,127}$")
|
| 58 |
|
| 59 |
+
# Backend names like "sentence-transformers:all-MiniLM-L6-v2" contain path
|
| 60 |
+
# separators and punctuation, so slugify before using them as directories.
|
|
|
|
| 61 |
_BACKEND_UNSAFE_RE = re.compile(r"[^a-zA-Z0-9_\-\.]")
|
| 62 |
|
| 63 |
# 64 bits of content hash in the filename. Within a single subject_id
|
src/ctx/adapters/claude_code/inject_hooks.py
CHANGED
|
@@ -15,7 +15,6 @@ import argparse
|
|
| 15 |
import json
|
| 16 |
import os
|
| 17 |
import shlex
|
| 18 |
-
import subprocess
|
| 19 |
import sys
|
| 20 |
import tempfile
|
| 21 |
from pathlib import Path
|
|
@@ -115,8 +114,6 @@ def make_hooks(ctx_dir: str) -> dict:
|
|
| 115 |
def _module_cmd(module: str, *args: str) -> str:
|
| 116 |
"""Return a hook command that targets an installed Python module."""
|
| 117 |
parts = [sys.executable, "-m", module, *args]
|
| 118 |
-
if os.name == "nt":
|
| 119 |
-
return subprocess.list2cmdline(parts)
|
| 120 |
return " ".join(shlex.quote(part) for part in parts)
|
| 121 |
|
| 122 |
|
|
@@ -219,11 +216,8 @@ def merge_hooks(existing: dict, new_hooks: dict) -> dict:
|
|
| 219 |
def write_settings_atomic(path: Path, data: dict) -> None:
|
| 220 |
"""Write settings.json atomically: tempfile + fsync + os.replace().
|
| 221 |
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
if the destination is held open by another process/thread. We retry a
|
| 225 |
-
small number of times with a short back-off; after that we re-raise so
|
| 226 |
-
callers know something is genuinely wrong.
|
| 227 |
"""
|
| 228 |
import time
|
| 229 |
|
|
@@ -239,7 +233,7 @@ def write_settings_atomic(path: Path, data: dict) -> None:
|
|
| 239 |
fh.write(content)
|
| 240 |
fh.flush()
|
| 241 |
os.fsync(fh.fileno())
|
| 242 |
-
# Retry
|
| 243 |
_last_exc: Exception | None = None
|
| 244 |
for attempt in range(10):
|
| 245 |
try:
|
|
|
|
| 15 |
import json
|
| 16 |
import os
|
| 17 |
import shlex
|
|
|
|
| 18 |
import sys
|
| 19 |
import tempfile
|
| 20 |
from pathlib import Path
|
|
|
|
| 114 |
def _module_cmd(module: str, *args: str) -> str:
|
| 115 |
"""Return a hook command that targets an installed Python module."""
|
| 116 |
parts = [sys.executable, "-m", module, *args]
|
|
|
|
|
|
|
| 117 |
return " ".join(shlex.quote(part) for part in parts)
|
| 118 |
|
| 119 |
|
|
|
|
| 216 |
def write_settings_atomic(path: Path, data: dict) -> None:
|
| 217 |
"""Write settings.json atomically: tempfile + fsync + os.replace().
|
| 218 |
|
| 219 |
+
``os.replace()`` is atomic on the supported POSIX hosts. A short retry also
|
| 220 |
+
tolerates transient permission races from concurrent local tooling.
|
|
|
|
|
|
|
|
|
|
| 221 |
"""
|
| 222 |
import time
|
| 223 |
|
|
|
|
| 233 |
fh.write(content)
|
| 234 |
fh.flush()
|
| 235 |
os.fsync(fh.fileno())
|
| 236 |
+
# Retry transient permission races without hiding persistent failures.
|
| 237 |
_last_exc: Exception | None = None
|
| 238 |
for attempt in range(10):
|
| 239 |
try:
|
src/ctx/adapters/claude_code/install/mcp_install.py
CHANGED
|
@@ -112,7 +112,6 @@ _BANNED_INTERPRETER_ARGS: dict[str, frozenset[str]] = {
|
|
| 112 |
# npx / uvx / bunx intentionally unrestricted — they ARE the
|
| 113 |
# package-launcher pattern MCP servers are expected to use.
|
| 114 |
}
|
| 115 |
-
_WINDOWS_EXEC_SUFFIXES = (".exe", ".cmd", ".bat", ".ps1")
|
| 116 |
|
| 117 |
|
| 118 |
def _rejects_banned_args(tokens: list[str]) -> str | None:
|
|
@@ -153,11 +152,7 @@ def _rejects_banned_args(tokens: list[str]) -> str | None:
|
|
| 153 |
|
| 154 |
|
| 155 |
def _normalized_executable(value: str) -> str:
|
| 156 |
-
|
| 157 |
-
for suffix in _WINDOWS_EXEC_SUFFIXES:
|
| 158 |
-
if name.endswith(suffix):
|
| 159 |
-
return name[: -len(suffix)]
|
| 160 |
-
return name
|
| 161 |
|
| 162 |
|
| 163 |
def _find_json_inline_secret_arg(parsed_config: object) -> str | None:
|
|
@@ -646,18 +641,8 @@ def install_mcp(
|
|
| 646 |
)
|
| 647 |
|
| 648 |
|
| 649 |
-
def _split_install_command(command: str
|
| 650 |
-
|
| 651 |
-
tokens = shlex.split(command, posix=not use_windows_rules)
|
| 652 |
-
if use_windows_rules:
|
| 653 |
-
tokens = [_strip_surrounding_quotes(token) for token in tokens]
|
| 654 |
-
return tokens
|
| 655 |
-
|
| 656 |
-
|
| 657 |
-
def _strip_surrounding_quotes(value: str) -> str:
|
| 658 |
-
if len(value) >= 2 and value[0] == value[-1] and value[0] in {"'", '"'}:
|
| 659 |
-
return value[1:-1]
|
| 660 |
-
return value
|
| 661 |
|
| 662 |
|
| 663 |
def uninstall_mcp(
|
|
@@ -795,8 +780,7 @@ def _build_uninstall_parser() -> argparse.ArgumentParser:
|
|
| 795 |
|
| 796 |
|
| 797 |
def _force_utf8_stdio() -> None:
|
| 798 |
-
"""Mirror
|
| 799 |
-
``═`` box-drawing characters that crash Windows' cp1252 stdout."""
|
| 800 |
for stream in (sys.stdout, sys.stderr):
|
| 801 |
reconfigure = getattr(stream, "reconfigure", None)
|
| 802 |
if reconfigure is None:
|
|
|
|
| 112 |
# npx / uvx / bunx intentionally unrestricted — they ARE the
|
| 113 |
# package-launcher pattern MCP servers are expected to use.
|
| 114 |
}
|
|
|
|
| 115 |
|
| 116 |
|
| 117 |
def _rejects_banned_args(tokens: list[str]) -> str | None:
|
|
|
|
| 152 |
|
| 153 |
|
| 154 |
def _normalized_executable(value: str) -> str:
|
| 155 |
+
return Path(value).name.lower()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
|
| 157 |
|
| 158 |
def _find_json_inline_secret_arg(parsed_config: object) -> str | None:
|
|
|
|
| 641 |
)
|
| 642 |
|
| 643 |
|
| 644 |
+
def _split_install_command(command: str) -> list[str]:
|
| 645 |
+
return shlex.split(command, posix=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 646 |
|
| 647 |
|
| 648 |
def uninstall_mcp(
|
|
|
|
| 780 |
|
| 781 |
|
| 782 |
def _force_utf8_stdio() -> None:
|
| 783 |
+
"""Mirror mcp_fetch/mcp_ingest: always render card output as UTF-8."""
|
|
|
|
| 784 |
for stream in (sys.stdout, sys.stderr):
|
| 785 |
reconfigure = getattr(stream, "reconfigure", None)
|
| 786 |
if reconfigure is None:
|
src/ctx/adapters/generic/tools/mcp_router.py
CHANGED
|
@@ -66,14 +66,9 @@ _CLIENT_INFO = {"name": "ctx-harness", "version": "0.1"}
|
|
| 66 |
_SAFE_PARENT_ENV_KEYS = frozenset(
|
| 67 |
{
|
| 68 |
"PATH",
|
| 69 |
-
"PATHEXT",
|
| 70 |
-
"SYSTEMROOT",
|
| 71 |
-
"WINDIR",
|
| 72 |
-
"COMSPEC",
|
| 73 |
"TMP",
|
| 74 |
"TEMP",
|
| 75 |
"HOME",
|
| 76 |
-
"USERPROFILE",
|
| 77 |
"LANG",
|
| 78 |
}
|
| 79 |
)
|
|
@@ -379,8 +374,6 @@ def _expand_config_args(config: "McpServerConfig", env: dict[str, str]) -> tuple
|
|
| 379 |
|
| 380 |
|
| 381 |
def _popen_process_group_kwargs() -> dict[str, Any]:
|
| 382 |
-
if os.name == "nt":
|
| 383 |
-
return {"creationflags": getattr(subprocess, "CREATE_NEW_PROCESS_GROUP", 0)}
|
| 384 |
return {"start_new_session": True}
|
| 385 |
|
| 386 |
|
|
@@ -391,34 +384,9 @@ def _signal_process_tree(
|
|
| 391 |
) -> None:
|
| 392 |
if proc.poll() is not None:
|
| 393 |
return
|
| 394 |
-
|
| 395 |
-
args = ["taskkill", "/PID", str(proc.pid), "/T"]
|
| 396 |
-
if force:
|
| 397 |
-
args.append("/F")
|
| 398 |
-
try:
|
| 399 |
-
subprocess.run(
|
| 400 |
-
args,
|
| 401 |
-
stdout=subprocess.DEVNULL,
|
| 402 |
-
stderr=subprocess.DEVNULL,
|
| 403 |
-
timeout=2.0,
|
| 404 |
-
check=False,
|
| 405 |
-
)
|
| 406 |
-
except Exception: # noqa: BLE001
|
| 407 |
-
if force:
|
| 408 |
-
proc.kill()
|
| 409 |
-
return
|
| 410 |
-
|
| 411 |
-
killpg = getattr(os, "killpg", None)
|
| 412 |
-
if killpg is None:
|
| 413 |
-
if force:
|
| 414 |
-
proc.kill()
|
| 415 |
-
else:
|
| 416 |
-
proc.terminate()
|
| 417 |
-
return
|
| 418 |
-
|
| 419 |
-
sig = getattr(signal, "SIGKILL", signal.SIGTERM) if force else signal.SIGTERM
|
| 420 |
try:
|
| 421 |
-
killpg(proc.pid, sig)
|
| 422 |
except ProcessLookupError:
|
| 423 |
return
|
| 424 |
except Exception: # noqa: BLE001
|
|
@@ -429,13 +397,7 @@ def _signal_process_tree(
|
|
| 429 |
|
| 430 |
|
| 431 |
def _resolve_executable(command: str, env: dict[str, str]) -> str:
|
| 432 |
-
"""Resolve bare commands through PATH
|
| 433 |
-
|
| 434 |
-
Windows does not let ``subprocess.Popen(["npx", ...])`` find
|
| 435 |
-
``npx.cmd`` reliably in all environments. ``shutil.which`` applies
|
| 436 |
-
PATHEXT and gives us the actual executable path while leaving
|
| 437 |
-
explicit paths untouched.
|
| 438 |
-
"""
|
| 439 |
if not command.strip():
|
| 440 |
raise ValueError("MCP command is empty")
|
| 441 |
if os.path.isabs(command) or any(sep in command for sep in ("/", "\\")):
|
|
@@ -462,7 +424,7 @@ class McpServerConfig:
|
|
| 462 |
|
| 463 |
``env`` is the explicit child overlay. Parent secrets are not
|
| 464 |
inherited by default; only a small process-basics allowlist
|
| 465 |
-
(PATH, temp/home,
|
| 466 |
``credential_env`` names specific parent env vars to copy into the
|
| 467 |
child without enabling full environment inheritance.
|
| 468 |
Set ``inherit_env=True`` only for trusted local servers that need
|
|
|
|
| 66 |
_SAFE_PARENT_ENV_KEYS = frozenset(
|
| 67 |
{
|
| 68 |
"PATH",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
"TMP",
|
| 70 |
"TEMP",
|
| 71 |
"HOME",
|
|
|
|
| 72 |
"LANG",
|
| 73 |
}
|
| 74 |
)
|
|
|
|
| 374 |
|
| 375 |
|
| 376 |
def _popen_process_group_kwargs() -> dict[str, Any]:
|
|
|
|
|
|
|
| 377 |
return {"start_new_session": True}
|
| 378 |
|
| 379 |
|
|
|
|
| 384 |
) -> None:
|
| 385 |
if proc.poll() is not None:
|
| 386 |
return
|
| 387 |
+
sig = signal.SIGKILL if force else signal.SIGTERM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
try:
|
| 389 |
+
os.killpg(proc.pid, sig)
|
| 390 |
except ProcessLookupError:
|
| 391 |
return
|
| 392 |
except Exception: # noqa: BLE001
|
|
|
|
| 397 |
|
| 398 |
|
| 399 |
def _resolve_executable(command: str, env: dict[str, str]) -> str:
|
| 400 |
+
"""Resolve bare commands through PATH before spawning."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
if not command.strip():
|
| 402 |
raise ValueError("MCP command is empty")
|
| 403 |
if os.path.isabs(command) or any(sep in command for sep in ("/", "\\")):
|
|
|
|
| 424 |
|
| 425 |
``env`` is the explicit child overlay. Parent secrets are not
|
| 426 |
inherited by default; only a small process-basics allowlist
|
| 427 |
+
(PATH, temp/home, and locale) is passed through.
|
| 428 |
``credential_env`` names specific parent env vars to copy into the
|
| 429 |
child without enabling full environment inheritance.
|
| 430 |
Set ``inherit_env=True`` only for trusted local servers that need
|
src/ctx/cli/run.py
CHANGED
|
@@ -498,16 +498,7 @@ def _apply_mcp_env_overlays(
|
|
| 498 |
|
| 499 |
def _split_mcp_invocation(invocation: str) -> list[str]:
|
| 500 |
"""Split an MCP command string without invoking a shell."""
|
| 501 |
-
|
| 502 |
-
if os.name == "nt":
|
| 503 |
-
parts = [_strip_surrounding_quotes(part) for part in parts]
|
| 504 |
-
return parts
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
def _strip_surrounding_quotes(value: str) -> str:
|
| 508 |
-
if len(value) >= 2 and value[0] == value[-1] and value[0] in {"'", '"'}:
|
| 509 |
-
return value[1:-1]
|
| 510 |
-
return value
|
| 511 |
|
| 512 |
|
| 513 |
_MCP_PRESETS: dict[str, McpServerConfig] = {
|
|
|
|
| 498 |
|
| 499 |
def _split_mcp_invocation(invocation: str) -> list[str]:
|
| 500 |
"""Split an MCP command string without invoking a shell."""
|
| 501 |
+
return shlex.split(invocation, posix=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 502 |
|
| 503 |
|
| 504 |
_MCP_PRESETS: dict[str, McpServerConfig] = {
|
src/ctx/core/graph/semantic_edges.py
CHANGED
|
@@ -329,7 +329,7 @@ def _save_cache(
|
|
| 329 |
keys = sorted(cache.keys())
|
| 330 |
hashes = np.asarray(keys, dtype="S64")
|
| 331 |
vecs = np.stack([cache[k] for k in keys]).astype("float32")
|
| 332 |
-
from ctx.utils._fs_utils import
|
| 333 |
|
| 334 |
path = _cache_file(cache_dir)
|
| 335 |
# ``np.savez_compressed`` auto-appends ``.npz`` when the filename
|
|
@@ -341,12 +341,7 @@ def _save_cache(
|
|
| 341 |
tmp_stem = path.with_name("embeddings.tmp") # on-disk target: embeddings.tmp.npz
|
| 342 |
np.savez_compressed(tmp_stem, hashes=hashes, vecs=vecs, model=np.asarray([model_id]))
|
| 343 |
tmp_real = tmp_stem.with_name(tmp_stem.name + ".npz") # "embeddings.tmp.npz"
|
| 344 |
-
|
| 345 |
-
# the os-level rename can race with antivirus/indexer handles on a
|
| 346 |
-
# 20MB+ .npz written milliseconds earlier. The wrapper retries 10x
|
| 347 |
-
# at 50ms each, totalling up to 500ms, which beats a 14-min rebuild
|
| 348 |
-
# losing its output to a transient lock.
|
| 349 |
-
_replace_with_retry(str(tmp_real), path)
|
| 350 |
|
| 351 |
|
| 352 |
# ────────────────────────────────────────────────────────────────────
|
|
|
|
| 329 |
keys = sorted(cache.keys())
|
| 330 |
hashes = np.asarray(keys, dtype="S64")
|
| 331 |
vecs = np.stack([cache[k] for k in keys]).astype("float32")
|
| 332 |
+
from ctx.utils._fs_utils import _replace_atomically # noqa: PLC0415 — local import
|
| 333 |
|
| 334 |
path = _cache_file(cache_dir)
|
| 335 |
# ``np.savez_compressed`` auto-appends ``.npz`` when the filename
|
|
|
|
| 341 |
tmp_stem = path.with_name("embeddings.tmp") # on-disk target: embeddings.tmp.npz
|
| 342 |
np.savez_compressed(tmp_stem, hashes=hashes, vecs=vecs, model=np.asarray([model_id]))
|
| 343 |
tmp_real = tmp_stem.with_name(tmp_stem.name + ".npz") # "embeddings.tmp.npz"
|
| 344 |
+
_replace_atomically(tmp_real, path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 345 |
|
| 346 |
|
| 347 |
# ────────────────────────────────────────────────────────────────────
|
src/ctx/core/graph/vector_index.py
CHANGED
|
@@ -16,7 +16,7 @@ from typing import Any
|
|
| 16 |
import numpy as np
|
| 17 |
|
| 18 |
from ctx.utils._file_lock import file_lock
|
| 19 |
-
from ctx.utils._fs_utils import
|
| 20 |
|
| 21 |
_INDEX_VERSION = 1
|
| 22 |
_META_NAME = "vector-index.meta.json"
|
|
@@ -161,7 +161,7 @@ class HnswlibVectorIndex(NumpyFlatVectorIndex):
|
|
| 161 |
_save_numpy_data(cache_dir / _NUMPY_NAME, self)
|
| 162 |
tmp = cache_dir / f".{_HNSW_NAME}.tmp"
|
| 163 |
self._hnsw_index.save_index(str(tmp))
|
| 164 |
-
|
| 165 |
atomic_write_json(meta_path, asdict(self.meta))
|
| 166 |
|
| 167 |
|
|
@@ -491,7 +491,7 @@ def _save_numpy_data(path: Path, index: NumpyFlatVectorIndex) -> None:
|
|
| 491 |
vecs=index.vectors.astype("float32"),
|
| 492 |
)
|
| 493 |
tmp_real = tmp_stem.with_name(tmp_stem.name + ".npz")
|
| 494 |
-
|
| 495 |
|
| 496 |
|
| 497 |
def _load_numpy_data(path: Path) -> tuple[list[str], list[str], np.ndarray]:
|
|
|
|
| 16 |
import numpy as np
|
| 17 |
|
| 18 |
from ctx.utils._file_lock import file_lock
|
| 19 |
+
from ctx.utils._fs_utils import _replace_atomically, atomic_write_json
|
| 20 |
|
| 21 |
_INDEX_VERSION = 1
|
| 22 |
_META_NAME = "vector-index.meta.json"
|
|
|
|
| 161 |
_save_numpy_data(cache_dir / _NUMPY_NAME, self)
|
| 162 |
tmp = cache_dir / f".{_HNSW_NAME}.tmp"
|
| 163 |
self._hnsw_index.save_index(str(tmp))
|
| 164 |
+
_replace_atomically(tmp, cache_dir / _HNSW_NAME)
|
| 165 |
atomic_write_json(meta_path, asdict(self.meta))
|
| 166 |
|
| 167 |
|
|
|
|
| 491 |
vecs=index.vectors.astype("float32"),
|
| 492 |
)
|
| 493 |
tmp_real = tmp_stem.with_name(tmp_stem.name + ".npz")
|
| 494 |
+
_replace_atomically(tmp_real, path)
|
| 495 |
|
| 496 |
|
| 497 |
def _load_numpy_data(path: Path) -> tuple[list[str], list[str], np.ndarray]:
|
src/ctx/monitor/pages/harness.py
CHANGED
|
@@ -112,8 +112,8 @@ def render_harness_wizard(
|
|
| 112 |
"<label class='wide'>Development goal <span class='pill grade-A'>Required</span>"
|
| 113 |
"<textarea name='goal' rows='4' required placeholder='What should the agent build, fix, research, or operate?'></textarea></label>"
|
| 114 |
"<label>Runtime / OS"
|
| 115 |
-
"<select name='runtime'><option>
|
| 116 |
-
"<option selected>
|
| 117 |
"<label>Autonomy"
|
| 118 |
"<select name='autonomy'><option>read-only</option><option selected>repo-write</option>"
|
| 119 |
"<option>deploy-capable</option></select></label>"
|
|
|
|
| 112 |
"<label class='wide'>Development goal <span class='pill grade-A'>Required</span>"
|
| 113 |
"<textarea name='goal' rows='4' required placeholder='What should the agent build, fix, research, or operate?'></textarea></label>"
|
| 114 |
"<label>Runtime / OS"
|
| 115 |
+
"<select name='runtime'><option>macos</option><option>linux</option>"
|
| 116 |
+
"<option selected>linux + macos</option></select></label>"
|
| 117 |
"<label>Autonomy"
|
| 118 |
"<select name='autonomy'><option>read-only</option><option selected>repo-write</option>"
|
| 119 |
"<option>deploy-capable</option></select></label>"
|