Repository navigation
Conversation
5839205 to
e03097a
Compare
- register /telegram with the current SDK command handler API - stream assistant deltas to Telegram as a throttled edited draft - harden bot lock ownership with heartbeat and process identity checks - add lock behavior tests and README troubleshooting notes
e03097a to
e59aa1a
Compare
|
The Before this PR, connecting to a bot held by another session just worked. The new session replaced the old one. Now it refuses and tells you to re-run the command with In practice: I restart my CLI, the old lock hasn't heartbeat-expired yet (~135s window), and I have to retype the command with an extra flag. I'm almost always replacing myself, not stealing someone else's bot. There's also a conventions issue: Copilot CLI slash commands don't use Some ideas that might get you the safety you want without the friction:
What's the scenario you're worried about? Is it multi-user on the same host, or something else? Curious what drove this toward explicit opt-in. |
Summary
/telegramthrough the current Copilot SDK command handler API instead of a follow-up rawsession.resumeassistant.message_deltaevents to Telegram as a throttled edited draft message, then replace it with the final responsenode:testcoverage for stale locks, PID reuse, refresh, and lock removal--allow-tool extension-permission-accessCopilot launch requirement, and the CLI-side permission-prompt failure mode that can look like endless Telegram typingWhy
The bridge has a few reliability problems that overlap in real use:
/telegrambut fail to dispatch it if the bridge only registers command metadata.assistant.messagearrives.--allow-tool extension-permission-access, causing bridge startup to fail before Telegram can connect.These fixes work best as one PR because they touch the same runtime state machine: command registration, outbound assistant events, polling, lock lifecycle, and setup troubleshooting.
Startup note
If Copilot logs an error like:
Start Copilot CLI with:
Then reconnect the bridge with:
This is documented in the README troubleshooting section.
Supersedes
This consolidates and supersedes the earlier split PRs:
Validation
node --check extension.mjsnode --check tests/lock.test.mjsnode --test tests/lock.test.mjsgit diff --checkLocal smoke
Also tested locally by installing the patched
extension.mjsinto~/.copilot/extensions/copilot-cli-telegram-bridge/, starting Copilot with--allow-tool extension-permission-access, reconnecting/telegram connect copilotcli, and verifying the bridge lock/process stayed live while Telegram connected.