Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

feat(loops): Run a skill instead of instructions - #3741

Merged
charlesvien merged 1 commit into
mainfrom
feat/loop-skills
Jul 24, 2026
Merged

feat(loops): Run a skill instead of instructions#3741
charlesvien merged 1 commit into
mainfrom
feat/loop-skills

Conversation

@charlesvien

Copy link
Copy Markdown
Member

Problem

A loop's prompt is a free-form instructions blob. Teams that already maintain skills have no way to point a loop at one, so the same playbook gets pasted into instructions and drifts from the skill.

Changes

The loop form's prompt step gains a source choice: write instructions or run a skill. Picking a local skill zips it (plus its skill dependencies) via workspace-server on save and uploads the set through the new PUT /loops/{id}/skill_bundles/ endpoint, and the loop's instructions become /skill-name plus an optional context field. The backend seeds those bundles into every fired run, where the sandbox agent-server already installs skill_bundle artifacts.

The loop detail page shows the attached skill with its snapshot digest and an "Update from local skill" button to re-snapshot after editing the skill. On hosts without a local filesystem (web) the picker is hidden; an attached skill can still be kept or detached.

Requires PostHog/posthog#73069 to be deployed first; until then the skill_bundles endpoint 404s and loop.skill_bundles is absent.

How did you test this?

Unit tests for the new instruction build/parse helpers and the form round-trip (skill mode validity, derived instructions, attached-snapshot mapping) via pnpm --filter @posthog/ui test. Full pnpm typecheck and Biome lint are clean. Not exercised against a live backend since the API only exists in the paired posthog PR.

Automatic notifications

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

@trunk-io

trunk-io Bot commented Jul 23, 2026

Copy link
Copy Markdown

😎 This pull request was merged.

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit c40e35a.

@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
packages/ui/src/features/loops/components/LoopDetailView.tsx:325
**Missing bundles crash loop views**

When the older backend described in this PR omits `skill_bundles`, this unconditional `.length` access throws during rendering. The edit path also indexes the absent field in `primaryLoopSkillBundle`, so users cannot view or edit loops until the backend deployment completes.

### Issue 2 of 2
packages/ui/src/features/loops/components/LoopForm.tsx:145-153
**Failed uploads leave incomplete loops**

When dependency resolution, local bundling, or bundle upload fails, the loop has already been persisted with `/skill-name` instructions, and this catch only shows a toast before navigating away. The loop can then fire without the matching skill artifact, causing the run to receive the invocation without the selected skill definition.

Reviews (1): Last reviewed commit: "let loops run a skill instead of instruc..." | Re-trigger Greptile

Comment thread packages/ui/src/features/loops/components/LoopDetailView.tsx Outdated
@veria-ai

veria-ai Bot commented Jul 23, 2026

Copy link
Copy Markdown

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 4 · PR risk: 0/10

Comment thread packages/ui/src/features/loops/components/LoopDetailView.tsx Outdated
Comment thread packages/ui/src/features/loops/components/LoopForm.tsx Outdated
Comment thread packages/ui/src/features/loops/hooks/useLoopSkillBundles.ts
Comment thread packages/ui/src/features/loops/hooks/useLoopSkillBundles.ts
@posthog

posthog Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

👋 Visual changes detected for this PR.

Review and approve in PostHog Visual Review

If these changes are unexpected, they may be caused by a flaky test or a broken snapshot on master. Don't approve — rerun the job or wait for a fix.

@charlesvien
charlesvien force-pushed the feat/loop-skills branch 2 times, most recently from 1c13ce3 to 1d0f2a9 Compare July 24, 2026 04:28
Comment thread packages/ui/src/features/loops/loopSkill.ts Outdated
@charlesvien
charlesvien merged commit ca29c39 into main Jul 24, 2026
32 checks passed
@charlesvien
charlesvien deleted the feat/loop-skills branch July 24, 2026 15:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants