feat(evals): grade OpenCode continuation evidence #248

Merged
claudiomaradonna merged 2 commits from evals-opencode-continuation into main 2026-11-23 17:58:08 +01:00
Collaborator

Why

The behavioral evals grade whether a client running the repository's
skills under test continues its subagent handoffs: the execute-plan
grader asks evals/evidence.py for the attempt's roles, reports, and
completed handoffs. .agents/skills/execute-plan/SKILL.md step 3's
continuation rule names OpenCode beside Claude and Codex, but the
graders held scenarios for those two clients only: client() accepted
only claude and codex, so an OpenCode attempt was rejected whole
with evidence: unknown client. A maintainer dropping the rule's
OpenCode clause would have met no failing grade.

Closes #243

What changed

evals/evidence.py grades an OpenCode attempt. It accepts a client
file naming opencode and reads the attempt's storage database,
home/.local/share/opencode/opencode.db, opened read-only and
immutable and kept under the same containment regular() applies to
evidence files. The parent session is the one session_v2 row whose
parent_id is NULL — none or several leaves no evidence — and each
child session reports under its agent column: roles prints the
children, reports their last stopped assistant text, and continued
passes when exactly one implementer-medium child ended at least two
user-handoff segments with such a report, a segment carrying
finish: tool-calls counting as unreported. Claude and Codex grading
is untouched, and evals/run.sh still takes only --client claude|codex: the OpenCode cases are grader-level, the runner's
OpenCode support stays billed and maintainer-run, as the issue scoped.

tests/agent-config/evals-graders.sh names opencode in the
continuation client loop: one case proves two completed handoffs to
one continued medium implementer, and six reject a segment ending in
tool calls, a handoff without its report, a blank handoff, a linked
storage database, ambiguous parent sessions, and a replacing
implementer. A pin records that a client file that is not UTF-8 is
reported by name, as before the containment walk was split out. Each
guarded reader rule now fails the suite when deleted.

How to verify

From a fresh checkout with jq, python3, and git:

Base 09e9524, the new cases failing for the reported reason:

git fetch origin
git checkout --detach 09e9524
git checkout evals-opencode-continuation -- tests/agent-config/evals-graders.sh
bash tests/agent-config/evals-graders.sh

Expect exactly seven not ok lines, each ending (exit 1): evidence: unknown client, and FAILED: 7 of 69.

Branch tip f121a4b:

git checkout evals-opencode-continuation
bash tests/agent-config/evals-graders.sh

Expect all 69 agent configuration tests passed.

The pin passes on both revisions: on either, write bytes that are not
UTF-8 into an attempt's client file and run
python3 evals/evidence.py client <attempt>; it exits 1 printing
evidence: unreadable evidence: client.

Checks run, with results: bash tests/verify-agent-config.sh
345/345; bash tests/check-work-folder.sh 46/46;
.agents/hooks/shellcheck.sh repo 51 files clean;
prettier --check '**/*.md' clean; bash scripts/verify-agent-config.sh statically valid, state=template;
git diff --check main clean. Both reviewers approved at the tip;
deleting each guarded rule (finish, the containment walk, the
single-root guard, the blank-text handoff rule, the report rule, the
codec catch) fails the suite by exactly the case that guards it.
Behavioral eval runs stay maintainer-run and were not run.

Considerations

  • The immutable read sees only rows checkpointed into the database
    file; a copy taken while OpenCode still holds rows in its
    write-ahead log gives the checkpointed evidence or none, and the
    reader's docstring says so for the runner that will one day produce
    such copies.
  • The OpenCode builders and mutators repeat the same insert frame in
    the fixture, mirroring how the file's Claude and Codex branches
    repeat their jq frame; consolidating them would add a helper the
    work file did not approve.
## Why The behavioral evals grade whether a client running the repository's skills under test continues its subagent handoffs: the `execute-plan` grader asks `evals/evidence.py` for the attempt's roles, reports, and completed handoffs. `.agents/skills/execute-plan/SKILL.md` step 3's continuation rule names OpenCode beside Claude and Codex, but the graders held scenarios for those two clients only: `client()` accepted only `claude` and `codex`, so an OpenCode attempt was rejected whole with `evidence: unknown client`. A maintainer dropping the rule's OpenCode clause would have met no failing grade. Closes #243 ## What changed `evals/evidence.py` grades an OpenCode attempt. It accepts a `client` file naming `opencode` and reads the attempt's storage database, `home/.local/share/opencode/opencode.db`, opened read-only and immutable and kept under the same containment `regular()` applies to evidence files. The parent session is the one `session_v2` row whose `parent_id` is NULL — none or several leaves no evidence — and each child session reports under its `agent` column: `roles` prints the children, `reports` their last stopped assistant text, and `continued` passes when exactly one `implementer-medium` child ended at least two user-handoff segments with such a report, a segment carrying `finish: tool-calls` counting as unreported. Claude and Codex grading is untouched, and `evals/run.sh` still takes only `--client claude|codex`: the OpenCode cases are grader-level, the runner's OpenCode support stays billed and maintainer-run, as the issue scoped. `tests/agent-config/evals-graders.sh` names `opencode` in the continuation client loop: one case proves two completed handoffs to one continued medium implementer, and six reject a segment ending in tool calls, a handoff without its report, a blank handoff, a linked storage database, ambiguous parent sessions, and a replacing implementer. A pin records that a client file that is not UTF-8 is reported by name, as before the containment walk was split out. Each guarded reader rule now fails the suite when deleted. ## How to verify From a fresh checkout with `jq`, `python3`, and `git`: Base `09e9524`, the new cases failing for the reported reason: ``` git fetch origin git checkout --detach 09e9524 git checkout evals-opencode-continuation -- tests/agent-config/evals-graders.sh bash tests/agent-config/evals-graders.sh ``` Expect exactly seven `not ok` lines, each ending `(exit 1): evidence: unknown client`, and `FAILED: 7 of 69`. Branch tip `f121a4b`: ``` git checkout evals-opencode-continuation bash tests/agent-config/evals-graders.sh ``` Expect `all 69 agent configuration tests passed`. The pin passes on both revisions: on either, write bytes that are not UTF-8 into an attempt's `client` file and run `python3 evals/evidence.py client <attempt>`; it exits 1 printing `evidence: unreadable evidence: client`. Checks run, with results: `bash tests/verify-agent-config.sh` 345/345; `bash tests/check-work-folder.sh` 46/46; `.agents/hooks/shellcheck.sh repo` 51 files clean; `prettier --check '**/*.md'` clean; `bash scripts/verify-agent-config.sh` statically valid, `state=template`; `git diff --check main` clean. Both reviewers approved at the tip; deleting each guarded rule (`finish`, the containment walk, the single-root guard, the blank-text handoff rule, the report rule, the codec catch) fails the suite by exactly the case that guards it. Behavioral eval runs stay maintainer-run and were not run. ## Considerations - The immutable read sees only rows checkpointed into the database file; a copy taken while OpenCode still holds rows in its write-ahead log gives the checkpointed evidence or none, and the reader's docstring says so for the runner that will one day produce such copies. - The OpenCode builders and mutators repeat the same insert frame in the fixture, mirroring how the file's Claude and Codex branches repeat their `jq` frame; consolidating them would add a helper the work file did not approve.
The graders held no OpenCode continuation scenario, so no grading
would show a maintainer dropping the OpenCode continuation rule.
evidence.py now accepts an opencode client and reads the attempt
storage database for roles, reports, and completed handoffs, and
the grader test names opencode in the client loop with the fixture
of one continued medium implementer.

Answers #243
test(evals): pin the OpenCode continuation graders
Some checks failed
Maintenance / checks (pull_request) Failing after 3m55s
Maintenance / checks (push) Has been cancelled
f121a4b81e
The opencode loop branches prove two completed handoffs to one
medium implementer and reject a segment whose last message ends in
tool calls, a handoff without its report, a blank handoff, a linked
storage database, ambiguous parent sessions, and a replacing
implementer; add_opencode_agent builds the child sessions. Grading
a client file that is not UTF-8 reports it by name, as before the
containment walk split. Deleting a guarded reader rule now fails
the suite.

Answers #243
claudiomaradonna deleted branch evals-opencode-continuation 2026-11-23 17:58:15 +01:00
Sign in to join this conversation.
No description provided.