Repository navigation
Match a risk topic only on the line that registers the tool - #684
Merged
Merged
Conversation
The T3 topic rule was a plain substring match, so any diff that merely named create_child_bot in prose became T3; #636 hit it with one prompt sentence while its paths are T2 (#679). A topic now matches the registration shape `name: 'create_child_bot'`, the form plugins/tree/src/tools.js uses. The rule list in risk-rules.json is unchanged; only the shape it is matched against is.
Collaborator
Author
|
Verdict: PASS at 75ebb1a Ran:
Not run:
Reviewed at this tip only. All 9 checks are What I checked
Non-blocking
Risk: T3 ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #679
Tip SHA: 75ebb1a1f621ec977ea0848916c57dd00ab92e33Reproduce
.github/agent/risk-rules.jsonlists"topics": ["create_child_bot"]for T3 and.github/scripts/risk-gate.mjsapplied it asadded.includes(w)over every added line of every changed code file. Any diff that merely named the tool was therefore T3: #636 adds one prompt sentence for the model that namescreate_child_bot(a tool that already exists) and its paths (plugins/**) are T2, yet it reported T3 by that rule alone. The new test#679: a topic counts on the registration line…reproduces it: with the old line, that shape computes T3 withprompt.js: topic create_child_botin the basis.What changed
.github/scripts/risk-gate.mjs: a topic is compiled once per rule into/name\s*:\s*['"]<tool>['"]/(topicName) and matched against the added lines instead of a substring test. The registration shape is the oneplugins/tree/src/tools.jsuses, so registering the tool still counts; naming it in prose, a comment or a prompt no longer does..github/scripts/risk-gate.test.mjs: the existing content-hit case now uses the registration line, plus one new test with both acceptance cases — tree: add move_bot for reorganising an existing tree #636's shape (plugins/tree/src/prompt.jsnaming the tool + aplugins/tree/src/tree.jschange) is T2 and its basis has no topic line, and a+ name: 'create_child_bot',line inplugins/tree/src/tools.jsis T3 withplugins/tree/src/tools.js: topic create_child_bot..github/agent/risk-rules.json: the rule list stays["create_child_bot"]; only the shape it is matched against is narrower. No other rule, workflow or label behaviour is touched, andmerge-gate.mjsgets the samejudge()by import, so the queue's tier matches the report by construction..github/scripts, so no doc change is needed (arch-docsreports OK).What I ran
At
75ebb1a1(repo root,TZ=UTC):node --test .github/scripts/*.test.mjs→ 154 tests, 150 pass, 4 fail. The 4 failures are present on unmodifiedmainin this sandbox and are theds-bot-patches.mjstests that shell out togit, which this box does not have (Cannot read properties of undefined (reading 'split')); on a clean extraction of8e80237bthe same suite is 153 tests, 149 pass, 4 fail — so this change adds one passing test and breaks nothing.node --checkon both changed files.Red without the source change
Put the loop back to
if (added.includes(w))(tests kept):node --test --test-name-pattern="a topic counts"→ 1 fail, expectedT2, actualT3— the #636 shape is raised by the prose sentence again. The registration case passes in both versions on purpose: it is the positive control that shows the rule was narrowed, not switched off.Not run
npm run verifyand the CIpackagejob: this box has nocore/node_modulesand nogit, so the core/plugin suites and the pack check cannot run here; CI covers them. This change only touches.github/scripts, sotests-ok(core, plugins, package) runs against unchanged code.risk-gate.mjs --pr <n>against tree: add move_bot for reorganising an existing tree #636 live: it needsGH_TOKENand network to the API, which the sandbox has, but it would only re-derive what the test replays from tree: add move_bot for reorganising an existing tree #636's actual diff; the test asserts that shape directly.Risk
.github/agent/risk-rules.json(.github/**is on the T3 path list), so this needs a PASS at the tip plus the maintainer's approve.risk-tier.yml's summary line is authoritative for the report.create_child_bot(or, later, another listed topic) still reports T3.name:with an optional quote and whitespace; a registration written some other way (for example a positional array) would no longer match. No such form exists in the repo today (plugins/tree/src/tools.jsis the only registration), and the positive-control test fails if that changes.