Repository navigation
feat: add chat project template schema and queries - #32309
Conversation
Add the chat_project_templates table, the limit_templates and default template columns on chat_projects, the queries that attach, detach and list a project's templates, their dbauthz checks, and the audit type for a project's attached templates.
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4279895c58
ℹ️ 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".
…rganization InsertChatProjectTemplates attached any template ID it was given, so only its callers kept a project's templates inside the project's organization. The query now attaches only templates in that organization and skips the rest, as it already skips templates that are attached.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e439f176d
ℹ️ 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".
…e is detached DeleteChatProjectTemplate cleared the project's default template whenever the default matched, even when the template was not attached and the delete removed nothing. The clear now requires the attachment to exist, so a detach that returns no rows leaves the project unchanged.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2922b08426
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2922b08426
ℹ️ 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".
…audit diffs A chat project's default parameters were tracked in clear text, so a parameter value that holds a credential would be written to the audit log. Record the field as a secret: the diff still shows that it changed, without the values.
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
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.
chat_project_templatestable (project_id,template_id,created_by,created_at), deleted with the project or the template.chat_projectsgainslimit_templates(defaultfalse),default_template_id,default_template_version_preset_id, anddefault_parameters jsonb. A project stores a default preset or default parameter values, not both.InsertChatProjectTemplatesneeds projectupdateanduseon every template. It skips templates that are already attached, and templates outside the project's organization, so an attachment never crosses organizations.DeleteChatProjectTemplateneeds projectupdateand templateread, and clears the project's default when it detaches the default template. Both checks are in dbauthz.GetChatProjectTemplatesByProjectIDsis 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.UpdateChatProjectByIDchanges the template settings only when the request sets them, so an update that omits them cannot write back a stale snapshot.AuditableChatProjectTemplatesis the audit form of a project's attached templates, logged as a write to the project. The newchat_projectscolumns 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):