fix(doubao): adapt to 2026-07 DOM refactor - #2133
Conversation
|
Reviewed for the low-risk PR sweep. I am not treating this as rejected, but I would defer it from this merge batch. This is adapter-local and the selector direction may be right, but the claimed breakage/fix depends on current logged-in Doubao UI evidence. The branch currently has no reported GitHub checks and does not add regression fixtures for the new Recommended disposition: keep open/defer until someone can attach current live trace evidence or DOM fixtures and add focused tests for the new selectors/history/detail behavior. I would not merge it solely from the PR description. |
Doubao's 2026-07 web refactor removed data-testid attributes and changed several CSS class names, breaking the doubao adapter (ask/read/detail/ history all failed). Update selectors and relax the visibility check so the adapter works against the current DOM. - Composer: prepend `textarea.semi-input-textarea` and `textarea[placeholder*="发消息"]` (Semi Design textarea; data-testid removed) - isVisible (composer + getTurnsScript): relax width>0. The browser bridge runs on a 0x0/background tab where elements have zero width but are still present and usable; require height>0 (composer) or drop the size check (message turns) - getTurnsScript: add `[class*="list_items"]` to message-list selectors so messages are read via structured turns instead of the noisy transcript - getTranscriptLinesScript: scope to the main chat area (sidebar's sibling) and strip header/input-area/follow-up chips so the transcript fallback stays clean - getConversationListScript (history): sidebar via left-side-/w-sidebar-width, thread items via `a[href*="/chat/"]` - getConversationDetail (detail): reuse getDoubaoVisibleTurns; the old data-testid-based detail script is fully stale - prepareDoubaoComposerScript: include viewport/url/textarea details in the failure reason to aid future debugging Verified end-to-end on opencli v1.8.6 against current doubao web: status, history, detail, read, new, ask all pass; ask returns a clean response with no sidebar/follow-up noise. Existing doubao unit tests (32) and tsc --noEmit pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Add 'div.tiptap.ProseMirror' composer selector: the /chat/ new-thread
page now renders a tiptap ProseMirror editor instead of the Semi
textarea (verified live 2026-08-31, fixture included).
- sendDoubaoMessage: when no clickable send button is found, dispatch a
synthetic KeyboardEvent('Enter') on the composer before falling back
to native keys. The new composer's send control is a
div.send-btn-wrapper with no button/[role=button] semantics, and CDP
key events do not reach the tiptap keymap; the synthetic dispatch is
verified to submit on the live site.
- getConversationDetail: prefer the legacy detail script (keeps meeting
info wherever it still works) and only fall back to
getDoubaoVisibleTurns when it returns no messages.
- Tests: JSDOM coverage for the ProseMirror submit path, the submit
strategy order, and the detail fallback; live-captured composer
fixture.
ae1d4f3 to
ad94659
Compare
…ms, sidebar) Export getConversationListScript and DOUBAO_COMPOSER_SELECTORS via __test__ and add focused tests: composer selector coverage (Semi textarea + ProseMirror), the 2026-07 list_items turns container, and sidebar resolution via left-side-/w-sidebar-width classes with a[href*="/chat/"] (including the legacy testid-only sidebar returning empty).
|
Updated the branch with 2026-08 live evidence and the review asks: 1. Current logged-in doubao.com evidence (2026-08-31, all verified live)
2. Regression tests added (vitest + JSDOM, 38/38 green)
3. detail behavior change made legacy-first Note: I also verified the 2026-08 ProseMirror + synthetic-Enter behavior end-to-end outside the adapter (image-edit/generation flows driven through the browser bridge today), so the mechanism is not speculative. |
|
Closing this as superseded — @jackwener's defer call aged well. Live re-verification on 2026-09-01 (logged-in doubao.com) disproved this branch's core mechanism: What changed since the 2026-08-31 update
What survived, and where it went Two of the findings from re-testing this area were real and are now folded into #2447 instead of kept here:
Thanks for the review push on evidence-first fixtures — the fixtures/tests added here died with the mechanism they pinned, which is itself a data point on how fast this site churns. The live-verified versions of both ideas are in #2447 with 2026-09-01 evidence. |
Problem
The doubao adapter is broken against Doubao's 2026-07 web refactor:
ask,read,detail, andhistoryall fail. The refactor removeddata-testidattributes and renamed several CSS classes, so the adapter's selectors no longer match.Symptoms on opencli v1.8.6:
doubao ask→Could not find Doubao input element(composer selector stale)doubao read→No visible Doubao messages were found(message-list selector stale)doubao history→No conversation history found(sidebar selector stale)doubao detail→No messages found. Verify the conversation ID.(detail script stale)Root cause
<textarea class="semi-input-textarea">with placeholder发消息或按住空格说话...;data-testid="chat_input_input"was removed.list_items(previously matched via[class*="message-list-"]etc.).data-testid="flow_chat_sidebar"/chat_list_thread_itemremoved; sidebar now usesleft-side-/w-sidebar-widthclasses, thread items area[href*="/chat/"].getBoundingClientRect().width === 0for every element, soisVisible'swidth > 0 && height > 0rejected everything — including the composer and message items that are nonetheless present and usable/readable.Changes (
clis/doubao/utils.js)textarea.semi-input-textareaandtextarea[placeholder*="发消息"].isVisible(composer +getTurnsScript): relaxwidth > 0. In a 0x0/background tab elements have zero width but are still present and readable; requireheight > 0(composer) or drop the size check (message turns).display:none/visibility:hidden/hiddenare still filtered.getTurnsScript: add[class*="list_items"]to message-list selectors so messages are read via structured turns (clean) instead of falling back to the noisy transcript.getTranscriptLinesScript: scope to the main chat area (sidebar's sibling) and strip header (title + disclaimer), input area (buttons), and follow-up suggestion chips, so the transcript fallback stays clean.getConversationListScript(history): sidebar via[class*="left-side-"], [class*="w-sidebar-width"], thread items viaa[href*="/chat/"].getConversationDetail(detail): reusegetDoubaoVisibleTurns; the olddata-testid-based detail script is fully stale.prepareDoubaoComposerScript: include viewport/url/textarea details in the failure reason to aid future debugging.Verification
End-to-end on opencli v1.8.6 against current doubao web (2026-07):
doubao statusdoubao historydoubao detail <id>doubao readdoubao newdoubao ask "1加1等于几?请只回答数字"2, no noisenpx vitest run clis/doubao/)npx tsc --noEmit: passNotes
isVisible, so it should not affect other adapters.