From 991279f52ca7b169b776a3a299d4b829d1f68359 Mon Sep 17 00:00:00 2001 From: Dotta <34892728+cryppadotta@users.noreply.github.com> Date: Fri, 10 Jul 2026 09:41:24 -0500 Subject: [PATCH] Fix Skill Studio markdown dirty tracking (#9356) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Skill Studio is the UI surface for editing skill package files, including `SKILL.md`. > - Markdown files are split into frontmatter fields plus a rich markdown body editor. > - The dirty-state guard intentionally ignores markdown editor normalization during initial mount. > - That guard was too narrow: rich markdown body edits could happen before the file was marked as user-interacted, so edits did not reliably enable Save. > - This pull request broadens the user-interaction signals around the markdown body editor and adds a regression test for saving body edits. > - The benefit is that editing `SKILL.md` in Skill Studio now behaves like normal file editing: changes show as unsaved and Save persists the full markdown document. ## Linked Issues or Issue Description No public GitHub issue exists. Inline bug description follows. ### What happened? Editing a Skill Studio markdown body did not reliably mark the file dirty, so the Save action could remain unavailable or fail to persist the body edit. ### Expected behavior User edits in the markdown body editor should mark the file unsaved and allow saving the updated `SKILL.md` content. ### Steps to reproduce 1. Open a Skill Studio markdown file such as `SKILL.md`. 2. Edit the markdown body in the rich editor. 3. Observe whether the unsaved state appears and Save becomes enabled. 4. Save and reload the file. ### Paperclip version or commit Reproduced on `master` before this fix. ### Deployment mode Local dev (`pnpm dev`). ## What Changed - Mark markdown body interaction on capture-phase key, pointer, paste, drop, before-input, and input events around the rich editor. - Preserve the existing guard that prevents MDXEditor mount-time normalization from dirtying a clean file. - Add a Skill Studio regression test that edits the markdown body, observes the Unsaved state, enables Save, and verifies the saved `SKILL.md` includes both frontmatter and the edited body. ## Verification - `pnpm vitest run ui/src/pages/SkillStudio.test.tsx` Manual reviewer path: - Open a Skill Studio markdown file such as `SKILL.md`. - Edit the body text in the rich markdown editor. - Confirm the UI shows an unsaved state and the Save button is enabled. - Save and confirm the updated markdown body persists. ## Risks Low risk. The change only broadens interaction detection before applying existing dirty-state logic, and the guard still prevents initial editor normalization from marking an unopened file dirty. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used OpenAI Codex CLI using GPT-5, with repository file editing, shell execution, and GitHub CLI tool use. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge Co-authored-by: Paperclip --- ui/src/pages/SkillStudio.test.tsx | 78 ++++++++++++++++++++++++++++++- ui/src/pages/SkillStudio.tsx | 12 +++-- 2 files changed, 86 insertions(+), 4 deletions(-) diff --git a/ui/src/pages/SkillStudio.test.tsx b/ui/src/pages/SkillStudio.test.tsx index 6c13216750..3ed0cb3afd 100644 --- a/ui/src/pages/SkillStudio.test.tsx +++ b/ui/src/pages/SkillStudio.test.tsx @@ -95,7 +95,29 @@ vi.mock("@/components/SearchableSelect", () => ({ })); vi.mock("@/components/MarkdownEditor", () => ({ - MarkdownEditor: ({ value }: { value: string }) =>