fix(doubao): adapt to 2026-07 DOM refactor#2133
Open
RusianHu wants to merge 1 commit into
Open
Conversation
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>
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.
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.