Skip to content

refactor(site/src): scope agent definition queries to a user or organization tier - #158

Merged
ibetitsmike merged 58 commits into
mainfrom
mike/agent-definitions-ui-6-tier-scope
Nov 11, 2026
Merged

ibetitsmike merged 58 commits into
mainfrom
mike/agent-definitions-ui-6-tier-scope

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Xum opened this PR on behalf of @ibetitsmike.

Part of #75.

Prepares the organization agent definitions page by scoping the personal page's data layer to a tier:

  • AgentDefinitionScope ({ tier: "user" | "organization", organizationId }) replaces the organization ID in the agent definition query options, query keys, and mutation variables. agentDefinitions, agentDefinition, createAgentDefinition, updateAgentDefinition, and deleteAgentDefinition call the user-tier or organization-tier route for the scope.
  • api/forkAgentDefinitions.ts adds the organization tier's list, get, create, update, and delete calls (/api/v2/chats/fork/organizations/{organization}/agent-definitions, from feat: serve organization agent definitions behind fork-agent-definitions #66).
  • ForkAgentDefinitionsTable and useForkAgentDefinitionEditor take a scope; the personal page passes the user tier. An editor or delete dialog still closes when the scope changes.

No behavior change on the personal page. New query tests check that organization-scope list, detail, create, update and delete call the organization routes, and that create, update and delete write only into the organization's caches, leaving a same-named personal definition as it was.

Checks: tsc, biome, oxlint, knip, lint:check, lint:compiler, lint:circular-deps, the folder's Vitest unit tests (75), the query tests (19) and the page and table view story tests pass locally.

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.
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.
…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.
…itions

A create whose response was lost closes the editor when the refetched
list shows the new name and the name was not listed before. Reopening a
definition seeds the editor from cached data instead of waiting for the
refetch. Tighten the API and query JSDoc.
…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.
…or-dialog' into mike/agent-definitions-ui-4-editor-wiring
A save writes its response to the definition's cached detail, so a
reopened editor shows the saved content even if the refetch fails.
Cached content seeds the editor only when it matches the listed
definition's id and is at least as new, or a fetch just returned it, so
a definition recreated or edited elsewhere waits for its fetch.
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.
…m:ibetitsmike/coder into mike/agent-definitions-ui-4-editor-wiring
…m:ibetitsmike/coder into mike/agent-definitions-ui-4-editor-wiring
…m:ibetitsmike/coder into mike/agent-definitions-ui-4-editor-wiring

@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: cfea938c9f

ℹ️ 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".

…ionsPage): document the editor hook contract
…or-wiring' into mike/agent-definitions-ui-6-tier-scope

# Conflicts:
#	site/src/pages/AgentsPage/AgentSettingsPage/ForkAgentDefinitionsPage/useForkAgentDefinitionEditor.ts
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum requested this review on behalf of @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 3241e644f2

ℹ️ 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".

…s-ui-4-editor-wiring

# Conflicts:
#	site/src/pages/AgentsPage/AgentSettingsPage/ForkAgentDefinitionsPage/ForkAgentDefinitionEditorDialog.stories.tsx
#	site/src/pages/AgentsPage/AgentSettingsPage/ForkAgentDefinitionsPage/ForkAgentDefinitionEditorDialog.tsx
Base automatically changed from mike/agent-definitions-ui-4-editor-wiring to main November 11, 2026 00:40
…s-ui-6-tier-scope

# Conflicts:
#	site/src/api/forkAgentDefinitions.ts
#	site/src/api/queries/forkAgentDefinitions.test.ts
#	site/src/api/queries/forkAgentDefinitions.ts
#	site/src/pages/AgentsPage/AgentSettingsPage/ForkAgentDefinitionsPage/ForkAgentDefinitionsPage.test.tsx
#	site/src/pages/AgentsPage/AgentSettingsPage/ForkAgentDefinitionsPage/ForkAgentDefinitionsTable.tsx
#	site/src/pages/AgentsPage/AgentSettingsPage/ForkAgentDefinitionsPage/useForkAgentDefinitionEditor.ts
@ibetitsmike
ibetitsmike marked this pull request as ready for review November 11, 2026 00:43

@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: 5ef77ed3db

ℹ️ 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 commented on behalf of @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: b400c31635

ℹ️ 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 (cd0ba56dfa) and run fork-ci on it. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 11, 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 (cd0ba56dfa), 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 11, 2026
@ibetitsmike
ibetitsmike merged commit 4bb7562 into main Nov 11, 2026
21 of 28 checks passed
@ibetitsmike
ibetitsmike deleted the mike/agent-definitions-ui-6-tier-scope branch November 11, 2026 01:27
@ibetitsmike

Copy link
Copy Markdown
Owner Author

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

Merge evidence for head b400c31635dfd6c6c027c42470b063b24a601160:

  • fork-ci pull_request run 42937064330 passed against current main cd0ba56dfa, with the build job checking out the merge onto it. Run 42934711559 had also passed on this head. All checks green.
  • Codex on this exact head: no major issues (receipt refactor(site/src): scope agent definition queries to a user or organization tier #158 (comment)). The P2 from the post-ready review, organization-scope query tests, was fixed in b400c31635, a test-only commit adding 19 query tests. 0 of 3 review threads unresolved.
  • UAT: this PR changes the data layer only, scoping the agent definition queries to a user or an organization. The personal page behaves as before (W10 round 14). The organization tier passed end to end in the feat(site/src): add the organization agent definitions page to AI settings #160 round 1 UAT on :3100, whose stack includes this PR: create, toggle and delete through the organization routes, auditor read-only, member denied, unknown organization denied.
  • Frontend only, 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