feat(hooks): recognize Chinese keywords in the delegation nudge - #57
feat(hooks): recognize Chinese keywords in the delegation nudge#57leon7786 wants to merge 1 commit into
Conversation
Extend the UserPromptSubmit nudge heuristic to match Chinese volume/fan-out phrases alongside the existing EN + JA sets, so Chinese-language prompts for bulk work (migrations, exhaustive tests, cross-model review, subagent fan-out) get the same advisory nudge. Match is case-insensitive; space-bearing pattern is quoted to keep the bash case syntax valid. Co-Authored-By: Claude <noreply@anthropic.com>
…IDC (#58) * fix(ci): external review lost to its own concurrency group, then to OIDC Two defects, both surfaced by #57 — the first fork PR to get far enough to hit them. 1. A skippable run cancelled a live one. Two labels applied in the same second produce two `labeled` events. The `claude-review` one started `authorise`; the `documentation` one arrived two seconds later, cancelled it, and then skipped itself because `github.event.label.name` was not `claude-review`. Run 31556100775 shows `authorise cancelled`, 31556102147 `authorise skipped`, and the PR showed no review and no reason. This is #42/#53 in quorum-review, in the one workflow that never got the fix: `cancel-in-progress` is evaluated BEFORE any job condition. A label never makes a running review obsolete — the head is unchanged. Only a push does, and `false` queues rather than discards, so an unrelated label waits its turn and then skips. 2. With that cleared, the action ran for the first time ever and the OIDC exchange returned 401 Invalid OIDC token, three attempts. Not a version skew: the 26 commits between this pin and the tag the internal workflow resolves touch workflow_run support, not the exchange. The internal workflow does the same exchange successfully on every run, so the App is installed and the difference is the event. Passing github_token explicitly skips the exchange. Upstream documents the input as "optional if using GitHub App" and recommends passing it for the analogous privileged context, so this is a supported path, not a workaround — and it is the better one here. GITHUB_TOKEN is bounded by this workflow's permissions block; an App installation token carries whatever that App holds repository-wide. The narrower credential belongs in the pull_request_target job. Six assertions, each verified by mutation. The concurrency ones are written separately from quorum's rather than shared: quorum keys on github.event_name, this file is all pull_request_target and keys on the action, and an assertion loose enough for both would stop guarding either. One of them exists only because the extraction range differs — this file puts permissions: before concurrency:, so quorum's range comes back empty here and every assertion would have passed on nothing. 260 -> 262. * docs: strip heredoc escaping artifacts from two test comments Review nit: '"'"' survived into the comment text as literal characters when these lines were written through a python heredoc. Harmless — they are inside # comments — but they read as noise in the one place that explains why the credential choice matters.
| *批量*|*全量*|*所有文件*|*全部文件*|*整个项目*|*整个仓库*|*整个代码库*| \ | ||
| *迁移*|*生成测试*|*测试覆盖*|*全套测试*|*脚手架*|*深度研究*|*调研*|*联网搜索*|*网页搜索*|*遍历*|*逐一*| \ | ||
| *子代理*|*子agent*|*"子 agent"*|*交叉验证*|*交叉核对*|*双模型*|*第二意见*|*复核*| \ | ||
| *审查*|*代码审查*|*审阅*|*校对*|*并行*|*批量生成*|*通读*) |
There was a problem hiding this comment.
A few of these are broader than their EN/JA counterparts and could add false positives to an otherwise "deliberately conservative" list (per the header comment): 校对 (proofread), 复核 (double-check), 通读 (read through), and 审阅/审查 (review) can show up in small, non-bulk asks like "帮我校对这段话" or "复核一下这个函数". Worth double-checking whether these are meant to stay this broad — since the nudge is advisory-only and non-blocking this is low severity, but it's a bit inconsistent with the EN list, which has no generic "review" trigger at all.
|
Thanks for this — nice, well-scoped addition, and the notes in the PR description (quoting the space-bearing pattern, keeping Security/scope: this only touches Correctness: the added Two small, non-blocking notes:
Nothing here blocks merging as far as I can tell — solid, low-risk contribution. |
|
Thank you — this fills a real gap, and the notes in your description (the quoted The ZH set fires where the EN and JA sets stay quietI ran small, ordinary prompts through the hook with your patterns applied, alongside their English equivalents through the current hook:
8 of 8 fire; 8 of 8 English equivalents don't. So a Chinese-speaking user gets nudged on work an English-speaking user doesn't — which is the opposite of what this PR is for, and it's what the header comment means by "deliberately conservative". It's 10 patterns out of 33
Three of those are ordinary programming vocabulary — Two are also redundant, since Suggested replacementDropping the 10 and keeping *一括*|*全ファイル*|*すべてのファイル*|*網羅*|*移行*|*大量*|*横断*|*リポジトリ全体*| \
*批量*|*全量*|*所有文件*|*全部文件*|*整个项目*|*整个仓库*|*整个代码库*| \
*迁移*|*生成测试*|*测试覆盖*|*全套测试*|*脚手架*|*深度研究*|*联网搜索*|*网页搜索*| \
*子代理*|*子agent*|*"子 agent"*|*交叉核对*|*双模型*|*第二意见*|*代码审查*)Measured on that set: 11 of 11 small prompts silent (the 8 above plus 这个正则为什么不匹配 / 把这个函数改成异步的 / 解释一下这段错误堆栈), and 8 of 8 bulk prompts still fire, including 用子代理并行跑这些迁移 and 生成测试覆盖整个项目. Please add a test
One design question, not a blocker
|
What
The
nudge-delegation.shUserPromptSubmit hook already nudges toward delegation when a prompt looks like bulk work — but only for English and Japanese phrases. This PR adds a conservative set of Chinese (ZH) volume/fan-out keywords so Chinese-language prompts get the same advisory nudge.Keywords added
Notes
nocasematchis already on, so Latin-letter substrings (e.g.子agent) match case-insensitively.*"子 agent"*is double-quoted — matching the existing*"all files"*convention — because an unquoted space would break the bashcaseword-splitting.EN + JA→EN + JA + ZH).Verification
Tested locally via simulated
UserPromptSubmitpayloads:迁移,整个代码库,交叉验证,子代理,审查…)agy-delegateprompts stay silent (no double-nudge)migrate every file,一括, …)🤖 Generated with Claude Code