feat(keyword-detector): prevent ultrawork instruction injection on every trigger#3433
feat(keyword-detector): prevent ultrawork instruction injection on every trigger#3433linuxtopia wants to merge 1 commit intocode-yeongyu:devfrom
Conversation
|
Thank you for your contribution! Before we can merge this PR, we need you to sign our Contributor License Agreement (CLA). To sign the CLA, please comment on this PR with: This is a one-time requirement. Once signed, all your future contributions will be automatically accepted. I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
There was a problem hiding this comment.
1 issue found across 1 file
Confidence score: 2/5
- There is a high-confidence functional regression in
src/hooks/keyword-detector/hook.ts: removing instruction injection means mode prompts are never injected. - Because this affects core prompt behavior (severity 8/10, confidence 10/10), the risk of user-facing breakage is significant and this is not a routine minor issue.
- Pay close attention to
src/hooks/keyword-detector/hook.ts- restore and verify instruction injection so mode prompts are applied correctly.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/hooks/keyword-detector/hook.ts">
<violation number="1" location="src/hooks/keyword-detector/hook.ts:158">
P1: The instruction injection logic has been entirely removed, preventing mode prompts from ever being injected.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| output.parts[textPartIndex].text = `${allMessages}\n\n---\n\n${originalText}` | ||
|
|
||
| log(`[keyword-detector] Detected ${detectedKeywords.length} keywords`, { | ||
| log(`[keyword-detector] Mode activated (no injection)`, { |
There was a problem hiding this comment.
P1: The instruction injection logic has been entirely removed, preventing mode prompts from ever being injected.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/hooks/keyword-detector/hook.ts, line 158:
<comment>The instruction injection logic has been entirely removed, preventing mode prompts from ever being injected.</comment>
<file context>
@@ -120,24 +153,13 @@ export function createKeywordDetectorHook(
- output.parts[textPartIndex].text = `${allMessages}\n\n---\n\n${originalText}`
-
- log(`[keyword-detector] Detected ${detectedKeywords.length} keywords`, {
+ log(`[keyword-detector] Mode activated (no injection)`, {
sessionID: input.sessionID,
types: detectedKeywords.map((k) => k.type),
</file context>
There was a problem hiding this comment.
This is intentional. The goal is to remove the ~3K token instruction injection entirely. Ultrawork mode activation is handled by the keyword detection itself, not by injected instruction text. Mode prompts are not required for the mode to function correctly - they were previously informational only.
Summary
Context
Summary by cubic
Stops repeated ultrawork instruction injection to avoid ~3K token bloat on every trigger. Adds per-session mode tracking so ultrawork (and other modes) activate once and skip reinjection. Addresses Linear #2076.
Map<sessionID, Set<modeType>>) to track active modes.Written for commit da80a7e. Summary will update on new commits.