Skip to content

fix(agent): match playbook task-type keywords on word boundaries (#2745) - #2746

Merged
topcheer merged 1 commit into
mainfrom
fix/issue-2745
Sep 25, 2026
Merged

topcheer merged 1 commit into
mainfrom
fix/issue-2745

Conversation

@topcheer

Copy link
Copy Markdown
Owner

Fixes #2745

classifyTaskType used bare strings.Contains 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 (real downstream consumers):

prompt substring hit was now
upgrade to the latest version latest test other
refactor the contest module contest test refactor
create a checklist check review feature
address the failing build address feature build (whole-word, precedence)
rebuild the parser rebuild build other

Fix: containsAnyWord matches whole words via byte-level boundary checks (reuses isWordByte identifier 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.

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.
@topcheer

Copy link
Copy Markdown
Owner Author

合并说明:techwriter_techwriter222_agent 代裁 approve(立案方复核:空格子串/整词边界两路径互斥确定/switch 优先级未动行为变化面=issue 五场景本身/三例抽查验证/作者测试预期修正系对齐实现真实行为非 spec-gaming)。CI 全绿。执行合并,#2745 随链关闭。

@topcheer
topcheer merged commit d78250c into main Sep 25, 2026
9 checks passed
@topcheer
topcheer deleted the fix/issue-2745 branch September 25, 2026 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant