Widen predicate interface to VerificationContext and add Predicate protocol#71
Merged
Merged
Conversation
…otocol Predicates now receive the full VerificationContext instead of three separate args (agent_output, pre_env, post_env). This lets combinators (all_of, any_of, not) forward observations and function_calls to nested predicates unchanged — unblocking OCSF predicates that need to read ctx.observations["openshell"] instead of smuggling data through env fields. Predicate is now a Protocol in midojo.verifiers — any object with evaluate(ctx: VerificationContext) -> bool satisfies it, replacing the union type that required updating for every new predicate class. The verifier framework (protocols, combinators, registry) moves from midojo.verifier to midojo.verifiers.__init__; midojo.verifier becomes a re-export shim for backwards compatibility. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dmaniloff
commented
Jun 10, 2026
| """A parsed check bound to the verifier that evaluates it.""" | ||
|
|
||
| verifier: Verifier | ||
| parsed: Any |
Member
Author
There was a problem hiding this comment.
in a follow up PR we will make this parsed: Predicate
saichandrapandraju
approved these changes
Jun 10, 2026
saichandrapandraju
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, thanks @dmaniloff, I'll rebase #70 once this is merged
saichandrapandraju
added a commit
that referenced
this pull request
Jun 10, 2026
- Rename suite folder shell_financial_report → document_assistant - Use pi image and policy (community sandbox with PI pre-installed); drop the embedded ollama agent script - Add agent_command field to suite YAML and OpenShellBackend so the agent binary is configurable rather than hardcoded to ["pi", ...] - Rename OpenShellPIAgentClient → OpenShellAgentClient - Move shell/OCSF predicates from verifiers/builtin.py to a dedicated verifiers/openshell.py module; update to evaluate(ctx) interface introduced by #71 (full VerificationContext now reaches nested predicates) - Rebase on top of #71 which fixes combinator context forwarding Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
saichandrapandraju
added a commit
that referenced
this pull request
Jun 11, 2026
- Rename suite folder shell_financial_report → document_assistant - Use pi image and policy (community sandbox with PI pre-installed); drop the embedded ollama agent script - Add agent_command field to suite YAML and OpenShellBackend so the agent binary is configurable rather than hardcoded to ["pi", ...] - Rename OpenShellPIAgentClient → OpenShellAgentClient - Move shell/OCSF predicates from verifiers/builtin.py to a dedicated verifiers/openshell.py module; update to evaluate(ctx) interface introduced by #71 (full VerificationContext now reaches nested predicates) - Rebase on top of #71 which fixes combinator context forwarding Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
VerificationContextinstead of(agent_output, pre_env, post_env), so combinators (all_of,any_of,not) forward observations and function calls to nested predicates unchanged.Predicateis now aProtocol— any object withevaluate(ctx) -> boolsatisfies it. The union type that had to be updated for every new predicate class is gone.midojo.verifiertomidojo.verifiers.__init__;midojo.verifierbecomes a re-export shim.This fixes the issue raised by PR #70.
Test plan
🤖 Generated with Claude Code