Repository navigation
feat(harness): negative controls, leaked-answer check, grounding and suite proving (TH-8918) - #321
Draft
KarthikAvinashFI wants to merge 21 commits into
Draft
KarthikAvinashFI wants to merge 21 commits into
KarthikAvinashFI wants to merge 21 commits into
Conversation
…suite proving at certify
…n and give the proof test world setup outcomes
…e, and why names the real block
… a control's wrong transcript, else kept as written
…ader-only material
… block a case that contradicts it
…sources and asks for an assumption source
… live runtime for service-bound tools
…en, and a control that cannot be played is no evidence
… nested in a list or object, counts as a leaked answer
…e a new case comes from
…ption source, as sources are now required
… an older suite rewritten as it was reads unchanged
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
TH-8918 (scenario lifecycle), plan task T05 ("Make scenarios valid and meaningfully graded"): a scenario is only worth running when its checks can fail a wrong behaviour, when nothing the caller or the agent sees gives the answer away, and when what it cites really says what it claims. Before this PR none of the three was checked: a case passed with checks that also passed a wrong refund, a case could quote its own grader text in the caller's instruction, and sources were not recorded at all.
This PR adds the three checks to the prove gate and a suite-wide re-prove that the platform's Validate runs at certify. The platform side (lifecycle states, Validate, archive, restore, source changes) is future-agi
feat/TH-8918-scenario-lifecycle.What changed
src/fi/alk/harness/scenario.pyNegativeControl(name,why,steps,must_fail) andScenarioSource(kindsrule,file,chat_message,evidence_case,requirement,assumption, with the quoted words) onScenario.src/fi/alk/harness/prove.pyno_negative_control,negative_control_passed,answer_leaked,source_unresolved;control_not_runwhen a control's tool has no endpoint here._outcomereads a refusal case asno_changeonly when the reference solution really left the world untouched.src/fi/alk/harness/leaks.py(new)what,judged,reference,verifier,comparison, tests, a control'swhy, evaluator-only files), a multi-word sub-goal name, or a computed expected value the world does not hold, found in the instruction, variables, persona, opening message or an actor's brief. Returns the excerpt and the grader field.src/fi/alk/harness/grounding.py(new)rule,file,requirementandassumptionsources against the contract and the world's files (matched_digestassha256:<hex>); other kinds are left for the platform.src/fi/alk/harness/prove_suite.py(new)broken_check, a run out of budget writes the restvalidation_incomplete. Keeps a 300 s margin before the job's deadline.src/fi/alk/harness/authoring_entrypoint.py--certify-only --prove-scenarios [--deadline-at]runs the suite re-prove before sealing and writesscenario-proofs.json; a failure there never fails the certify.src/fi/alk/harness/scenario_tools.pyaccept_scenariorefuses a case with one of the four codes above, with the reason; controls are checked against the agent's contract like solution steps.src/fi/alk/harness/proofs.pyoutcome, the controls that ran, the leaks found and the source results.skills/write-scenarios/SKILL.md,references/refusals.md,skills/builder/SKILL.mdtests/harness/*,tests/test_harness.pyaccept_scenariogained a negative control.Behavior callouts
no_negative_control). Existing saved scenarios are not rewritten; the platform reads them as legacy.control_not_run: the case is kept as written, never proved.answer_leakedwins over every lane code; a lane code never hides a fault (test_lane_codes_never_hide_a_fault).--prove-scenarios,--deadline-at). No new env var.Tests
test_negative_controls.py,test_leaks.py,test_grounding.py,test_prove_suite.py,test_proofs.py, plus adjusted fixtures intest_nudge_turn.py,test_builder_chat.pyandtests/test_harness.py.tests/harnessmodule importing changed code (35 modules) andtests/test_harness.py. All new and named tests pass. Failures identical ondev(0203bdf5):test_harness.py3,test_background_noise.py2,test_grade.py1,test_harness_architecture.py11.test_failure_message_is_not_grader_onlystrengthened.whytext. Two real bugs came out of it and are fixed here: a compared literal insidereturn None if ... == 42.50 else ...was not read by the leak check, and an assumed write step readno_change, so a write case looked like a refusal case.Live proof
Local stack with production sandbox specs (4 CPU, 8192 MB, restricted egress), builder chat on real demo agents.
test_two_refunds_control_fails,test_control_that_passes_blocksPlaywright e2e
None in this repo. The platform flows for the lifecycle (SIM-E2E-008 and SIM-E2E-001 to 006) passed 7 of 7 on the platform branch at
4fb67ad21, with this branch mounted.Plan lines S3 to S21 and the test pass on this head
ad37f0c5).live_proof.py,d751967e); a check that raises under a control reads broken and a control that cannot be played is no evidence (70e8de2f).prove_suite --keysproves only the named cases (445444e0).ec69f384); a blank assumption source does not count (2a29511b).6d08f42c).e61ebba3).must_pass, versioned with its content (f76c3f2b,23010c01).bf2c058a);37.5and37.50, and values nested in a list or object, count as a leaked answer (d45eba32).Fixed during the test pass:
d333f0c3scenario.jsongained"must_pass": false.must_passis written only when set, so an older suite rewritten as it was reads unchanged.3b2fbf9crequire_sources=Truehad no test (a mutation survived); a test now pins it.e4481805Tests on this head (the targeted harness modules, one process, the CI extras installed): 2620 pass. Three failures, the same on
dev(0203bdf5):test_hosted_claude_session_uses_durable_resume_and_restricted_tools,test_a_skill_only_names_tools_its_stage_actually_has,test_the_system_prompt_stays_within_budget. With the two branches stacked on it: 2658 pass, the same three.Mutation checks in this pass, all killed: the accept-time sources gate (2 tests fail), the builder submit sources flag (1),
must_passwritten only when set (1).Break-it attempts: a blank or whitespace assumption source (refused), an unchanged legacy case with no sources (saves), a changed legacy case with no sources (refused), a judge that cannot decide a policy conflict (not cached, never blocks), a control naming a check the case does not have (refused with the reason).
Live (production-spec local stack, pharmacy voice demo): asked the builder for a case about a prescription number that is not on file; it wrote the case as "not on file" and cited the person's words. Image on the platform PR #4107.
Scope out
source_model_fingerprint_mismatch,generated_runtime_entrypoint_ambiguous), in code this PR does not touch.Stacked on / merge order
feat/TH-8752-proof-honesty(agent-learning-kit). Merge that first.feat/TH-8918-scenario-lifecyclepasses--prove-scenariosand readsscenario-proofs.json; this PR should merge before or with it.Linear: TH-8918