Skip to content

fix: scope reward-hacking markers to execution surfaces (#46) - #49

Merged
jflowers merged 3 commits into
mainfrom
opsx/scope-reward-hacking-check
Nov 3, 2026
Merged

jflowers merged 3 commits into
mainfrom
opsx/scope-reward-hacking-check

Conversation

@jflowers

@jflowers jflowers commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Closes #46. Part of unbound-force/dewey#153.

Summary

The reward-hacking check substring-matched the entire argument JSON of every tool call, so a mention of a marker was treated as a use: writing a Markdown note that says "never commit with --no-verify", or running the grep tool for .skip(, was blocked like git commit --no-verify. Knowledge-curation sessions worked around this with blockRewardHacking: false in project config, which disables the guard for every agent in the repo.

FR-071 (new, openspec/changes/scope-reward-hacking-check/) scans execution surfaces only, via a pure rewardHackingScanArgs helper in src/tool-guard.ts:

Tool Scanned
bash full argument object (unchanged)
read, glob, grep, webfetch, websearch nothing (can't act on the workspace)
everything else every non-content key (custom/MCP names fail closed); never oldString; content/newString unless the call has no file target or every target is a prose document (.md, .mdx, .markdown, .txt, .rst, .adoc)

Path-named keys (filePath, path, file, filename, target) are read whole, so extensionless targets (Makefile, .husky/pre-commit) count as non-prose. The marker set, block reason, and blockedCheck are unchanged.

Still blocked: git commit --no-verify via bash, adding it.skip( to a test, writing --no-verify into a script, hook, or workflow, custom tools passing --no-verify under any non-content key.
Now allowed: prose and notes that quote markers, read-only queries for markers, and edits that remove a .skip( (previously blocked because oldString was scanned).

Residuals (documented in design.md)

  • A bash grep -- "--no-verify" still blocks (no shell parsing); use the grep tool.
  • apply_patch patchText and nested edit arrays stay scanned in full (fail closed).
  • A custom tool that executes a content payload with no path-named target is now unscanned, the same residual class FR-064 accepted for the trace check.
  • Knowledge-store tools whose payload key isn't content (Dewey's store_learning uses information) stay scanned; that's feat: configurable trace-check exemptions for knowledge-store MCP tools #47's scope.

Verification

  • bun test: 384 pass, 0 fail
  • node --test test/*.test.ts: 384 pass, 0 fail (Node 26)
  • Both runs used an isolated XDG_CONFIG_HOME. With a global ~/.config/opencode/supervisor/config.json set to mode: "repair-only", 8 pre-existing hook-layer tests fail on unmodified main too, because those tests don't isolate the global config tier.

Not done (repo process)

🤖 Generated with Claude Code

jflowers and others added 2 commits November 3, 2026 14:48
Spec artifacts for FR-071: the reward-hacking check scans
execution surfaces only, so prose and read-only queries that
mention a marker are not blocked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reward-hacking check substring-matched the whole argument
object, so writing or searching about --no-verify or .skip( was
blocked like using them. FR-071 scans execution surfaces only:
bash in full; read-only builtins not at all; other tools every
non-content key, never oldString, and content/newString unless
the call is target-less or every target is a prose document.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jflowers
jflowers marked this pull request as ready for review November 3, 2026 20:56
@jflowers
jflowers merged commit e4ccbfe into main Nov 3, 2026
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.

fix: scope reward-hacking markers to execution surfaces, not authored content

1 participant