Skip to content

feat(site): pick templates for chat projects - #30756

Open
jaaydenh wants to merge 54 commits into
chat-project-templates/multi-select-comboboxfrom
chat-project-templates/site
Open

jaaydenh wants to merge 54 commits into
chat-project-templates/multi-select-comboboxfrom
chat-project-templates/site

Conversation

@jaaydenh

@jaaydenh jaaydenh commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Adds template selection to the create project dialog and filters the composer's workspace picker on project pages.

  • The create dialog gets a templates multi-select with Select all, limited to the organization's templates that allow agents and are not deprecated. Changing the organization clears the selection.
  • A Limit chats to these templates switch turns on the project's opt-in limit. It is off by default, so chats can use any template their owner can use and the selected templates are only listed first for the agent. With the limit on and nothing selected, the dialog warns that chats can't create or attach workspaces.
  • Creating sends limit_templates and template_ids. Templates that are no longer eligible are dropped on save. The Edit project dialog keeps only the name, description, and icon; feat(site/src): edit chat project templates from the project details #30898 edits templates from the project page.
  • The existing-workspace picker hides workspaces whose template is not attached only when the project limits its chats, for a project page or a project picked in the composer, matching the server-side check.

Create project dialog with the templates field and the limit switch

This PR used to hold more. To keep each PR small, the rest moved unchanged to other PRs of the stack: the SettingSwitch extraction to #32371, the MultiSelectCombobox keyboard fixes to #32372, the default template and preset to #32373, and the default parameter values to #32374.

Stack (merge top to bottom):

The project dialog gets a templates multi-select with Select all, limited
to templates that allow agents, and a default template with either a
default preset or default parameter values. On a project page, the
composer's workspace picker hides workspaces whose template is not one of
the project's templates.
@jaaydenh

Copy link
Copy Markdown
Collaborator Author

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

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 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-16T14:30:16.871509Z 2bab0fc 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.

@jaaydenh

Copy link
Copy Markdown
Collaborator Author

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

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

@jaaydenh

Copy link
Copy Markdown
Collaborator Author

@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: 80c78138c3

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

@jaaydenh
jaaydenh added this pull request to stack #30892 October 16, 2026 12:17
…pick templates only when creating a project

The edit dialog goes back to the name, description, and icon. Templates
are edited from the project page instead.
@jaaydenh

Copy link
Copy Markdown
Collaborator Author

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

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

@jaaydenh

Copy link
Copy Markdown
Collaborator Author

@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: 75ea290ce1

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

… evaluation

The default parameter values of a project's default template were read
from the legacy rich-parameters endpoint and edited as one text input
per parameter. That list misses parameters that only exist once other
values are set, and it has no type-aware inputs.

The form now evaluates the template version through
POST /templateversions/{id}/dynamic-parameters/evaluate with the values
set so far and renders the result with the shared DynamicParameter
fields that the workspace creation form uses. Only values the user
changes are saved, and each can be returned to the template default.
…elds

The templates fields nested ternaries up to four levels deep in their
JSX. The default preset becomes its own component that returns early
for each loading state, the templates list renders through independent
conditions, and the empty-list message comes from a small function.
The rendered DOM is unchanged apart from generated ids.
- Render the form's states through independent conditions instead of
  nested ternaries, and give a parameter separate change and reset
  callbacks.
- Reuse the Agents RetryButton for a failed evaluation.
- Replace two tests with one that saves a default for a parameter
  another value adds, which also checks the evaluation requests.
- Add a story for an evaluation that fails as a whole, and show a
  rejected value in the parameters story.
- Trim comments that described other modules.
…reload

- Show a parameter without a project default with the template's
  default value, so a reset field never shows the value it just lost
  while the next evaluation loads.
- Show a failed evaluation through ErrorAlert, also next to cached
  parameters, and move focus off Retry only once the retry succeeds.
A failed evaluation is shown through Alert with the Agents RetryButton
and keeps "Failed to load parameters." as its fallback text. Retry
unmounts while the evaluation loads again, so pressing it moves focus
to the parameter values group at once.
jaaydenh added a commit that referenced this pull request Nov 17, 2026
Adds the database layer for attaching workspace templates to chat
projects: the schema, the queries, their authorization, and the audit
type. Nothing calls the new queries yet, and the existing create and
update handlers pass the new parameters unset. The API, the limit's
enforcement, and the agent tools follow in the PRs above.

- Attachments live in a `chat_project_templates` table (`project_id`,
`template_id`, `created_by`, `created_at`), deleted with the project or
the template. `chat_projects` gains `limit_templates` (default `false`),
`default_template_id`, `default_template_version_preset_id`, and
`default_parameters jsonb`. A project stores a default preset or default
parameter values, not both.
- `InsertChatProjectTemplates` needs project `update` and `use` on every
template. It skips templates that are already attached, and templates
outside the project's organization, so an attachment never crosses
organizations. `DeleteChatProjectTemplate` needs project `update` and
template `read`, and clears the project's default when it detaches the
default template. Both checks are in dbauthz.
- `GetChatProjectTemplatesByProjectIDs` is authorized through the
project, and leaves out deleted, deprecated, and agent-disabled
templates. It does not check the caller's access to each template, so
callers do that before they expose one.
- `UpdateChatProjectByID` changes the template settings only when the
request sets them, so an update that omits them cannot write back a
stale snapshot.
- `AuditableChatProjectTemplates` is the audit form of a project's
attached templates, logged as a write to the project. The new
`chat_projects` columns are tracked in the project's own audit diff,
with the default parameter values masked because they may hold
credentials.

**NOTE**: the migration adds one table and four columns and changes no
existing rows. Existing projects keep unlimited template access.

Stack (merge top to bottom):
- #32309 👈
- #30754
- #32310
- #30755
- #30756
- #30898
…first pull request

This branch keeps the template picker, the limit switch, and the
workspace filter of the new chat form. The default template with its
preset, and the default parameter values, move to the next two
branches of the stack unchanged, so each can be reviewed on its own.

The validation lookup moves next to the fields that show it, where the
project page's dialog reuses it.
…-project-templates/site

# Conflicts:
#	site/src/pages/AgentsPage/components/ChatsSidebar/dialogs/ChatProjectDialog.tsx
jaaydenh added a commit that referenced this pull request Nov 18, 2026
Adds the API for attaching workspace templates to a chat project, on the
schema and queries in #32309. A project can attach templates, turn on a
limit that restricts its chats to them, and set a default template with
either a default preset or default parameter values. Attaching a
template never grants access to it: every reader is checked against the
template's own sharing. This PR stores and returns `limit_templates`;
#32310 enforces it.

- The limit is opt-in. `limit_templates` is off unless a request turns
it on, which is what every existing project gets.
- Templates are attached and detached one at a time with `PUT` and
`DELETE /chats/projects/{project}/templates/{template}`, so a caller
never replaces a list they can only partly see. Attaching needs project
`update` and template `use`. Detaching needs project `update` and
template `read`, and a template the caller cannot read is reported as
not found. `POST /chats/projects` accepts `template_ids`,
`limit_templates`, and `default_template` for the new project.
- `PATCH /chats/projects/{project}` sets `limit_templates` and
`default_template`, and no longer changes which templates are attached.
The default must be an attached template the caller can read, and its
preset must belong to the template's active version. Default parameter
names and values are checked against that version for templates on the
classic parameter flow; dynamic parameters are checked when a workspace
is built. Detaching the default template clears the default.
- Project responses list only the attached templates the caller can
read, as `templates`, and count the rest as `hidden_template_count`.
`default_template` is omitted when the caller cannot read it. Deleted,
deprecated, and agent-disabled templates are left out and are not
counted as hidden.
- Editing uses `chat_project:update`, which the project owner and the
project `admin` ACL role have.
- Attaching and detaching are audited as writes to the project, with the
template list before and after, including the templates attached while
creating a project. Changes to `limit_templates` and the default
template are part of the project's own audit diff.

Not included: showing which project members lack access to an attached
template, and MCP server attachments.

Stack (merge top to bottom):
- #32309
- #30754 👈
- #32310
- #30755
- #32371
- #32372
- #30756
- #32373
- #32374
- #32375
- #30898
- #32376
- #32377
- #32378
- #32379

This branch has not been deployed

No deployments
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