Skip to content

feat(site): add the agent definition editor dialog - #101

Merged
ibetitsmike merged 21 commits into
mainfrom
mike/agent-definitions-ui-3-editor-dialog
Nov 10, 2026
Merged

ibetitsmike merged 21 commits into
mainfrom
mike/agent-definitions-ui-3-editor-dialog

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Xum opened this PR on behalf of @ibetitsmike.

Part of #75. Based on main now that #94 has merged.

Adds the dialog that creates and edits one agent definition. Nothing opens it yet; the next PR wires it to the personal agent definitions page.

  • Built from the skill editor's parts: name, description, and body fields and the inline submit error with the server's message and detail. The skill form owns those fields; the dialog keeps the model and the other front-matter itself. Every field keeps the values the dialog opened with as its baseline, so refreshed initial values cannot reset some fields and leave others stale.
  • Shared skill editor changes: useSkillEditorContext and the SkillEditorMode type are exported, SkillEditorForm takes an optional buildContent that the size limit, the size meter, and the submitted content use (default SKILL.md), SkillEditorDescriptionField takes an optional placeholder, the size error now says "Content must be ... or smaller.", and a body that is only HTML comments counts as empty, because the server strips them before it requires a body.
  • An optional Model field. It matches a model config ID, model name, or display name; empty means the chat's model.
  • Import file reads a Claude Code or Cursor agent markdown file into the fields. When editing, the stored name is kept.
  • Edit mode has loading, load error, and retry states. Escape and outside clicks act as Cancel, which the form disables from the moment Save is clicked, so a save in flight keeps the dialog open.
  • agentDefinitionMarkdown.ts parses the front-matter as a yaml Document and saves by setting name, description, and model in place, only when the user changed them, so an unchanged field stays as written (a block-scalar description, an alias). The fields read the document's resolved values, so an alias or a << merge key reads as the server reads it, and they show line breaks as spaces because they are single-line inputs (a description is checked against its size limit before that). Other keys and all comments, inline ones included, are kept. YAML may re-indent other keys, for example sequence items, but their values stay the same. Aliases of an owned value are filled in with that value (keeping its tag and the alias's comments) before it changes, so they keep it, and an owned field that is itself an alias keeps its comments when it changes. A plain value that YAML 1.1 would read as another type, such as a date, or cannot convert, such as *sonnet, is quoted, because the server's decoder still reads those forms. yaml 2.8.3 was already in the lockfile as a transitive dependency and is now a direct one.

Stories cover create, edit, submitting, import error, submit error, loading, load error, and retrying. ForkAgentDefinitionEditorDialog.test.tsx imports and submits in create and edit mode, saves a model-only change, revalidates the size after a model change and shows its error on the untouched body, blocks a comment-only body, ignores Escape from the moment Save is clicked, and keeps every field's opening values when the initial values refresh. agentDefinitionMarkdown.test.ts checks that saving rewrites the form's fields and keeps other keys and comments, including an inline comment on an owned key. It also checks that uniformly indented front-matter is rebuilt as valid YAML, that values YAML would read as another type (including YAML 1.1 dates) are quoted, that aliases of a changed or removed owned value keep it, that an owned field set through an alias or a merge key reads and stays that way, that replaced aliases keep tags and comments, that an oversized multiline description is rejected, that a multiline description shows on one line and stays as written, and that front-matter which is not a mapping is rejected.

Checks: tsc, biome, oxlint, knip, lint:compiler, lint:circular-deps, and the folder's Vitest tests and the dialog's Storybook story tests pass locally. UI UAT runs on the wiring PR, where the dialog is reachable.

Carry the organization in toggle and delete variables so a request that
settles after an organization switch releases and invalidates its own
list, reconcile the list after a failed delete, fall back to the table
when the last row's menu button is gone, and describe deletion as
removing only the personal definition.
A toggle or delete the server accepted stays visible even if the
reconciling refetch fails.
…ion is gone

A delete whose response was lost can still have committed, so the
refetched list decides whether the dialog closes.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum posted this on behalf of @ibetitsmike.

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T18:44:11.566921Z c1afb04 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e44b2d2e2b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Keep the model and the other front-matter in the dialog and give the
skill form a content builder, so the size limit, the meter, and the
submitted markdown all use the agent definition file. Block Escape while
a save runs, keep standalone front-matter comments, describe the field
for agents, document the exported context hook, and test import and
submit.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum posted this on behalf of @ibetitsmike.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a7501310d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…ly bodies

The size limit counts the model, which lives outside the skill form, so
a model change validates again. The server strips HTML comments before it
requires a body, so the form does too. The dialog now submits the name
with the content.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum posted this on behalf of @ibetitsmike.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ec5bf030a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Base automatically changed from mike/agent-definitions-ui-2-toggle-delete to main November 10, 2026 04:08
…ssals, and indented comments

The editor keeps the values it opened with as every field's baseline, so
refreshed initial values cannot reset some fields and leave others stale.
Escape and outside clicks act as Cancel, which the form disables from the
moment Save is clicked. Indented front-matter comments after owned keys
are kept unless they sit inside that key's block or quoted text. Add
stories for the submitting and import error states.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum acted for Mike on this comment.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5dc236da8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Hand-classifying front-matter lines lost inline comments on owned keys and
produced invalid YAML for indented root keys. Parse the front-matter as a
yaml Document and set the owned keys in place, which keeps comments and
other keys.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum posted this on behalf of Mike.

@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum posted this on behalf of Mike.

@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum requested this review on behalf of Mike.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 576e468ed6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum requested this review on behalf of Mike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 576e468ed6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum requested this review on behalf of Mike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: c1afb040fd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) closed and reopened this on behalf of @ibetitsmike.

Closing and reopening only to make GitHub recompute the merge ref against current main (15cfeed5f5) and run fork-ci on it. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 10, 2026
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) closed and reopened this again on behalf of @ibetitsmike.

The merge ref now points at current main (15cfeed5f5), but the run started by the first reopen was queued against the old merge ref. This second reopen starts fork-ci on the recomputed merge. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 10, 2026
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) closed and reopened this on behalf of @ibetitsmike.

Closing and reopening only to make GitHub recompute the merge ref against current main (4b0b4a0706) and run fork-ci on it. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 10, 2026
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) closed and reopened this again on behalf of @ibetitsmike.

The merge ref now points at current main (4b0b4a0706), but the run started by the first reopen was queued against the old merge ref. This second reopen starts fork-ci on the recomputed merge. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 10, 2026
@ibetitsmike
ibetitsmike merged commit cd80cd1 into main Nov 10, 2026
31 of 45 checks passed
@ibetitsmike
ibetitsmike deleted the mike/agent-definitions-ui-3-editor-dialog branch November 10, 2026 22:54
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) merged this on behalf of @ibetitsmike.

Merge evidence for head c1afb040fd5bf972bbf6bdcc14369358062d409a:

  • fork-ci pull_request run 42916325836 passed; its build job checked out Merge c1afb040fd into 4b0b4a0706 (current main). Runs 42913421712 (against 15cfeed5f5) and 42877243033 had also passed on this head. All checks green.
  • Codex on this exact head: no major issues (comment 6776094878). 0 of 31 review threads unresolved. The frontend deep review findings were fixed or declined with reasons.
  • Nothing opens the dialog in this PR, so its UI UAT ran on feat(site): create and edit personal agent definitions #102, which wires it to the personal agent definitions page: as a member user, create, edit (name read-only, tools and readonly front-matter kept), a duplicate name 409 shown in the dialog, file import, a lost create response, failing detail reads, Escape and outside click while a save is in flight, front-matter comments kept, a definition deleted elsewhere, a definition edited elsewhere while the editor is open, and flag off (no link, the URL redirects) all passed.
  • No migration.

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