fix(telegram): keep numeric chat ids for announce targets#44169
fix(telegram): keep numeric chat ids for announce targets#44169hugh-agent wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR attempts to fix Telegram announce target resolution by bypassing the
Confidence Score: 1/5
Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/agents/tools/sessions-send-helpers.ts
Line: 63-68
Comment:
**Fix still includes `group:` prefix for Telegram targets**
The fix assigns `normalized = kindTarget` for Telegram, but `kindTarget` for a group session key is `"group:<id>"` (computed at line 61: `return kind === "channel" ? \`channel:${id}\` : \`group:${id}\``). So `to` ends up as `"group:-1001720118846"` — the same prefixed form that caused the original validation failure — not the raw numeric `"-1001720118846"` expected by both new tests.
Tracing through `"agent:main:telegram:group:-1001720118846"`:
- `kind = "group"`, `id = "-1001720118846"`
- `kindTarget = "group:-1001720118846"` (line 61)
- `normalized = kindTarget = "group:-1001720118846"` (new branch)
- `to = "group:-1001720118846"` — test expects `"-1001720118846"` → **test fails**
The fix should use `id` (the bare numeric value) instead of `kindTarget`:
```suggestion
const normalized =
normalizedChannel === "telegram"
? id
: normalizedChannel
? getChannelPlugin(normalizedChannel)?.messaging?.normalizeTarget?.(kindTarget)
: undefined;
```
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: bc02ee8 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc02ee80b4
ℹ️ 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".
|
Addressed the review feedback in a follow-up commit.
This should close the |
efba53f to
74dfe71
Compare
|
Refreshed this PR on top of the latest |
Summary
resolveAnnounceTargetFromKeyProblem
When
sessions_send/ nested announce delivery targeted a Telegram group session,resolveAnnounceTargetFromKey(...)routed the target through channel target normalization and produced values likegroup:-1001720118846.Later, Telegram send-path validation rejected that target with:
Telegram recipient must be a numeric chat IDThis broke agent-to-agent announce delivery into Telegram groups, even though the underlying session key already contained the correct numeric chat ID.
Fix
For Telegram, bypass messaging target normalization in
resolveAnnounceTargetFromKey(...)and keep the resolved announce target as the raw numeric chat ID. Thread/topic IDs are still extracted and preserved separately.Repro
agent:main:telegram:group:-1001720118846sessions_send/ nested announce flow targeting that sessionTelegram recipient must be a numeric chat IDNotes
I could not run the repo Vitest target in this environment because project dependencies are not installed in the cloned repo, but I added a focused unit test for the helper.