Skip to content

fix(examples): let the citation-check oracle run on python3 < 3.10 - #1160

Merged
bingran-you merged 2 commits into
benchflow-ai:mainfrom
Wenbo11:fix/oracle-citation-check-py39
Oct 30, 2026
Merged

bingran-you merged 2 commits into
benchflow-ai:mainfrom
Wenbo11:fix/oracle-citation-check-py39

Conversation

@Wenbo11

@Wenbo11 Wenbo11 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The inline Python in docs/examples/task-md/real-skillsbench/citation-check/oracle/solve.sh (from #773) annotates title_from_body as -> str | None without from __future__ import annotations.
On a python3 older than 3.10 the oracle exits before writing answer.json:

TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

The task image (Python 3.12) is unaffected, but tests/test_task_check_eval_consistency.py::test_citation_check_oracle_self_answers_static_fixture runs bash solve.sh with the caller's PATH.
Under uv run that resolves to the venv's python3, so CI passes.
When pytest is started by interpreter path (.venv/bin/python -m pytest, IDE test integrations) on a host whose python3 is 3.9 (the Xcode Command Line Tools on macOS, RHEL 9), the test fails.

Change

Add from __future__ import annotations to the heredoc.
Output is unchanged, and citation-check-network shares this oracle through a symlink.
No other host-run example or fixture script has the same problem.

Testing

shim=$(mktemp -d); ln -s "$(uv python find --no-project 3.9)" "$shim/python3"
PATH="$shim:$PATH" .venv/bin/python -m pytest tests/test_task_check_eval_consistency.py -k citation_check_oracle

Fails on main with the traceback above and passes on this branch.
bench eval run --tasks-dir docs/examples/task-md/real-skillsbench/citation-check --agent oracle --sandbox docker still scores 1.0.
No new test, because a failing case would need a pre-3.10 interpreter in CI.


Devin Review

The oracle's inline Python script annotates `title_from_body` with
`-> str | None`. Without postponed evaluation that annotation is evaluated
when the function is defined, so any `python3` older than 3.10 aborts with
`TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'`
before writing answer.json.

Inside the task image (ubuntu:24.04, Python 3.12) this never shows, but the
oracle is also run directly on the host by
test_citation_check_oracle_self_answers_static_fixture, which resolves
`python3` from PATH. When the venv's bin dir is not on PATH (for example
`.venv/bin/python -m pytest`), that is the system interpreter, which is 3.9
on stock macOS and on several LTS Linux distributions, and the test fails.

Add `from __future__ import annotations` so the hints stay unevaluated.
The citation-check-network variant shares this oracle through a symlink.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@bingran-you bingran-you 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.

Verified against current main: with Python 3.9 as python3, the citation-check oracle test fails on main with the TypeError and passes here. Fresh CI test and fixture-scenarios pass; parity and pip-audit fail only on main's existing openclaw manifest drift and dnspython advisory.

@bingran-you
bingran-you merged commit b5c9db3 into benchflow-ai:main Oct 30, 2026
10 of 12 checks passed
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