Repository navigation
fix(telegram): route questionnaire card per window so it renders in all topics - #40
Closed
rodrigopavezi wants to merge 1 commit into
Closed
rodrigopavezi wants to merge 1 commit into
rodrigopavezi wants to merge 1 commit into
Conversation
The agent questionnaire widget (multiple-choice "Questions" card) was only delivered to Telegram through the home-window state patch. WindowSnapshot did not carry the questionnaire field, so for any window that is not the active CDP home window the card was silently dropped, and processWindow reused the global home-window questionnaire, which could push it into the wrong topic. Thread questionnaire through WindowSnapshot, populate it in both capture paths (home + parallel poll), include it in the change-detection fingerprint so an appearing/advancing/clearing questionnaire triggers an emit, and process the snapshot's own questionnaire against its thread in doProcessWindow.
len5ky
added a commit
that referenced
this pull request
Jul 7, 2026
### Fixed - **Message extraction broke on Cursor 3.8+ virtualized chat DOM**: newer Cursor builds virtualize the chat transcript and reshuffle the message wrapper markup, so the relay stopped finding `data-flat-index` / `data-message-role` nodes and the web client and Telegram showed an empty or frozen conversation. Extraction now falls back to the 3.8+ virtualized wrappers (with tightened guards so it never matches stray nodes), and the composer-targeting selectors in `command-executor` were refreshed to match. The new path is **fallback-only** — the legacy pre-3.8 extraction is tried first and its behavior is unchanged, so older Cursor builds are unaffected. Ports [public#39](#39) (thanks @gilzhaiek) with tightened fallbacks, and folds in the command-executor selector updates from [public#38](#38) (thanks @cachrisman). Closes [public#36](#36), [public#35](#35). - **Messages weren't sent for users with Cursor's "Submit with ⌘+Enter" setting**: the relay submits prompts by dispatching a plain Enter, which does nothing when Cursor is configured to require Cmd/Ctrl+Enter — the text just sat in the composer. The submit path now retries with Cmd/Ctrl+Enter as a fallback, firing only when the composer still contains the text 300ms after the plain Enter (so normal setups are unaffected). Closes [public#37](#37). - **Telegram questionnaire only rendered in one topic**: multiple-choice questionnaire cards were processed on the global state path, so with several Cursor windows/agents open the card surfaced in just one topic. Questionnaires are now routed per window through `doProcessWindow`, so each agent's questions render in its own topic, with the option labels folded into the change fingerprint to avoid missed updates. Ports [public#40](#40) (thanks @rodrigopavezi). - **Telegram bot token now stored in VS Code SecretStorage** instead of plaintext in `settings.json`. Existing tokens in `settings.json` are auto-migrated into SecretStorage on activation and cleared from settings. Closes [public#33](#33). ### Changed - `/history` now documents its real default of 5 messages, and the setup docs no longer ask for the Telegram "Pin Messages" permission — the bot never pinned. The dead `can_pin_messages` check was also removed from `/sync`. Closes [public#29](#29), [public#30](#30).
Owner
|
Merged (ported) in v0.1.47 — clean fix, and mirroring the approvals routing was exactly right. One small addition while porting: option labels are folded into the fingerprint so a label-only change re-emits the card. You're credited as co-author on the commit. Thanks! |
len5ky
added a commit
that referenced
this pull request
Nov 4, 2026
### Fixed - **Message extraction broke on Cursor 3.8+ virtualized chat DOM**: newer Cursor builds virtualize the chat transcript and reshuffle the message wrapper markup, so the relay stopped finding `data-flat-index` / `data-message-role` nodes and the web client and Telegram showed an empty or frozen conversation. Extraction now falls back to the 3.8+ virtualized wrappers (with tightened guards so it never matches stray nodes), and the composer-targeting selectors in `command-executor` were refreshed to match. The new path is **fallback-only** — the legacy pre-3.8 extraction is tried first and its behavior is unchanged, so older Cursor builds are unaffected. Ports [public#39](#39) (thanks @gilzhaiek) with tightened fallbacks, and folds in the command-executor selector updates from [public#38](#38) (thanks @cachrisman). Closes [public#36](#36), [public#35](#35). - **Messages weren't sent for users with Cursor's "Submit with ⌘+Enter" setting**: the relay submits prompts by dispatching a plain Enter, which does nothing when Cursor is configured to require Cmd/Ctrl+Enter — the text just sat in the composer. The submit path now retries with Cmd/Ctrl+Enter as a fallback, firing only when the composer still contains the text 300ms after the plain Enter (so normal setups are unaffected). Closes [public#37](#37). - **Telegram questionnaire only rendered in one topic**: multiple-choice questionnaire cards were processed on the global state path, so with several Cursor windows/agents open the card surfaced in just one topic. Questionnaires are now routed per window through `doProcessWindow`, so each agent's questions render in its own topic, with the option labels folded into the change fingerprint to avoid missed updates. Ports [public#40](#40) (thanks @rodrigopavezi). - **Telegram bot token now stored in VS Code SecretStorage** instead of plaintext in `settings.json`. Existing tokens in `settings.json` are auto-migrated into SecretStorage on activation and cleared from settings. Closes [public#33](#33). ### Changed - `/history` now documents its real default of 5 messages, and the setup docs no longer ask for the Telegram "Pin Messages" permission — the bot never pinned. The dead `can_pin_messages` check was also removed from `/sync`. Closes [public#29](#29), [public#30](#30).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The agent questionnaire widget (the multiple-choice Questions card) never appears in Telegram for windows that aren't the active CDP home window.
Root cause: the questionnaire is only pushed to Telegram from the home-window
state:patchpath (onStatePatch→processQuestionnaire). The multi-window monitor path (window:update→doProcessWindow) never carried it:WindowSnapshothad noquestionnairefield, so it was never captured for non-home windows.doProcessWindowfell back to the global home-window questionnaire (stateManager.getCurrentState().questionnaire) when routing per-window, which for a non-home window is either empty (card dropped) or belongs to a different window (card routed to the wrong topic).Changes
questionnaire: Questionnaire | nulltoWindowSnapshotand populate it in both capture paths (captureHomeWindowandpollWindowParallel).questionnaireFingerprint()and include it in the change-detection so a questionnaire appearing, advancing its active question, toggling Continue, or clearing triggers awindow:updateemit.doProcessWindow, process the snapshot's own questionnaire against its resolved thread instead of the global state.Dedup is preserved:
processQuestionnaireForThreadkeys on(threadId, 'questionnaire')with a content hash, so dual-firing with the home-window state-patch path is safe.Test plan
npx tsc --noEmitcleannpm run buildsucceedsnpm test— 109/109 pass, including 5 newquestionnaireFingerprintcases intests/window-monitor-questionnaire.test.ts/syncenabled and confirm the Questions card + inline answer buttons appear in that window's topic