Skip to content

[autofix] xiaohongshu/search: EMPTY_RESULT — page.evaluate envelope not unwrapped #1500

@smallfoolh

Description

@smallfoolh

Summary

OpenCLI autofix repaired this adapter locally, and the retry passed.

Adapter

  • Site: xiaohongshu
  • Command: search
  • OpenCLI version: 1.7.18

Original failure

  • Error code: EMPTY_RESULT (silent — exit 0 with [], no error envelope)

The adapter at clis/xiaohongshu/search.js returns [] for every query, including queries that visibly have results in a logged-in Chrome tab. opencli xiaohongshu feed (intercept-mode) works fine in the same browser, ruling out auth/session issues.

Root cause

page.evaluate() returns the daemon exec envelope { session, data }, not the raw evaluated value. The adapter compares/iterates it directly:

  • if (waitResult === 'login_wall') — never true because waitResult is {session, data: 'login_wall'}, so an actual login wall would be silently mis-classified.
  • Array.isArray(payload) — always false because payload is {session, data: [...items...]}, so the 10+ extracted items fall through to the [] fallback.

Secondary issue: WAIT_FOR_CONTENT_JS resolves on the first section.note-item element, but xiaohongshu's virtual list renders section shells before their inner titles populate, racing autoScroll/extract against lazy fill-in. The trace-time state snapshot looks healthy because it's captured after the extract returned empty.

Local fix summary

  1. Added an unwrap(v) helper that returns v.data when v looks like the {session, data} envelope, else v (tolerant of any pre-envelope return shape).
  2. Applied it to both page.evaluate(WAIT_FOR_CONTENT_JS) and page.evaluate(buildSearchExtractJs(...)).
  3. Tightened WAIT_FOR_CONTENT_JS to require ≥3 section.note-item elements with non-empty title text, with timeout raised 5s → 8s.

Verified locally: opencli xiaohongshu search "龙虾电脑" --limit 10 now returns 10 results.

Issue filed by OpenCLI autofix after a verified local repair.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions