Skip to content

[5541] fix(frontend): Fix skill description parsing and bundled file editing - #5564

Merged
mmabrouk merged 1 commit into
release/v0.106.1from
fix/5541-skill-upload-reliability
Jul 30, 2026
Merged

[5541] fix(frontend): Fix skill description parsing and bundled file editing#5564
mmabrouk merged 1 commit into
release/v0.106.1from
fix/5541-skill-upload-reliability

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

Context

Uploading a complete skill package (a SKILL.md plus resource files) broke in two ways (#5541). A folded YAML description showed up as the literal >- in the Description field, because the old parser read a single line with a regex. And text typed into a bundled file was silently lost when you clicked another file within 300 ms, because the shared editor's debounce throws away its pending value when the selection changes underneath it.

Changes

parseSkillMarkdown now parses the frontmatter with js-yaml. It accepts name and description only when YAML returns strings, trims them, and treats invalid YAML as "no metadata" while keeping the Markdown body.

Before, this frontmatter

description: >-
  Run the agent release gate.
  Use it before a release.

put >- in the Description field. After, the field shows "Run the agent release gate. Use it before a release."

The bundled-file editor in SkillFormView is now keyed by the selected file index, so every file gets a fresh editor instance and undo history cannot bleed across files. It also gets a new disableDebounce prop on the local CodeEditor, passed through to the shared editor, so keystrokes reach form state immediately and a file switch cannot cancel a pending edit. @agenta/ui is unchanged (the underlying SharedEditorImpl already supports the prop), and the only other CodeEditor consumer keeps the 300 ms default.

Known tradeoffs: leaving a file drops that editor's cursor, scroll, and undo history (the content is kept). And a SKILL.md whose frontmatter is invalid YAML as a whole (for example an unquoted description: Use when: needed) now loses both fields instead of salvaging individual lines; the body is preserved and the fields stay editable by hand.

Tests

  • Unit table for the parser (plain, quoted, folded, missing, non-string, whitespace-only, invalid YAML, no frontmatter) plus upload conversion with nested paths, Unicode, and trailing newlines, in tests/unit/skillUpload.test.ts. 280 package tests, typecheck, build, and lint pass.
  • New Playwright acceptance spec acceptance/agent-skills/skill-folder-upload.spec.ts: uploads an in-memory zip, asserts the folded description, per-file content isolation, the type-then-switch race, and save/reopen. Passed against a live EE dev stack.
  • Manual QA on the same stack with the real 9-file agent-release-gate package: rapid file switching, fast typing followed by an immediate switch, a 5,000-character insertion, a path rename (no editor remount), file removal returning to SKILL.md, and layout checks at 1440x900 and 1024x768.
  • Not covered: a literal clipboard paste (headless Chromium cannot stage the clipboard on an HTTP origin; simulated via the text-insertion event) and the read-only skill view (no fixture was available). Both are one-minute manual checks.
  • Found during QA and filed separately: (bug) Skill body renders blank in the form right after uploading a skill package #5563 (the body field renders blank right after upload while the JSON draft holds the text; pre-existing display bug).

What to QA

  • In an agent's playground, open Skills, add a skill, and upload a zip whose SKILL.md uses description: >- across several lines. The Description field shows the folded sentence, not >-.
  • Click between bundled files quickly. Each file shows only its own content.
  • Type into one file, immediately click another, then come back. The edit is still there.
  • Regression: other editors (prompt fields, JSON views) behave as before, including their usual debounce.

Closes #5541

https://claude.ai/code/session_017pBNyrqbAFZhWG9WTQ9siv

…dled-file editors

Uploading a skill package with a folded YAML description showed the literal
">-" in the Description field, and edits made just before switching bundled
files were dropped by the shared editor's 300 ms debounce.

- Parse SKILL.md frontmatter with js-yaml; accept name/description only as
  strings, and fall back to the body alone on invalid YAML.
- Key the bundled-file editor by selected index and disable its debounce so
  a file switch cannot cancel a pending edit or leak undo history.
- Cover the parser table in unit tests and the full upload flow in a new
  Playwright acceptance spec with an in-memory zip fixture.

Claude-Session: https://claude.ai/code/session_017pBNyrqbAFZhWG9WTQ9siv
@mmabrouk

Copy link
Copy Markdown
Member Author

@coderabbitai review

@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview Jul 30, 2026 8:50am

Request Review

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bdbe4409-3ac7-4096-b263-bcd620f569a0

📥 Commits

Reviewing files that changed from the base of the PR and between 3efeaea and 9dc2f41.

⛔ Files ignored due to path filters (1)
  • web/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • web/oss/package.json
  • web/oss/tests/playwright/acceptance/agent-skills/skill-folder-upload.spec.ts
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/CodeEditor.tsx
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/SkillFormView.tsx
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/skillUpload.ts
  • web/packages/agenta-entity-ui/tests/unit/skillUpload.mergePastedSkill.test.ts
  • web/packages/agenta-entity-ui/tests/unit/skillUpload.test.ts
💤 Files with no reviewable changes (1)
  • web/packages/agenta-entity-ui/tests/unit/skillUpload.mergePastedSkill.test.ts

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Skill uploads now support YAML frontmatter, including folded multi-line descriptions.
    • Bundled skill files retain their contents when switching between files, editing, saving, and reopening skills.
    • Skill package uploads preserve nested file paths, Unicode text, and trailing newlines.
  • Bug Fixes

    • Improved handling of malformed frontmatter while preserving the skill body.
    • Prevented edits from being misplaced or lost during rapid file switching.
  • Tests

    • Added coverage for skill parsing, package uploads, file persistence, and frontmatter formats.

Walkthrough

Skill uploads now parse YAML frontmatter with js-yaml, preserve bundled-file edits when switching editors, and add unit and Playwright coverage for zipped skill uploads.

Changes

Skill upload reliability

Layer / File(s) Summary
YAML frontmatter parsing and validation
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/skillUpload.ts, web/packages/agenta-entity-ui/tests/unit/skillUpload.test.ts, web/oss/package.json
Frontmatter fields are parsed as typed YAML values, invalid YAML is handled without throwing, and parsing, file normalization, and merge behavior are covered by unit tests.
Bundled-file editor switching
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/CodeEditor.tsx, web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/SkillFormView.tsx
The editor supports disabling debounce and remounts when switching bundled files so edits are emitted and isolated correctly.
Folder upload acceptance flow
web/oss/tests/playwright/acceptance/agent-skills/skill-folder-upload.spec.ts
The acceptance test uploads an in-memory skill archive, verifies folded descriptions and file isolation, and confirms edits persist after reopening.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • Agenta-AI/agenta#5258: Both changes modify skill frontmatter parsing and merge behavior in skillUpload.ts.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main fix: skill description parsing and bundled-file editing reliability.
Description check ✅ Passed The description matches the code changes and explains the parsing and editor fixes in detail.
Linked Issues check ✅ Passed The changes address #5541 by fixing YAML frontmatter parsing and preventing bundled-file edit loss during switching.
Out of Scope Changes check ✅ Passed No clear out-of-scope changes are evident; the dependency and tests support the reported skill-upload fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/5541-skill-upload-reliability

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dosubot dosubot Bot added Bug Report Something isn't working Frontend tests labels Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mmabrouk
mmabrouk merged commit 513003a into release/v0.106.1 Jul 30, 2026
39 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-production-a113.up.railway.app/w
Project agenta-oss-pr-5564
Image tag pr-5564-1bc923a
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-07-30T09:02:17.534Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Report Something isn't working Frontend size:S This PR changes 10-29 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant