Skip to content

fix: authenticate the x.com bootstrap fetch so transaction IDs work again - #85

Closed
nmmanas wants to merge 1 commit into
public-clis:mainfrom
nmmanas:fix/client-transaction-cookie-bootstrap
Closed

fix: authenticate the x.com bootstrap fetch so transaction IDs work again#85
nmmanas wants to merge 1 commit into
public-clis:mainfrom
nmmanas:fix/client-transaction-cookie-bootstrap

Conversation

@nmmanas

@nmmanas nmmanas commented Aug 10, 2026

Copy link
Copy Markdown

Symptom

twitter search (and anything else hitting SearchTimeline or the 1.1 auth-verification endpoints) returns 404, with this in the log:

Failed to init ClientTransaction: 'NoneType' object has no attribute 'group'

No request carries an x-client-transaction-id.

Cause

_ensure_client_transaction fetches https://x.com without cookies. Logged out, x.com now serves the new "x-web" shell (entry-client-logged-out-*.js), whose HTML carries no ondemand.s chunk map. get_ondemand_file_url() matches nothing, so ClientTransaction never initializes.

Fix

Send the session cookies on that one bootstrap fetch. The logged-in responsive-web shell still ships the chunk map. The ondemand.s file itself is fetched from the CDN and stays cookie-free, and bootstrap failure remains non-fatal.

Verification

  • New regression test in tests/test_client.py — confirmed it fails without the source change (verified by stashing it).
  • Full suite: 242 passed + 3 new. ruff check clean, mypy clean across 18 files.
  • Live against x.com after pipx install --force --editable .: twitter search "vibe coding" --from levelsio returns results; whoami, user-posts, tweet, bookmarks all still work. Log line flips to ClientTransaction initialized for x-client-transaction-id.

…gain

_ensure_client_transaction fetched https://x.com without cookies. Logged
out, x.com now serves the new "x-web" shell (entry-client-logged-out-*.js),
whose HTML carries no `ondemand.s` chunk map — so get_ondemand_file_url()
matches nothing, ClientTransaction never initializes, and no request ever
carries an x-client-transaction-id. Endpoints that require one (notably
SearchTimeline, and the 1.1 auth-verification endpoints) answer 404.

Sending the session cookies on that one fetch returns the logged-in
responsive-web shell, which still ships the chunk map. Verified against
live x.com: `twitter search` returns results, and the log line goes from
"Failed to init ClientTransaction: 'NoneType' object has no attribute
'group'" to "ClientTransaction initialized for x-client-transaction-id".

The ondemand.s file itself is fetched from the CDN and stays cookie-free.
Bootstrap failure remains non-fatal.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@nmmanas

nmmanas commented Aug 10, 2026

Copy link
Copy Markdown
Author

Closing as a duplicate. Same root cause as #74 / #79 / #71 / #80, and this one takes the root-URL-plus-cookies shape that #71 already explored, so it adds a second change (auth cookies on an HTML bootstrap fetch) that the path-only fix in #74 shows is unnecessary.

My verification data is on #74 (#74 (comment)) — it crosses the two variables and confirms either axis alone is sufficient, which points at #74 as the minimal correct fix. No action needed here.

@nmmanas nmmanas closed this Aug 10, 2026
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.

1 participant