jackwener / jackwener/OpenCLI

[autofix] xiaohongshu/publish: COMMAND_EXEC

Open
#2,413 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
29.3k
Forks
2.9k
Avg merge
15h 36m
Merged PRs (30d)
70

Description

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

## Adapter
- Site: `xiaohongshu`
- Command: `publish`
- OpenCLI version: `1.8.7`

## Original failure
- Error code: `COMMAND_EXEC`

```
Image injection failed: Page.fileChooserOpened not received within 5s — the input may not have opened a file chooser.
```

Reproduced 4 out of 5 consecutive `publish --draft --images <5 local jpg paths>` calls (one other attempt failed with a related `Detached while handling command` error). `opencli doctor` reported daemon/extension healthy throughout; daemon restart + extension re-wake did not resolve it. Confirmed via `--trace retain-on-failure` trace summary that the failure is not selector/DOM related — `uploadImages()` in `clis/xiaohongshu/publish.js` calls the primary CDP path `page.setFileInput(absPaths, selector)`, which appears to intermittently race/timeout waiting for a `Page.fileChooserOpened` CDP event (this error string does not appear anywhere in the `@jackwener/opencli` package itself, so the wait/timeout logic lives in the browser extension's CDP bridge, not in this adapter file).

The adapter's existing `catch` block only falls through to the legacy base64 `DataTransfer` upload method when the error message matches `'Unknown action'`, `'not supported'`, or `'Not allowed'` (i.e. only for "extension too old"). A `Page.fileChooserOpened` timeout doesn't match any of those, so it hard-fails instead of degrading to the reliable fallback.

## Local fix summary

```
Broadened the fallback condition in uploadImages() (clis/xiaohongshu/publish.js) to also
match `fileChooserOpened` in the caught error message, so a flaky/timed-out primary CDP
file-input path falls through to the existing legacy base64 DataTransfer upload instead of
failing the whole publish call. Verified: same 5-image draft publish that failed 4/5 times
on the primary path now succeeds via the fallback (confirmed via `xiaohongshu drafts`).
```

_Issue filed by OpenCLI autofix after a verified local repair._

Contributor guide

Open the contributing guide

Research direction

Start in clis/xiaohongshu/publish.js, focusing on uploadImages() and its existing catch block. Reproduce the issue with publish --draft --images using five local JPG paths, then verify that a Page.fileChooserOpened timeout uses the existing fallback and that the draft publish succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.