feat: add /set_topic_name for telegram topic labels#46983
feat: add /set_topic_name for telegram topic labels#46983VjiaoBlack wants to merge 9 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR adds a Key observations:
Confidence Score: 2/5
Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/auto-reply/reply/commands-topic-name.ts
Line: 45-53
Comment:
**Surface check comes after args validation**
The `!parsed.ok` guard (line 45) runs before `isTelegramSurface` (line 48). This means an authorized user on a non-Telegram surface who types `/set_topic_name` with no name argument will receive `"Usage: /set_topic_name <name>"` instead of `"⚙️ /set_topic_name only works for Telegram topics."` — directing them to fix their usage for a command that can never work on their surface regardless.
The `isTelegramSurface` check should come before the usage-error check:
```typescript
if (!parsed.ok) {
return { shouldContinue: false, reply: { text: parsed.error } };
}
if (!isTelegramSurface(params)) {
return {
shouldContinue: false,
reply: { text: "⚙️ /set_topic_name only works for Telegram topics." },
};
}
```
should be reordered to:
```typescript
if (!isTelegramSurface(params)) {
return {
shouldContinue: false,
reply: { text: "⚙️ /set_topic_name only works for Telegram topics." },
};
}
if (!parsed.ok) {
return { shouldContinue: false, reply: { text: parsed.error } };
}
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: src/auto-reply/reply/commands-topic-name.ts
Line: 54-78
Comment:
**`threadId` validated but never forwarded to gateway**
`threadId` is extracted and validated on lines 54–59 to ensure the command only runs inside a Telegram topic thread, but it is never included in the `callGateway` payload — only `params.sessionKey` and `label` are sent.
If `sessions.patch` uses `sessionKey` alone and each Telegram topic always maps to a unique session key, this is harmless. However, if multiple topics share the same session key (or if the gateway needs `threadId` to scope which thread's label to update), this silently patches the wrong label without any error.
Please confirm that `sessions.patch` with `sessionKey` alone is sufficient to uniquely identify the correct Telegram topic, or add `threadId` to the gateway payload if the API requires it for disambiguation.
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: 41137be |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c453720382
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
oops. nice AI review :) will make changes in a sec |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d4112da3e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
2d4112d to
41137be
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 41137be04a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 25fd11c207
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
94d6fa6 to
7deb020
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7deb0203cd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
💡 Codex Reviewhttps://github.com/openclaw/openclaw/blob/cdaf0c45397649f3f7facece3079709d01b91ea9/docs/.generated/config-baseline.json#L2 Reformatting this generated file changed key ordering and array layout from the writer’s canonical output ( ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
305d96e to
a8298ce
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a8298ce877
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: adb6e44165
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (suffix.length >= maxLen) { | ||
| return suffix.slice(0, maxLen).trim(); |
There was a problem hiding this comment.
Preserve full topic identity when trimming label base
When long topic names leave only a small maxBaseLen, fitBaseLabel truncates identitySuffix itself (suffix.slice(0, maxLen)), which can drop most or all of id:<chat>/topic:<thread> and collapse different Telegram topics onto the same generated label. In this revision that means two topics with the same long /set_topic_name value can still collide and the second sessions.patch fails with label already in use, even though the handler is trying to disambiguate by thread identity.
Useful? React with 👍 / 👎.
|
@Lukavyi sounds good lol i didn't clean this up fast enough / got sidetracked. Thanks! |
Summary
/set_topic_namecommand for Telegram topics to rename session labels from chat.·, trim) and cap name length to 64 chars.telegramprefix; replace raw errors with generic message + internal logs.Behavior Changes
/set_topic_name <name>command for Telegram topics.telegramwhen base label is empty.Tests
Manual Testing (omit if N/A)
Evidence (omit if N/A)
Sign-Off