[Bug]: Xiaohongshu search fails with ambiguous_option on duplicated overlapping filter options
Description
In OpenCLI v1.8.8, opencli xiaohongshu search can fail before result extraction with ambiguous_option on an affected Xiaohongshu search-page render.
The current findOption() implementation expects exactly one visible .tag-container > .tags element for each requested option. In the observed page, Xiaohongshu generated two overlapping elements for the same visible 综合 filter option. Both had the same active state and identical position and size, so a user still saw one option, but OpenCLI treated options.length === 2 as an ambiguous layout and stopped the command.
This code path also runs when no filter flags are supplied because resolveSearchFilters() currently includes the default value for all five filter groups.
Steps to Reproduce
Use an existing logged-in Xiaohongshu browser session.
Run:
opencli xiaohongshu search "OpenAI" --limit 2 -f json \ --window background --site-session ephemeral --keep-tab falseOn a page render containing the duplicated overlapping option, the command exits before extracting results.
Deterministic Reproduction
To remove dependence on live-page timing, I reproduced the same condition in a detached worktree at tag v1.8.8. I changed only the test fixture: it renders two visible .tags active nodes for 排序依据/综合, each with the same text and the same rectangle (left: 0, top: 0, width: 100, height: 100), then runs a default search.
With the unmodified v1.8.8 production code, the regression test fails with:
CommandExecutionError: Xiaohongshu search filter layout did not match the expected visible panel (ambiguous_option).
Tests 1 failed | 64 skipped (65)With the local fix, the same test passes. The complete Xiaohongshu search test file also passes (65/65), including the existing fail-closed case where the second matching option is at a different position.
Expected Behavior
Multiple page elements that represent the same visible filter option—with the same text, active state, position, and size—should be handled as one logical option.
Matches at different positions or with different active states should continue to fail closed as genuinely ambiguous.
OpenCLI Version
1.8.8
Node.js Version
Other — v24.19.0
Operating System
macOS
Logs / Screenshots
ok: false
error:
code: COMMAND_EXEC
message: Xiaohongshu search filter layout did not match the expected visible panel (ambiguous_option).
exitCode: 1Diagnostic inspection found two matching 综合 elements with the same tags active state and identical bounding rectangles. No cookies, tokens, or account-specific data are included here.
Related Work
The filter handling was introduced by #2276, which completed #903.
I have a small local fix and regression test that treat only overlapping matches with the same active state as one logical option, while preserving the existing failure for genuinely distinct matches. With that change, both the default search and --sort latest succeed against the same logged-in session. The full local test suite passes: 631 files, 7317 tests, 1 skipped.
Source: jackwener/OpenCLI