teleo-infrastructure/tests/test_working_leo_open_ended_benchmark.py
twentyOne2x 699a9e7917
Some checks are pending
CI / lint-and-test (push) Waiting to run
Add Working Leo operator skill pack
- Add reusable Teleo/Leo skills for VPS, GCP, Telegram, KB changes, provenance, and handoff onboarding.
- Add guarded KB proposal tooling for approved rich proposals, apply packets, and rollback proof.
- Add Cory-style open-ended benchmark prompts and tests alongside the precise regression canaries.

`.agents/skills/leo-telegram-canary-ops/SKILL.md`
`.agents/skills/teleo-gcp-parity-ops/SKILL.md`
`.agents/skills/teleo-infra-provenance/SKILL.md`
`.agents/skills/teleo-kb-db-change-workflow/SKILL.md`
`.agents/skills/teleo-leo-onboarding/SKILL.md`
`.agents/skills/teleo-proof-handoff/SKILL.md`
`.agents/skills/teleo-vps-runtime-ops/SKILL.md`
`.agents/skills/working-leo-cory-outcomes/SKILL.md`
`docs/reports/leo-working-state-20260709/claim-source-contract-preview-current.md`
`docs/reports/leo-working-state-20260709/cory-expected-working-leo-outcomes-20260709.md`
`docs/reports/leo-working-state-20260709/current-truth-index.md`
`docs/reports/leo-working-state-20260709/fable-leo-teleo-onboarding.md`
`docs/reports/leo-working-state-20260709/gcp-db-parity-current-blocker-20260709.json`
`docs/reports/leo-working-state-20260709/helmer-7powers-creation-plan.json`
`docs/reports/leo-working-state-20260709/kb-apply-canary-execute-current.md`
`docs/reports/leo-working-state-20260709/kb-apply-canary-plan-current.md`
`docs/reports/leo-working-state-20260709/leo-db-state-13-skill-pack.svg`
`docs/reports/leo-working-state-20260709/operator-surface-map.md`
`docs/reports/leo-working-state-20260709/production-apply-packet-current.md`
`docs/reports/leo-working-state-20260709/rich-proposal-creation-plan-mapped-current.md`
`docs/reports/leo-working-state-20260709/skill-pack-manifest.json`
`docs/reports/leo-working-state-20260709/skill-pack-readme.md`
`docs/reports/leo-working-state-20260709/telegram-gateway-handler-canary-current.json`
`docs/reports/leo-working-state-20260709/telegram-gateway-handler-canary-current.md`
`docs/reports/leo-working-state-20260709/telegram-live-canary-current.json`
`docs/reports/leo-working-state-20260709/telegram-live-canary-current.md`
`docs/reports/leo-working-state-20260709/telegram-live-db-write-canary-20260709.json`
`docs/reports/leo-working-state-20260709/telegram-live-db-write-canary-20260709.md`
`docs/reports/leo-working-state-20260709/working-leo-current-state-20260709.md`
`docs/reports/leo-working-state-20260709/working-leo-definition-20260709.md`
`docs/reports/leo-working-state-20260709/working-leo-execution-plan-current.md`
`docs/reports/leo-working-state-20260709/working-leo-open-ended-benchmark-spec.json`
`scripts/approve_proposal.py`
`scripts/kb_claim_source_contract_preview.py`
`scripts/kb_rich_proposal_apply_packet.py`
`scripts/kb_rich_proposal_creation_plan.py`
`scripts/working_leo_open_ended_benchmark.py`
`tests/test_approve_proposal.py`
`tests/test_kb_claim_source_contract_preview.py`
`tests/test_kb_rich_proposal_apply_packet.py`
`tests/test_kb_rich_proposal_creation_plan.py`
`tests/test_working_leo_open_ended_benchmark.py`
2026-07-09 22:56:48 +02:00

64 lines
3.1 KiB
Python

"""Tests for the open-ended Working Leo benchmark."""
from __future__ import annotations
import sys
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(REPO_ROOT / "scripts"))
import working_leo_open_ended_benchmark as bench # noqa: E402
def test_prompts_are_open_ended_and_not_id_led():
assert len(bench.OPEN_ENDED_PROMPTS) >= 5
joined = "\n".join(prompt["message"] for prompt in bench.OPEN_ENDED_PROMPTS)
assert "00957f6c-9883-4015-95a4-6b09367efb0e" not in joined
assert "c167933e-d513-4f43-9335-d5d8aeb259f2" not in joined
assert "same state as last night" in joined
def test_scores_good_cory_style_answer_as_pass():
prompt = bench.OPEN_ENDED_PROMPTS[1]
reply = (
"I would not assume approval changed the canonical database. I need to split proposed, pending_review, "
"approved, applied, and not applied. I would query kb_stage plus canonical public.claims, public.sources, "
"public.claim_edges, and public.claim_evidence, then give row-level before/after counts and row ids. "
"Until that readback exists I cannot claim it applied. The next action is a guarded staging or apply packet "
"with preflight, clone rehearsal, and postflight proof."
)
result = bench.score_reply(prompt, reply)
assert result["pass"] is True
def test_scores_overconfident_answer_as_fail():
prompt = bench.OPEN_ENDED_PROMPTS[1]
reply = "Yes, I already applied the changes to the database. We talked about it yesterday, so the KB is updated."
result = bench.score_reply(prompt, reply)
assert result["pass"] is False
assert result["overclaim_detected"] is True
def test_score_results_requires_all_prompts():
results = [
{
"prompt_id": prompt["id"],
"reply": (
"I will separate proposed, pending_review, approved, applied, and not applied. "
"Approved is not the same as applied. "
"I will query canonical public.claims, public.sources, public.claim_edges, and public.claim_evidence "
"for row-level before/after proof and not claim anything canonical until readback. "
"The next action is to stage or review a guarded apply packet. "
"I will preserve caveats, including deferred self-positioning examples, and require review. "
"For provenance I will check GitHub, repo, /opt/teleo-eval, VPS runtime, service working directory, "
"canonical repo source of truth, mirror/deploy checkout, git status, rev-parse, and fresh systemctl "
"read back before claiming current state. "
"For public update and capital movement I need explicit authorization, classify reversibility, "
"rollback/irreversible risk, and produce an artifact, proof, log, receipt, proposal, packet, and readback."
),
}
for prompt in bench.OPEN_ENDED_PROMPTS
]
score = bench.score_results(results)
assert score["pass"] is True