Skip to content

feat(domain-skills/x): X.com post domain skill#167

Open
miladnoo wants to merge 3 commits intobrowser-use:mainfrom
miladnoo:x-pr-clean
Open

feat(domain-skills/x): X.com post domain skill#167
miladnoo wants to merge 3 commits intobrowser-use:mainfrom
miladnoo:x-pr-clean

Conversation

@miladnoo
Copy link
Copy Markdown

@miladnoo miladnoo commented Apr 23, 2026

Summary

  • domain-skills/x/x_post.py — post text + image(s) and/or video(s) to X.com
  • domain-skills/x/post.md — full documentation
  • SKILL.md — updated to list the new domain skill

Features

  • Single or multiple images — auto-detected by extension, or use img: prefix
  • Video with auto H.264 conversion — non-H.264 video is converted via ffmpeg before upload
  • Mixed media — images + video in one post, sequential upload
  • Explicit type overrideimg: or vid: prefix when extension isn't reliable
  • JS click on Post button — coordinate click fails after media attachment (X re-renders button position)
  • Polling loop — waits for aria-disabled != 'true' to handle slow video processing

Test Results

All three modes verified on X.com:

  • Image only ✅
  • Video only ✅
  • Image + Video mixed ✅

🤖 Generated with Claude Code


Summary by cubic

Adds an X.com posting domain skill to publish text with image(s) and/or video via the browser harness. Includes domain-skills/x/post.md and updates SKILL.md to list the skill.

  • New Features

    • Post text with images and/or video; supports multiple and mixed media with auto-detect and img:/vid: overrides.
    • Converts non-H.264 video to H.264/AAC (ffmpeg); uses JS click + polling until Post is enabled to handle video processing.
  • Bug Fixes

    • Detects ffmpeg conversion failures (check=True) and avoids returning bad temp paths.
    • Always cleans up converted temp files, including early-return paths (wrapped in try/finally), with an atexit safety net.

Written for commit 6655b39. Summary will update on new commits.

Post text + image(s) and/or video(s) to X.com:
- Single or multiple images via upload_file()
- Video with auto H.264 conversion (ffmpeg)
- Mixed media (images + video) in one post
- Explicit type prefixes: img:/vid: or auto-detect from extension
- JS click on Post button (coordinate click fails after media attachment)
- Polling loop for button enabled state (handles slow video processing)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@browser-harness-review
Copy link
Copy Markdown

browser-harness-review Bot commented Apr 23, 2026

✅ Skill review passed

Reviewed 3 file(s) — no findings.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="domain-skills/x/x_post.py">

<violation number="1" location="domain-skills/x/x_post.py:66">
P2: Converted H.264 temp videos are never deleted after use, causing orphaned `.mp4` files to accumulate.</violation>

<violation number="2" location="domain-skills/x/x_post.py:70">
P1: ffmpeg failures are not detected; the temp output path is returned even when conversion fails.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread domain-skills/x/x_post.py
Comment thread domain-skills/x/x_post.py
P1: Add check=True to ffmpeg subprocess — failures now raise instead of
    returning the temp path when conversion fails.
P2: Track converted temp files in _TEMP_FILES list, clean up after post
    completes via _cleanup_temp_files(). Also registered atexit handler
    as safety net for script exit.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="domain-skills/x/x_post.py">

<violation number="1" location="domain-skills/x/x_post.py:212">
P2: Temp video files can leak on early-return failure paths because cleanup only runs after a successful post.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread domain-skills/x/x_post.py
Wrap post_to_x body in try/finally so _cleanup_temp_files() runs
regardless of which return path is taken — success, compose not found,
or button timeout. Previously only the success path cleaned up.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@qodo-ai-reviewer
Copy link
Copy Markdown

Hi, domain-skills/x/x_post.py inserts domain-skills/ into sys.path but imports helpers/admin from repo root, so running or importing this file commonly fails with ModuleNotFoundError.
This prevents the skill from executing in the default script/module usage shown in the docs.

Severity: action required | Category: correctness

How to fix: Insert repo root to sys.path

Agent prompt to fix - you can give this to your LLM of choice:

Issue description

domain-skills/x/x_post.py modifies sys.path incorrectly, causing from helpers import * / from admin import ensure_daemon to fail when the script is executed or imported in common ways.

Issue Context

  • helpers.py and admin.py are located at the repository root.
  • The skill file is located at domain-skills/x/x_post.py.

Fix Focus Areas

  • domain-skills/x/x_post.py[32-35]

Proposed fix

  • Change the inserted path to the repository root (e.g., SKILL_DIR.parents[2] or SKILL_DIR.parent.parent.parent) and preferably use resolve().
  • Consider avoiding import * and importing only what is needed for clarity.

We noticed a couple of other issues in this PR as well - happy to share if helpful.


Found by Qodo. Free code review for open-source maintainers.

@qodo-ai-reviewer
Copy link
Copy Markdown

Hi, post_to_x passes media paths directly to upload_file, but helpers.upload_file expects absolute file paths for DOM.setFileInputFiles. Passing relative paths (common in CLI usage) will cause uploads to fail at runtime.

Severity: action required | Category: reliability

How to fix: Resolve media paths to absolute

Agent prompt to fix - you can give this to your LLM of choice:

Issue description

upload_file() requires absolute paths but x_post.py forwards raw user inputs.

Issue Context

Users often pass ./file.png or ../video.mp4.

Fix Focus Areas

  • domain-skills/x/x_post.py[140-177]

Suggested approach

Before splitting into images/videos and before _ensure_h264, normalize each m["path"] via Path(path).expanduser().resolve() (and possibly validate existence) so upload_file() always receives an absolute path.

We noticed a couple of other issues in this PR as well - happy to share if helpful.


Found by Qodo code review. FYI, Qodo is free for open-source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants