sept13-yu's bisect on #709 (2026-11-05): with the plugin's own headers
and body ({"req_source":1}), the same token and account, seconds apart,
only x-device-id changed, the account's own 16-digit id got 9074 and a
15-digit one (a random, never-registered one too) was taken. Three
accounts, two machines on two ISPs, magpie's headers and wild-work's
alike: 16 refused every time, 15 taken every time. Every account signed
in since 0.2.16 has a 16-digit id and ugDevice sent it as it was, so
every client-less account's first claim got 9074. 0.2.29's second claim
uses trae-mate's 15-digit uid-derived id, which is likely why it lands.
ugDevice (only used for the ug pages, status and claim, of a trae-cn
account no local client is signed in as) now keeps an id that is
already 15 digits and otherwise makes a 15-digit one from the account's
own device id and uid: the same derivation it used for pre-0.2.16
19-digit ids, now modulo 9e14 with a 1e14 floor, so the first digit is
never 0 (shapeDevice can start with 0, which as a number is 14 digits).
Stable per account, changes only with a new sign-in, never another
account's.
Left alone, and why:
- newDevice stays 16 digits. That id is registered at sign-in, sent on
every chat request and bound into the renewed JWT; nothing measured
says chat or renewal want 15, and the bisect showed registration
doesn't matter for the claim.
- An account whose local Trae CN client is signed in as it keeps the
client's own device (the bisect didn't touch that path).
- Trae Global: no check-in, 19 digits as before.
- 0.2.29's one extra claim in clientShapeHeaders after a 9074 stays as
the fallback: the bisect never sent that request with a 16-digit id,
so "nothing but the id matters in it" isn't measured. It costs one
claim on a 9074 day only.
Run (mote, bun): packages/trae bun test, 240 pass 0 fail; bun
scripts/check.mjs, 44 packages ok.
Broken by hand: the old index.mjs under the new tests on mote, 11 red,
among them the new "signed in since 0.2.16 (16 digits) checks in on a
15-digit id" test and the request-header tests. Golden ids
(166487253502651, 245914665436526) worked out by a separate Python port
of the derivation, which also reproduces the old 2866487253502651.
Not tried: a real Trae CN account check-in (no account here); whether
the chat or renewal care about the id length.
XcodeFish's A/B on one account (#194): with the same Cloud-IDE-JWT,
headers and body, Trae CN answered a claim 9074 on the plugin's
19-digit x-device-id and took it (code 0, +100) on a 16-digit one.
The IDE's own id is server-issued: Trae's main process registers at
log.snssdk.com/service/2/desktop/device_register (read in Trae.app's
out/main.js, iCubeDeviceRegisterMainService). Real clients keep it as
iCubeAuthInfo://icube-dc:<id>, and the ids seen in #808 and #1705 are
15 or 16 digits.
- A new Trae CN sign-in names a 16-digit device_id. Trae Global keeps
19 digits, since nothing says its ids are shaped otherwise.
- ugDevice: a check-in from an account the local client isn't signed
in as goes on the account's own id when that is 15 or 16 digits.
Otherwise (19 digits, signed in before 0.2.16) it goes on a 16-digit
id hashed from that account's device id and uid. The id is the same
on every check-in, never rotated and never another account's. A 9095
is still the day's answer. Chat pages and the renewal keep the
device the account signed in with.
- README: the Sign-in and Daily check-in sections say this.
Run:
- bun test packages/trae: 151 pass, 0 fail. Breaking it by hand: with
the ugDevice line removed, 7 tests fail; with newDevice back to
digits(19), 4 fail.
- bun scripts/check.mjs: ok.
- magpie's plugin host (origin/main 7660399a1, sandbox HOME), with the
plugin's web/auth hosts pointed at a local fake:
- signed in on 0.2.15 (device 9375744633732288271), claim on 19 digits;
- added 0.2.16 over it: status/claim/claim all went on 2849759837088686,
and the pay page kept 9375744633732288271;
- a new 0.2.16 sign-in named 2348824360597085 (16 digits) and used it
for check-in and chat.
- Not tried against the real api.trae.cn; there are no real accounts
here. The 16-digit claim being taken is the reporter's measurement.
Trae CN's check-in answered magpie with 9074 「当前参与用户太多,请稍后再试」
every time: whqtian's three accounts never got in (the fourth only when
checked in by hand in Trae), Moody-Sin's never did. magpie retried every
30 minutes and got 9074 again. The plugin sent the check-in with Bun's own
User-Agent (Bun/1.x), the chat's headers (x-uid, x-ide-token, versions…)
and {}. Trae CN's IDE 3.3.104 (main.js, read from the official linux
build) sends /trae/api/v2/ug/checkin_credits/status and /claim with only
its Cloud-IDE-JWT and its device (fb: x-device-id, x-device-brand,
x-device-type, x-os-version, x-app-version) through its own client, body
{req_source: 1}; qilimixingkong/trae-checkin found that a check-in without
a real client's User-Agent is taken for a script and answered 9074. A
growth page (/trae/api/v2/ug/…) now goes with those headers, a TRAE SOLO
CN Electron User-Agent and {req_source: 1} for an empty body; Trae's
other pages still go with the chat's headers. 0.1.7 tried the IDE's
headers and body without a User-Agent and was put back in 0.1.9; the
User-Agent is what neither had. No device id is changed to get round a
9074 or a 9095. No Trae CN account was at hand, so it isn't tried
against a real one: api.trae.cn answers the new request without a token
with its usual 1001. checkin.test.mjs checks the body, the IDE's headers,
the User-Agent and none of the chat's (fails on 0.2.0), a body given as
is, and Trae's other pages unchanged; bun test (66) and
bun scripts/check.mjs trae pass.