deepwiki and scratchpad examples: substring rewards pass without calling the tool they're meant to test
Two small example environments use a bare substring check on the final reply and never look at trace.tool_messages, so a reply can earn full reward without using the tool the task is about. Low severity on their own, but both are reference examples people copy (remote MCP tools, shared-server isolation), so it seemed worth flagging.
deepwiki
DeepWikiTask.answered returns answer.lower() in last_reply.lower(). The prompt asks the agent to call deepwiki_ask_question and reply with just the language name, but:
Python, Rust, JavaScript, TypeScript, Go, Java, C++, C(no tool call) scores 1.0 on both tasksIt is Rust, not Python(no tool call) scores 1.0 on the python-sdk task
Possible fix: normalise the reply and require an exact match with the gold language; optionally also require a deepwiki_ask_question result in trace.tool_messages.
scratchpad
ScratchpadTask.isolated returns word in last_reply, but the word is written in the prompt. Replying with it without calling scratchpad_roundtrip scores 1.0 on 20/20 tasks. The module docstring presents a mean reward of 1.0 from vf-eval scratchpad as evidence that per-rollout isolation works, but a run that never touches the shared server gets the same 1.0. (tests/integration/test_shared_tool.py adds a num_turns >= 2 guard, but the env's own reward doesn't.)
Possible fix: score 0 unless trace.tool_messages contains a scratchpad_roundtrip result equal to self.data.word, or have the server return a per-rollout nonce that isn't in the prompt, so an echo can't pass.
Reproduce
Deterministic, no network, no model calls; uses the envs' real tasksets and Task.score (tested on main at 8859385):
repro.py
import asyncio
import verifiers.v1 as vf
from verifiers.v1.graph import MessageNode
from verifiers.v1.types import AssistantMessage, UserMessage
from deepwiki.taskset import DeepWikiConfig, DeepWikiTaskset
from scratchpad.taskset import ScratchpadConfig, ScratchpadTaskset
def reply_only(task, reply): # user prompt -> final reply, no tool call
nodes = [MessageNode(parent=None, message=UserMessage(content=task.data.prompt), sampled=False),
MessageNode(parent=0, message=AssistantMessage(content=reply), sampled=True)]
return vf.Trace(agent=vf.AgentInfo(config=vf.AgentConfig()),
task=vf.TraceTask(type=type(task).__name__, data=task.data), nodes=nodes)
async def reward(task, reply):
trace = reply_only(task, reply)
await task.score(trace, None)
return {k: v.score for k, v in trace.rewards.items()}
async def main():
deep = list(DeepWikiTaskset(DeepWikiConfig()))
hedge = "Python, Rust, JavaScript, TypeScript, Go, Java, C++, C"
for t in deep:
print("deepwiki", t.data.name, "| hedge, no tool:", await reward(t, hedge))
py = next(t for t in deep if "python-sdk" in t.data.name)
print("deepwiki python-sdk | 'It is Rust, not Python', no tool:", await reward(py, "It is Rust, not Python"))
pads = list(ScratchpadTaskset(ScratchpadConfig()))
echo = sum([(await reward(t, t.data.word))["isolated"] for t in pads])
print(f"scratchpad | echo the prompt's word, no tool: {echo}/{len(pads)}")
asyncio.run(main())
Output:
deepwiki modelcontextprotocol/python-sdk | hedge, no tool: {'answered': 1.0}
deepwiki tokio-rs/tokio | hedge, no tool: {'answered': 1.0}
deepwiki python-sdk | 'It is Rust, not Python', no tool: {'answered': 1.0}
scratchpad | echo the prompt's word, no tool: 20.0/20
Happy to send a PR for either if that's useful. Found while auditing public RL environments.