Skip to content

fix(api): restore search after x.com renamed the transaction id middleware header - #2755

Merged
dangeredwolf merged 4 commits into
FxEmbed:mainfrom
alexandrxiong:fix/x-client-transaction-id
Nov 24, 2026
Merged

dangeredwolf merged 4 commits into
FxEmbed:mainfrom
alexandrxiong:fix/x-client-transaction-id

Conversation

@alexandrxiong

@alexandrxiong alexandrxiong commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem

/2/search answers {"code":404,"results":[]} again for every query, on api.fxtwitter.com and on self-hosted instances alike (same symptom as #2303). Each request logs Error generating transaction ID: Error: Couldn't get on-demand file index before any GraphQL call is made; on our self-hosted instance the first occurrence was on 2026-11-20.

The hashed-chunk lookup from #2701 still finds the right module, but it keys on the x-botox-client-transaction-id string, and x.com no longer ships it. On the logged-out page fetched on 2026-11-21, the entry (entry-client-logged-out-BfJ4Z7Ze.js) statically imports four modules and none of them contains the old name. The middleware module (assets/CitZFE1G.js) now registers x-client-transaction-id and still lazy-loads the generator via import(`./ohfgT4dS.js`).then(e=>e.default()). The generator chunk itself is unchanged and parses to key-byte indices 10,36,4,24.

Solution

Match client-transaction-id, which covers both the old and the new header name. Another statically imported module also mentions x-client-transaction-id without the lazy generator import (as DFhr1Vbc.js already does in the saved fixtures); the existing if (!chunk) continue skips it. The JSDoc is updated to match.

Tests

  • New case in test/clientTransaction.test.ts: the saved middleware fixture with x-botox-client-transaction-id renamed to x-client-transaction-id. It is served under a fresh entry and chunk name, because cachedFetch would otherwise return the copy cached by the happy-path test. Without the change it fails with Couldn't get on-demand file index; with it the indices 0,13,31,41 are extracted.
  • npx vitest run: 72 files, 479 tests passed. npx prettier --check and npx eslint --max-warnings=0 pass on both changed files.
  • Live: against the current logged-out x.com, ClientTransaction.create() plus generateTransactionId('GET', '/i/api/graphql/abc/SearchTimeline') throws on main and returns an id with this change. A self-hosted instance running 0f08128 with this change applied serves /2/search results again.

Summary by CodeRabbit

  • Bug Fixes
    • Transaction initialization now works with both the legacy and current transaction header names, including on logged-out x.com pages.
    • The current header is recognized when transaction indices are extracted, preserving expected behavior across renamed middleware modules.

…ing the generator chunk

x.com no longer ships the `x-botox-client-transaction-id` string: the middleware
module the logged-out entry statically imports now registers
`x-client-transaction-id`. The hashed-chunk scan keyed on the old name, found no
module, and ClientTransaction init threw "Couldn't get on-demand file index", so
/2/search answered 404. Match `client-transaction-id`, which covers both names;
modules that only mention the header without the lazy generator import are still
skipped by the existing `if (!chunk) continue`.
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1dc4bcdd-68df-48fc-af34-3ca86ee9ae57
Commits

Reviewing files that changed from the base of the PR and between 52572a5 and def27c9.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The transaction middleware scan now recognizes modules with either x-botox-client-transaction-id or x-client-transaction-id. A test verifies that ClientTransaction.create() extracts indices when the newer header name is present.

Changes: Transaction Header Recognition

Layer / File(s) Summary
Recognize transaction header names
packages/atmosphere/src/providers/twitter/proxy/transaction/transaction.ts, test/clientTransaction.test.ts
The middleware scan matches the shared client-transaction-id text. The test checks that initialization extracts indices 0,13,31,41 when the newer header name is used.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: junmo-kim

Merge Risk: Minimal · previous review 240a3

This restores transaction ID generation after the upstream header rename, so /2/search should work again. The change is small and reversible, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: restoring search after x.com renamed the transaction id middleware header. The changeset matches both the old x-botox-client-transaction-id and the new x-client-transa…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: restoring search after x.com renamed the transaction id middleware header. The changeset matches both the old x-botox-client-transaction-id and the new x-client-transaction-id header names in indicesFromXWebSign, updates its JSDoc, and adds a regression test for the renamed layout. The title uses the conventional fix(api) prefix and is specific enough for a teammate scanning history. The title is 81 characters, which is slightly longer than ideal but still readable.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the header line
Both names now pass the scan just fine
The indices appear in place
A test confirms the newer case
Then hops away at a steady pace

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ee759064-95ff-42b7-82df-f6c87c724f0f
Commits

Reviewing files that changed from the base of the PR and between 44ae3f2 and 240a34c.

Files selected for processing: 2

  • packages/atmosphere/src/providers/twitter/proxy/transaction/transaction.ts
  • test/clientTransaction.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@greptile-apps

greptile-apps Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Restores transaction discovery after X renamed its middleware header.

  • Transaction lookup finds the generator after x.com renames its header.

Reviews (4) · Last reviewed commit: "Merge branch 'main' into fix/x-client-tr..." · Reviewed by Greptile

@dangeredwolf
dangeredwolf merged commit 8a21750 into FxEmbed:main Nov 24, 2026
5 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.

2 participants