Skip to content

feat: add chat project template schema and queries - #32309

Merged
jaaydenh merged 4 commits into
mainfrom
chat-project-templates/database
Nov 17, 2026
Merged

jaaydenh merged 4 commits into
mainfrom
chat-project-templates/database

Conversation

@jaaydenh

@jaaydenh jaaydenh commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

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):

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.
@jaaydenh

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 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-17T09:28:42.162989Z c7cdced 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: 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".

@jaaydenh
jaaydenh marked this pull request as ready for review November 17, 2026 08:09
@jaaydenh
jaaydenh temporarily deployed to main November 17, 2026 08:09 — with GitHub Actions Inactive
@jaaydenh
jaaydenh requested a review from f0ssel November 17, 2026 08:09
…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.
@jaaydenh
jaaydenh temporarily deployed to main November 17, 2026 08:49 — with GitHub Actions Inactive
@jaaydenh
jaaydenh temporarily deployed to main November 17, 2026 08:50 — with GitHub Actions Inactive
@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: 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.
@jaaydenh
jaaydenh temporarily deployed to main November 17, 2026 09:04 — with GitHub Actions Inactive
@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: 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".

@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: 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".

Comment thread enterprise/audit/table.go Resolved
…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.
@jaaydenh
jaaydenh temporarily deployed to main November 17, 2026 09:24 — with GitHub Actions Inactive
@jaaydenh

Copy link
Copy Markdown
Collaborator Author

@codex review

@jaaydenh
jaaydenh temporarily deployed to main November 17, 2026 09:24 — with GitHub Actions Inactive
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: c7cdcedf4f

ℹ️ 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 merged commit 1f1aa6a into main Nov 17, 2026
35 of 38 checks passed
@jaaydenh
jaaydenh deleted the chat-project-templates/database branch November 17, 2026 14:59
@jaaydenh
jaaydenh temporarily deployed to main November 17, 2026 14:59 — with GitHub Actions Inactive
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 17, 2026

This branch had an error being deployed

1 failed and 1 inactive deployments
main — c7cdcedf Deployed Nov 17, 2026 by jaaydenh via cla #258713
docs-preview — c7cdcedf Deployed Nov 17, 2026 by jaaydenh via cleanup #167
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants