Repository navigation
Conversation
xiaohongshu read flattened OpenCLI's {field, value} rows into one note only
when the output was a bare list. OpenCLI 2.0 wraps them as
{"ok": true, "data": [...]}, so read returned ok with every unified
field null and the note body only inside raw. An empty envelope was also
turned into a success item built from the envelope itself.
Unwrap the envelope before flattening, so both shapes give one note item and
an empty result is reported as NOT_FOUND.
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.
Fixes #844.
agent-reach xiaohongshu read <note link>returnedok: truewithtitle,author,published_atandtextallnull, and the note body only insideraw. In_opencli_readthe{field, value}rows are flattened into one note only whenopencli_callreturns a bare list. OpenCLI 2.0 returns{"ok": true, "data": [...]}, so that branch never ran and each row was turned into its own empty item.The fix unwraps
datawhen it is a list, before the existing check, so both shapes produce the single note item the code was written to produce (title,author,textfromcontent, andurlset to the link passed in). This also fixes a second case in the same spot: an envelope with an emptydatalist is falsy, soopencli_itemsfell through to building an item from the envelope itself and reported success; it now reportsNOT_FOUND. The change is inagent_reach/channels/xiaohongshu.pyonly (three lines).New
tests/test_xiaohongshu_read.pycovers the bare list (it passed before), the envelope from the issue, and the empty envelope. The envelope and empty-envelope cases fail without the change.Checks, from CONTRIBUTING:
pytest(477 passed, 2 skipped),ruff check agent_reach testsandmypy agent_reachall pass, on Windows with Python 3.13.Not done: the live check. CONTRIBUTING asks for
agent-reach check xiaohongshu --textoutput for a changed channel. I could not run one: I have no Xiaohongshu login and no OpenCLI 2.0 browser session, so this is verified against the exact output shape quoted in the issue, not against a real note. I did not touch the README or the changelog.