GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: move a chat family between projects in chatd by ibetitsmike · Pull Request #30893 · coder/coder

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 16, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

chatd can now move a root chat, together with its subagent chats, into a project, to another project, or out of its project. Nothing calls this yet. #30894 adds the API.

Stack (moving chats between projects, bottom first):

  1. This PR: the move in chatd
  2. feat: move chats between projects through the chat update API #30894: PATCH /api/v2/chats/{chat} takes project_id
  3. feat(site/src): move chats between projects from the chat menu #30895: Move to project in the chat menu
  4. feat(site): drag chats onto project folders in the sidebar #30795: drag a chat onto a project folder in the sidebar

Why: today a chat keeps the project it was created with. A move must follow the family rules of archiving, because a step that runs during a move would still have the memory tools of the old project.

  • chatstate.Tx.SetProject runs only from W, E0 and E1, like SetArchived. SetFamilyProject() locks the root row before its subagents, in the same order as archiving, so a busy family gets ErrTransitionNotAllowed and nothing changes.
  • A move to the project the chat is already in changes nothing, even while the chat runs. The check reads the locked root row, so it waits for a move that is still in flight.
  • Only the root row stores project_id, and subagents use the project of the root. After the commit, chatd publishes a new project_change watch event for each chat of the family. The move keeps updated_at, so lists keep their order.
  • A root chat outside a project now has an empty memory index. When a chat leaves its project, or its project is deleted, its next turn start commits one memory index update that removes the memories the model saw there.

What to scrutinize: the lock order and the same-project check under the lock in SetFamilyProject() (chatstate/family.go), the turn-start condition in memoryIndexMessage() (memory.go), and whether the ARCHITECTURE.md text matches them.

Generated (make gen): queries.sql.go, querier.go, dbmock and dbmetrics come from queries/chats.sql. coderd/apidoc, docs/reference/api/schemas.md and typesGenerated.ts come from the new watch event kind, which is also why two chats.test.ts fixtures gain project_change: false.

Architecture doc: coderd/x/chatd/ARCHITECTURE.md lists SetProject among the transitions and in the execution state diagram (W, E0 and E1 back to themselves). It also says that a root chat's project can change after creation, and that a moved chat's next turn starts with a memory index update from the old project to the new one.

Testing

  • make pre-commit passes. go test passes for coderd/x/chatd/chatstate, coderd/database/dbauthz (TestMethodTestSuite) and the chatd memory tests.
  • TestSetFamilyProjectLocksRootFirst fails with 55P03 when a subagent row is locked first. TestSetFamilyProjectKeepsTheCurrentProject covers the same-project move during a run. The transition matrix test gains SetProject cases for W, E0 and E1.
  • TestMovedChatUsesNewProject runs two real turns around a move: the second turn uses the instructions and memories of the new project, and OutOfProject fails without the memory index removal.

Xum opened this PR on behalf of @ibetitsmike.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@ibetitsmike
feat: move a chat family between projects in chatd
b06cf6d
chatd gains MoveChatToProject, which sets the project of a root chat.
Its subagent chats follow because they use the project of the root.

The chatstate machine gets a SetProject transition, allowed only from
W, E0 and E1, like SetArchived. SetFamilyProject locks the root row
before its subagents, in the same order as archiving, so a busy family
gets ErrTransitionNotAllowed and a move never overlaps a step. A move to
the project the chat is already in changes nothing, even while the chat
runs. After the commit, chatd publishes a project_change watch event for
each chat of the family.

A root chat outside a project now has an empty memory index, so a chat
that leaves its project, or whose project is deleted, gets the memories
it saw removed at its next turn start.
@github-actions github-actions Bot assigned ibetitsmike Oct 16, 2026
@ibetitsmike
ibetitsmike added this pull request to stack #30896 October 16, 2026 12:42
@ibetitsmike ibetitsmike changed the title mike/move chats chatd feat: move a chat family between projects in chatd Oct 16, 2026
This was referenced Oct 16, 2026
feat: move chats between projects through the chat update API #30894
Merged
feat(site/src): move chats between projects from the chat menu #30895
Merged
feat(site): drag chats onto project folders in the sidebar #30795
Merged
@ibetitsmike
ibetitsmike marked this pull request as ready for review October 16, 2026 14:00
@ibetitsmike
ibetitsmike requested a review from nickvigilante as a code owner October 16, 2026 14:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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-10-16T20:59:27.792075Z b06cf6d 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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

nickvigilante
nickvigilante reviewed Oct 16, 2026
View reviewed changes

@nickvigilante nickvigilante left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Oct 16, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

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

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread codersdk/chats.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@pr-queue-manager
pr-queue-manager Bot requested a review from ThomasK33 October 16, 2026 14:21
@ibetitsmike

ibetitsmike commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026

Copy link
Copy Markdown

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

Reviewed commit: b06cf6d4bd

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ibetitsmike
docs(coderd/x/chatd): describe moving chats between projects
9f84197
Add the SetProject transition to the transition list and the execution
state diagram, note that a root chat's project can change after
creation, and describe how a moved chat's memory index is brought up to
date at its next turn.
ThomasK33
ThomasK33 approved these changes Oct 19, 2026
View reviewed changes
@ibetitsmike
Merge origin/main into mike/move-chats-chatd
f83d0f0
@ibetitsmike
ibetitsmike merged commit 0968f97 into main Oct 19, 2026
32 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@ibetitsmike
ibetitsmike deleted the mike/move-chats-chatd branch October 19, 2026 12:38
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@nickvigilante nickvigilante nickvigilante left review comments
@chatgpt-codex-connector chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] left review comments
@ThomasK33 ThomasK33 ThomasK33 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@ibetitsmike ibetitsmike

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@ibetitsmike @ThomasK33 @nickvigilante
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.