feat: add manual chat title regeneration#23633
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b3f2716058
ℹ️ 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: 961c2449db
ℹ️ 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: ca1ea4ef2d
ℹ️ 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: d03c928f19
ℹ️ 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".
site/src/api/queries/chats.test.ts
Outdated
| seedInfiniteChats(queryClient, [cachedChat]); | ||
|
|
||
| const mutation = regenerateChatTitle(queryClient); | ||
| const updatedChat = makeChat(chatId, { title: "New title" }); |
There was a problem hiding this comment.
Use an actual partial response in merge test
This test claims to verify behavior when the regenerate API returns a partial chat, but makeChat(chatId, { title: "New title" }) still produces a fully populated object. That means the test cannot catch regressions where omitted fields (for example diff_status) are accidentally dropped during merge, so the new coverage does not validate the scenario it names.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7782b3ac63
ℹ️ 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".
| return database.Chat{}, xerrors.Errorf("resolve chat model: %w", err) | ||
| } | ||
|
|
||
| title, err := generateManualTitle(ctx, chat, messages, model, keys, p.logger) |
There was a problem hiding this comment.
Enforce spend limits before manual title regeneration
RegenerateChatTitle invokes generateManualTitle (an LLM call) without running checkUsageLimit, unlike the existing chat write paths (CreateChat, SendMessage, and EditMessage) that block over-limit users before model work. As written, a user who has already hit their chat spend cap can still repeatedly call POST /api/experimental/chats/{chat}/title/regenerate and incur additional model usage; add the same owner-based limit check before resolving models or generating the title.
Useful? React with 👍 / 👎.
Summary
Adds a "Generate new title" action that lets users manually regenerate a chat's title using richer conversation context than the automatic first-message title path.
Changes
Backend
POST /api/experimental/chats/{chatID}/title/regeneratereturns the updated Chat with a regenerated titleextractManualTitleTurns,selectManualTitleTurnIndexes,buildManualTitleContext,renderManualTitlePrompt,generateManualTitle— all private, with the publicServer.RegenerateChatTitlemethodExperimentalClient.RegenerateChatTitle(ctx, chatID) (Chat, error)UpdateChatByIDand broadcastsChatEventKindTitleChangeFrontend
Tests
quickgen_test.go: Table-driven tests for all 4 helper functions (turn extraction, index selection, context building, prompt rendering)exp_chats_test.go: Handler tests (ChatNotFound, NotFoundForDifferentUser, NoDaemon)Design notes
maybeGenerateChatTitle,titleInput) is completely unchanged@x-apidocgen {"skip": true}