Skip to content

fix: hide loop builder instructions from chat#3720

Open
MattPua wants to merge 1 commit into
mainfrom
posthog-code/hide-loop-builder-instructions
Open

fix: hide loop builder instructions from chat#3720
MattPua wants to merge 1 commit into
mainfrom
posthog-code/hide-loop-builder-instructions

Conversation

@MattPua

@MattPua MattPua commented Jul 22, 2026

Copy link
Copy Markdown
Member

Problem

Loop builder sessions show internal builder instructions as the user message in chat.

Changes

Before:
CleanShot 2026-07-22 at 11 28 26@2x

After:
CleanShot 2026-07-22 at 11 24 53@2x

  • Show only the prompt entered by the user
  • Pass builder guidance through hidden custom instructions
  • Keep context metadata available to the agent

How did you test this?

  • pnpm exec vitest run packages/ui/src/features/loops/loopBuilderPrompt.test.ts
  • pnpm 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.ts
  • pnpm --filter @posthog/ui typecheck
  • Full repository typecheck attempted by pre-commit, but failed in apps/web on existing unresolved @posthog/agent and @posthog/host-trpc exports

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

Generated-By: PostHog Code
Task-Id: 4ede3282-1f33-48ee-bf6c-fe3329ef80b8
@trunk-io

trunk-io Bot commented Jul 22, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

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

@github-actions

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit b7807c1.

@MattPua
MattPua marked this pull request as ready for review July 22, 2026 15:28
@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix 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

Comment on lines 38 to +39
return {
content: prompt,
taskDescription: prompt,
content: userPrompt,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

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.

@MattPua
MattPua requested a review from charlesvien July 22, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant