feat: /topic command for named sessions in private chats#88
Conversation
Switch between independent conversation contexts in your DM: /topic deploy — switch to 'deploy' topic /topic debug — switch to 'debug' topic /topic — show current topic /topic main — return to default session Each topic gets its own agent memory and context. Topic names sanitized to lowercase alphanumeric + hyphens. 396 tests green.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 222e377e4f
ℹ️ 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".
| if (agentThreadId !== "main") return agentThreadId; | ||
| const chatId = thread.id?.split(":")[1] ?? thread.id ?? ""; | ||
| const topic = getActiveTopic(String(chatId)); | ||
| return topic ? `topic:${topic}` : agentThreadId; |
There was a problem hiding this comment.
Scope topic session IDs to chat
applyTopicOverride drops the chat identifier and returns only topic:<name> for all private chats, so two different users who pick the same topic name (for example /topic deploy) are routed into the same agent session. This breaks the per-chat isolation implied by activeTopics (keyed by chatId) and can leak context/history across users in multi-user allowlists; include chat identity in the derived session id (e.g., dm:<chatId>:topic:<name>) to keep sessions isolated.
Useful? React with 👍 / 👎.
Switch between independent conversation contexts in your DM:
/topic deploy— switch to 'deploy' topic/topic debug— switch to 'debug' topic/topic— show current topic/topic main— return to default session