fix: hide loop builder instructions from chat#3720
Conversation
Generated-By: PostHog Code Task-Id: 4ede3282-1f33-48ee-bf6c-fe3329ef80b8
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
packages/ui/src/features/loops/hooks/useLoopBuilderTask.ts:38-39
**Unseeded Builder Cannot Start**
When the instructions are empty or whitespace-only, both `content` and `taskDescription` become empty strings. Task creation requires one of these fields to contain non-whitespace text, so it returns `Task description cannot be empty` before the hidden instruction to ask what the user wants can reach the agent; previously, the generated builder prompt kept this flow valid.
Reviews (1): Last reviewed commit: "fix: hide loop builder instructions from..." | Re-trigger Greptile |
| return { | ||
| content: prompt, | ||
| taskDescription: prompt, | ||
| content: userPrompt, |
There was a problem hiding this comment.
When the instructions are empty or whitespace-only, both content and taskDescription become empty strings. Task creation requires one of these fields to contain non-whitespace text, so it returns Task description cannot be empty before the hidden instruction to ask what the user wants can reach the agent; previously, the generated builder prompt kept this flow valid.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/ui/src/features/loops/hooks/useLoopBuilderTask.ts
Line: 38-39
Comment:
**Unseeded Builder Cannot Start**
When the instructions are empty or whitespace-only, both `content` and `taskDescription` become empty strings. Task creation requires one of these fields to contain non-whitespace text, so it returns `Task description cannot be empty` before the hidden instruction to ask what the user wants can reach the agent; previously, the generated builder prompt kept this flow valid.
How can I resolve this? If you propose a fix, please make it concise.
Problem
Loop builder sessions show internal builder instructions as the user message in chat.
Changes
Before:

After:

How did you test this?
pnpm exec vitest run packages/ui/src/features/loops/loopBuilderPrompt.test.tspnpm exec biome check packages/ui/src/features/loops/loopBuilderPrompt.ts packages/ui/src/features/loops/loopBuilderPrompt.test.ts packages/ui/src/features/loops/hooks/useLoopBuilderTask.tspnpm --filter @posthog/ui typecheckapps/webon existing unresolved@posthog/agentand@posthog/host-trpcexportsAutomatic notifications
Created with PostHog Code