Skip to content

feat: add chat projects API - #29242

Merged
f0ssel merged 27 commits into
mainfrom
f0ssel/chat-projects
Oct 1, 2026
Merged

f0ssel merged 27 commits into
mainfrom
f0ssel/chat-projects

Conversation

@f0ssel

@f0ssel f0ssel commented Sep 11, 2026 •

Copy link
Copy Markdown
Member
  • Experiment, behind chat-projects (off by default). First of three stacked PRs: feat: add shared project memory API for chats in a project #29301 (memory), feat: add chat project folders to the sidebar #29583 (UI). This PR is API only; the screenshots below are from the UI in feat: add chat project folders to the sidebar #29583.
  • CRUD under /api/experimental/organizations/{organization}/chats/projects/{project}. GET /api/experimental/chats/projects lists the caller's projects across all organizations.
  • project_id on chat create and as a chat list filter. A chat joins a project only at creation; there is no move.
  • Projects are identified by ID. Names are display labels (64 characters, description 1024) with no uniqueness constraint. An optional icon URL (usually an emoji image under /emojis) is capped at 256 characters and audited.
  • A user can own at most 100 projects across all organizations; creating another answers 409. Creates count and insert under a per-owner advisory lock so concurrent requests cannot overshoot.
  • Projects are private to their owner_id. Members may only create their own, and a chat can only be bound to a project its owner owns. An unreadable or foreign project on chat create answers 404 so IDs cannot be probed; a project from another organization answers 400.
  • Permissions ride on the agents-access role next to chats (after feat: restore agents-access as a default organization role #30004), so whoever can use Coder Agents can use projects. Owners and org admins reach every project.

Examples

Create a project in an organization:

POST /api/experimental/organizations/{organization}/chats/projects
{"name": "Platform", "description": "Infra and deploy work", "icon": "/emojis/1f680.png"}
{
  "id": "7c0e4a3e-5b1f-4f7d-9a51-2f3c8f6d2b10",
  "organization_id": "bb640d07-ca8a-4869-b6bc-ae61ebb2fda1",
  "owner_id": "0ed9befc-4911-4ccf-a8e2-559bf72daa94",
  "name": "Platform",
  "description": "Infra and deploy work",
  "icon": "/emojis/1f680.png",
  "created_at": "2026-09-30T15:04:05Z",
  "updated_at": "2026-09-30T15:04:05Z"
}

List the caller's projects across organizations with GET /api/experimental/chats/projects (an array of the object above). Update with PATCH .../chats/projects/{project} and any of name, description, icon; delete with DELETE, which detaches its chats.

Create a chat in the project, and list only its chats:

POST /api/v2/chats
{"organization_id": "bb640d07-…", "project_id": "7c0e4a3e-…", "content": [{"type": "text", "text": "Plan the deploy"}]}

GET /api/v2/chats?project_id=7c0e4a3e-…

At the limit:

409 {"message": "You can have at most 100 chat projects. Delete a project to create another."}
Screenshots (UI from #29583)

Create project
Sidebar folders
Project page
Folder menu
Another member sees no projects


Generated with Coder Agents on behalf of @f0ssel.

@f0ssel f0ssel added the experimental Changes that might not necessarily be merged, until its approved to proceed with. label Sep 11, 2026
@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

@f0ssel
f0ssel force-pushed the f0ssel/chat-projects branch from fca955e to 1970f72 Compare September 14, 2026 17:59
@f0ssel f0ssel changed the title feat: add chat projects with shared project memory (experiment) feat: add organization-scoped chat projects (experiment) Sep 14, 2026
@f0ssel
f0ssel force-pushed the f0ssel/chat-projects branch from 1970f72 to d6ed44c Compare September 14, 2026 19:22
@f0ssel

f0ssel commented Sep 14, 2026

Copy link
Copy Markdown
Member 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: d6ed44cbf1

ℹ️ 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 coderd/database/db2sdk/db2sdk.go Resolved
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-21T23:19:13.991310Z d9ac776 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.

@linear-code

linear-code Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

…cts experiment

Adds a lightweight chat_projects table and a nullable chats.project_id
binding so agent chats can be grouped inside an organization-scoped
project. Chats stay independent by default; deleting a project detaches
its chats instead of deleting them.

Backend: chat_project RBAC resource (org members read/create, creators
and org admins update/delete), audited CRUD under
/api/experimental/chats/projects, project_id on chat create/update and
list filter, codersdk client methods.

Frontend: experiment-gated Projects sidebar section with create/edit/
delete dialogs, /agents/projects/:projectId page, new-chat-in-project via
?project=, and a Move to project action in the chat menus.
Single-project responses previously scanned the organization's project
list to recover chat_count. A dedicated count query shares the list
predicate, and the converter now requires the count so no response can
silently report zero.
@f0ssel
f0ssel force-pushed the f0ssel/chat-projects branch from 9471d67 to aef0902 Compare September 17, 2026 16:46
@f0ssel

f0ssel commented Sep 17, 2026

Copy link
Copy Markdown
Member 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: aef090294b

ℹ️ 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 coderd/exp_chats.go Resolved
Silently dropping project_id returned every chat as if it were the
project's contents. The list now fails the same way create and update do.
@f0ssel

f0ssel commented Sep 18, 2026

Copy link
Copy Markdown
Member 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: a6149fa0d3

ℹ️ 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 coderd/exp_chats.go Resolved

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

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

@coder coder deleted a comment from chatgpt-codex-connector Bot Sep 22, 2026
# Conflicts:
#	docs/admin/security/audit-logs.md
…-access and gate project binding on the experiment only
@f0ssel f0ssel changed the title feat: add chat projects (experiment) feat: add chat projects API Sep 22, 2026
Comment thread coderd/rbac/roles.go Resolved
@f0ssel
f0ssel requested a review from mafredri September 24, 2026 19:44
# Conflicts:
#	coderd/database/queries.sql.go
#	coderd/rbac/roles.go
#	docs/reference/api/chats.md
#	docs/reference/api/schemas.md
@f0ssel
f0ssel requested a review from jaaydenh September 28, 2026 17:52
Comment thread coderd/chat_projects.go Resolved
Comment thread coderd/chat_projects.go Resolved
Comment thread coderd/chat_projects.go Resolved
Comment thread coderd/chat_projects.go Resolved
Comment thread coderd/chat_projects.go Resolved
Comment thread coderd/chat_projects.go Resolved
Comment thread coderd/exp_chats.go Resolved
f0ssel and others added 4 commits September 29, 2026 13:05
- Move chat project CRUD under /api/experimental/organizations/{organization}/chats/projects
  and keep a user-scoped list at /api/experimental/chats/projects.
- Identify projects by ID only: drop the per-owner name unique index and
  409 handling, and break list-order ties by ID.
- Return field-specific validation errors.
- Report unreadable or foreign projects on chat creation as 404.
Listing is user-scoped like chats, so the projects page loads every
project in one request. Create, get, update, and delete stay under
/api/experimental/organizations/{organization}/chats/projects.
Renumber the chat projects migration to 000605 after main added 000604.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Comment thread coderd/chat_projects.go Resolved
Renumber the chat projects migration to 000606 after main added 000605.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Count a user's projects across organizations under a per-owner advisory
lock so concurrent creates cannot overshoot, and answer 409 at the cap.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@f0ssel
f0ssel requested a review from mafredri September 30, 2026 14:01
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@f0ssel
f0ssel merged commit 7cd1b20 into main Oct 1, 2026
32 checks passed
@f0ssel
f0ssel deleted the f0ssel/chat-projects branch October 1, 2026 15:49
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

experimental Changes that might not necessarily be merged, until its approved to proceed with.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants