Skip to content

fix(twitter): fail typed when a write command does not go through - #2256

Merged
jackwener merged 2 commits into
jackwener:mainfrom
Benjamin-eecs:fix/twitter-write-exit-codes
Aug 22, 2026
Merged

fix(twitter): fail typed when a write command does not go through#2256
jackwener merged 2 commits into
jackwener:mainfrom
Benjamin-eecs:fix/twitter-write-exit-codes

Conversation

@Benjamin-eecs

@Benjamin-eecs Benjamin-eecs commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Problem

Closes #2255. Fifteen single-target Twitter write commands returned a status: failed row when a write did not happen, so the process still exited 0 and agents could not distinguish success from failure.

A second safety boundary matters once these become errors: after a write click, failure to observe the expected UI state does not prove the server rejected the write. Treating that as a definite CommandExecutionError invites an automatic retry and duplicate likes, follows, blocks, retweets, or posts.

Fix

The adapter now preserves the write phase:

  • Before the final write click — missing controls, menus, confirmation items, unusable composers, or X failure toasts — throw CommandExecutionError because nothing changed.
  • After the final write click — confirmation polling expires, the UI does not switch state, or an exception occurs — return unconfirmed from the page script and throw TimeoutError (exit 75) with a “check before retrying” hint.
  • Already-correct/idempotent states remain success.
  • Batch commands keep per-item partial-result rows.

This applies to post/reply/quote; like/unlike/bookmark/unbookmark; follow/unfollow/block/unblock; retweet/unretweet. Delete and hide-reply keep definite errors for their pre-write failure branches.

Regression coverage

In addition to command-level typed-error tests, three real JSDOM script executions pin the phase boundary across different UI families:

  • direct toggle: Like click with no observed Unlike state → TimeoutError
  • two-step menu: Retweet confirm click with no observed Unretweet state → TimeoutError
  • profile confirmation: missing Block confirmation dialog → CommandExecutionError; confirm click with no observed blocked state → TimeoutError

The DOM helper executes the exact injected browser script with waits collapsed, rather than mocking its returned phase metadata.

Verification

Exact head 74088913:

  • Twitter suite: 43 files / 509 tests passed
  • npm run typecheck passed
  • npm run build passed; manifest 1331 entries
  • typed-error lint: no new violations
  • silent-column-drop gate: no new violations
  • git diff --check passed

@Benjamin-eecs
Benjamin-eecs force-pushed the fix/twitter-write-exit-codes branch from 7fc4826 to bd21761 Compare August 5, 2026 09:18
@Benjamin-eecs
Benjamin-eecs marked this pull request as ready for review August 5, 2026 09:33
Copilot AI lite review requested due to automatic review settings August 5, 2026 09:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Benjamin-eecs
Benjamin-eecs force-pushed the fix/twitter-write-exit-codes branch from bd21761 to 8bd80f3 Compare August 5, 2026 09:45
@Benjamin-eecs Benjamin-eecs changed the title fix(twitter): fail typed when a post, reply or quote does not go out fix(twitter): fail typed when a write command does not go through Aug 5, 2026
@Benjamin-eecs
Benjamin-eecs force-pushed the fix/twitter-write-exit-codes branch 5 times, most recently from a3f474d to 059be42 Compare August 11, 2026 13:58
@jackwener
jackwener force-pushed the fix/twitter-write-exit-codes branch from 059be42 to 3d7c7a6 Compare August 22, 2026 18:52
@jackwener
jackwener merged commit ca25f14 into jackwener:main Aug 22, 2026
11 checks passed
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.

[Bug]: twitter write commands exit 0 when the write did not happen

3 participants