Skip to content

Widen predicate interface to VerificationContext and add Predicate protocol#71

Merged
saichandrapandraju merged 1 commit into
mainfrom
predicate-ctx-refactor
Jun 10, 2026
Merged

Widen predicate interface to VerificationContext and add Predicate protocol#71
saichandrapandraju merged 1 commit into
mainfrom
predicate-ctx-refactor

Conversation

@dmaniloff

@dmaniloff dmaniloff commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Predicates now receive the full VerificationContext instead of (agent_output, pre_env, post_env), so combinators (all_of, any_of, not) forward observations and function calls to nested predicates unchanged.
  • Predicate is now a Protocol — any object with evaluate(ctx) -> bool satisfies it. The union type that had to be updated for every new predicate class is gone.
  • The verifier framework (protocols, combinators, registry) moves from midojo.verifier to midojo.verifiers.__init__; midojo.verifier becomes a re-export shim.

This fixes the issue raised by PR #70.

Test plan

  • All 128 existing tests pass
  • End-to-end run with PI agent on weather suite confirms grading pipeline works

🤖 Generated with Claude Code

…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>
"""A parsed check bound to the verifier that evaluates it."""

verifier: Verifier
parsed: Any

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in a follow up PR we will make this parsed: Predicate

@saichandrapandraju saichandrapandraju left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @dmaniloff, I'll rebase #70 once this is merged

@saichandrapandraju saichandrapandraju merged commit 129b698 into main Jun 10, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants