Repository navigation
feat: move chats between projects through the chat update API - #30894
Open
ibetitsmike wants to merge 1 commit into
Open
ibetitsmike wants to merge 1 commit into
ibetitsmike wants to merge 1 commit into
Conversation
PATCH /api/v2/chats/{chat} now accepts project_id. A UUID moves an idle
root chat into a project of its owner and organization; uuid.Nil removes
it from its project. The project checks are the ones of chat creation,
now shared by validateChatProjectSelection.
A project that the chat's owner does not own gives 404 even for an
admin, so an admin cannot put a member's chat into another user's
project and expose its memory. A child chat, an archived chat or a
disabled experiment gives 400, and a busy family gives 409. The move is
the last write of the request, so a refused move keeps the earlier
writes, as a refused archive does.
ibetitsmike
added this pull request to stack #30896
October 16, 2026 12:42
ibetitsmike
marked this pull request as ready for review
October 16, 2026 14:00
Codex Review SummaryThis 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. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PATCH /api/v2/chats/{chat}now takesproject_id. A project ID moves the chat into that project, anduuid.Nilremoves it from its project.Stack (moving chats between projects, bottom first):
project_idWhy: #30893 can move a chat family, and the UI layers above need an endpoint to call.
validateChatProjectSelection(), which this PR extracts frompostChats()without a change in behavior.chat-projectsexperiment gives 400. A family that is not idle gives 409 ("Cannot move an active chat. Interrupt or wait for the chat to finish first."). A project deleted between the check and the move gives 404.patchChat(), so a refused move keeps the earlier writes of the same request, as a refused archive does.What to scrutinize: the owner check in
validateChatProjectSelection()and the order of the refusals inpatchChat()(coderd/exp_chats.go).Generated (
make gen):coderd/apidoc,docs/reference/api/chats.md,docs/reference/api/schemas.mdandtypesGenerated.tscome fromUpdateChatRequest.ProjectIDincodersdk/chats.go.Testing
make pre-commitpasses, and so doesgo test ./coderd -run TestPatchChatProject(14 subtests).TestPatchChatProject/AnotherOwnersProjectfails without the owner check.MoveBackWaitsForAPendingMoveends in the wrong project when the handler skips the move before the lock.ActiveFamilyReturnsConflictchecks the 409 for a running, interrupting or action-waiting root and for a running subagent.PublishesProjectChangeandAuditsTheMovecover the watch event and the audit entry.