fix(telegram): persist native command metadata to target sessions#57548
Conversation
Greptile SummaryThis PR fixes a bug where Telegram native command metadata was persisted to the slash envelope key ( Changes:
The fix is minimal and scoped correctly. The production change ( Confidence Score: 5/5Safe to merge — the production change is a single targeted fix with no side effects on unrelated paths, and the new tests correctly lock in the corrected behavior across all affected routing scenarios. The production fix is minimal (one new variable, one call-site change). The fallback chain is correct and well-ordered. All four routing paths (private DM, helper-topic, configured ACP binding, bound-topic-session) are covered by tests that assert the new behavior. No P0 or P1 issues found. No files require special attention.
|
| Filename | Overview |
|---|---|
| extensions/telegram/src/bot-native-commands.ts | Single targeted fix: session metadata now persisted to CommandTargetSessionKey instead of the slash envelope SessionKey. |
| extensions/telegram/src/bot-native-commands.session-meta.test.ts | Test assertions updated to lock in the corrected target-session-key behavior across all four routing paths. |
Reviews (1): Last reviewed commit: "fix(telegram): persist native command me..." | Re-trigger Greptile
2d32e60 to
e464340
Compare
|
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Keep this PR open. Current main still persists Telegram native-command inbound session metadata to the slash envelope session key, while the same context already carries CommandTargetSessionKey for the routed or bound target session. The PR remains a focused implementation candidate for the bug described by #57509, not work already implemented on main. Best possible solution: Keep the PR open and have a maintainer review, land, or replace it with an equivalent narrow fix that persists Telegram native command metadata to the target session key, with session-meta regression coverage for private, helper-topic, configured ACP topic binding, and runtime bound-topic-session flows. What I checked:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 891c7d9f1c1f. |
e464340 to
ab07c81
Compare
obviyus
left a comment
There was a problem hiding this comment.
Verified the Telegram native-command metadata bug: slash-command envelope sessions were getting the metadata instead of the routed target session.
Maintainer follow-up: distilled the metadata write to use commandTargetSessionKey directly and added the Unreleased changelog entry.
Local gate: pnpm test extensions/telegram/src/bot-native-commands.session-meta.test.ts plus targeted oxfmt --check.
Summary
agent:<agent>:telegram:slash:<user>) even when the command was targeting a bound topic/helper session.CommandTargetSessionKey, and regression coverage now asserts the persisted key matches the actual target session in private, helper-topic, configured ACP topic binding, and bound-topic-session flows.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause / Regression History (if applicable)
extensions/telegram/src/bot-native-commands.tsalways persisted inbound session metadata usingctxPayload.SessionKey, which is the slash envelope key, instead of the actual chat target session.CommandTargetSessionKey.git blame, prior PR, issue, or refactor if known): issue [Bug]: Telegram helper-agent slash:<user> session keys are incorrectly mapped to group:<group_id>:topic:1 sessions #57509 reported helper-agent Telegram slash keys being projected to topic/group session shells.Regression Test Plan (if applicable)
extensions/telegram/src/bot-native-commands.session-meta.test.tsCommandTargetSessionKey, including helper-topic and ACP-bound topic flows.User-visible / Behavior Changes
Telegram helper/topic native commands no longer create or refresh fake
telegram:slash:<user>session entries with topic/group metadata through this code path.