Skip to content

Fix message extraction on Cursor 3.8+ when data-flat-index is absent. - #39

Closed
gilzhaiek wants to merge 1 commit into
len5ky:mainfrom
process-us:fix/cursor-39-message-extraction
Closed

gilzhaiek wants to merge 1 commit into
len5ky:mainfrom
process-us:fix/cursor-39-message-extraction

Conversation

@gilzhaiek

Copy link
Copy Markdown

Cursor 3.8.11+ and 3.9.x render chat messages on
.composer-rendered-message[data-message-role] without [data-flat-index] wrappers, so the extractor always reported messages: 0 and Telegram/web mirroring showed no replies. Fall back to message-role nodes inside .composer-messages-container when flat-index count is zero.

Also resolve Telegram topic windows when the workbench title changes (e.g. project rename or "Extension:" prefix) by matching the workspace folder segment before "(Workspace)".

Adds probe-messages.ts and verify-extraction.ts for CDP diagnostics.

Closes #35

Cursor 3.8.11+ and 3.9.x render chat messages on
.composer-rendered-message[data-message-role] without [data-flat-index]
wrappers, so the extractor always reported messages: 0 and Telegram/web
mirroring showed no replies. Fall back to message-role nodes inside
.composer-messages-container when flat-index count is zero.

Also resolve Telegram topic windows when the workbench title changes
(e.g. project rename or "Extension:" prefix) by matching the workspace
folder segment before "(Workspace)".

Adds probe-messages.ts and verify-extraction.ts for CDP diagnostics.

Closes len5ky#35

Co-authored-by: Cursor <[email protected]>
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).
@len5ky

len5ky commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Thanks Gil — this was the right approach and it's the base of what shipped in v0.1.47 (you're credited as co-author). We tightened a few edges while porting: mixed DOMs where some wrappers still carry flat-index, DOM-order fallback indices instead of everything collapsing to 0, data-message-id-based identity, and the shimmer/activity scopes. The Telegram topic change and the two diagnostic scripts didn't make it into this port — the scripts hardcode a CDP target, but a parameterized version would be welcome as a separate PR. Closing since the port shipped; thanks again.

@len5ky len5ky closed this Jul 7, 2026
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chats are empty in web client with version Cursor 3.8.11

2 participants