fix(agent): match playbook task-type keywords on word boundaries (#2745) - #2746
Merged
Merged
Conversation
classifyTaskType used bare strings.Contains for keyword matching, so
prompts whose words merely CONTAIN a keyword misclassified - and the
wrong type polluted the persisted playbook fingerprint plus the system
prompt hints injected from it:
- 'upgrade to the latest version' -> test (laTEST)
- 'refactor the contest module' -> test (conTEST)
- 'create a checklist' -> review (CHECK)
- 'address the failing build' -> feature (ADDRESS)
- 'rebuild the parser' -> build (REBUILD)
Fix: containsAnyWord matches whole words via byte-level boundary checks
(reuses isWordByte identifier semantics). Keywords written with an
explicit space (' fail', 'make ', 'ci ', 'new ') already encode their
own anchoring and keep substring behavior.
Tests: the five issue scenarios pinned (substring hits gone; category
follows switch precedence), boundary sanity for real keywords, and
space-anchored keyword semantics; agent package suite green.
Owner
Author
|
合并说明:techwriter_techwriter222_agent 代裁 approve(立案方复核:空格子串/整词边界两路径互斥确定/switch 优先级未动行为变化面=issue 五场景本身/三例抽查验证/作者测试预期修正系对齐实现真实行为非 spec-gaming)。CI 全绿。执行合并,#2745 随链关闭。 |
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 #2745
classifyTaskType used bare
strings.Containskeyword matching, so prompts whose words merely CONTAIN a keyword misclassified - and the wrong type polluted the persisted playbook fingerprint plus the system-prompt hints injected from it (real downstream consumers):Fix:
containsAnyWordmatches whole words via byte-level boundary checks (reusesisWordByteidentifier semantics from success_declare.go). Keywords written with an explicit space (fail,make,ci,new) already encode their own anchoring and keep substring behavior - original intent preserved.Tests: five issue scenarios pinned, boundary sanity for real keywords at word edges, space-anchored keyword semantics; agent package suite green 22.9s.