witt-bit (yetone/magpie#2911, 10-22): after Qoder CN's update moved its
daily 100 Credits into the desktop's 权益中心, magpie's Qoder CN check-in
stopped working; Andrew0767 (#304) sees the same with Qoder desktop
installed. The plugin sent Qoder CN's campaigns pages no device identity
at all ("Qoder CN does not need this local helper").
What Qoder CN's clients do, read from their own packages:
- Qoder CN desktop 0.4.9 (the .deb's out/main): its requests carry
Cosy-ClientType 10 and, through createAuthorizedHeaders, the identity
from <resources>/umid/runtime-info run with environment
`regionCode === "global" ? 3 : 0`, i.e. 0 for Qoder CN, the uid on
stdin (--account-stdin) on macOS and Windows. Campaigns are found
through GET /sash/api/v1/me/notifications (hasClaimableCampaign,
campaignPopupUrl). When the identity can't be read it sends the
request without it (resolveMachineIdentity's catch returns null).
- qoderclicn (@qodercn-ai/qoderclicn 1.1.64, 1.1.70, 1.1.73):
campaigns.list is GET /sash/api/v1/me/campaigns, needing the UMID from
1.1.64 and requireMachineIdentity() from 1.1.70, UMID environment
ONLINE = 0; its config dir is QODERCN_CONFIG_DIR, else QODERCN_CLI_HOME
(or home) + QODERCN_CONFIG_DIR_NAME (or .qoder-cn), and it caches the
helper in <config>/.bin/runtime-info-<platform>-<arch>-<hash>.
- Install places: Qoder CN.app/Contents/Resources/umid/runtime-info
(seen inside Qoder-CN-Installer-mac-arm64.zip's payload, 0.4.9),
/opt/Qoder-CN/resources/umid/runtime-info (the .deb), and on Windows
umid/runtime-info.exe among Qoder-CN-win-x64-user.exe's owned files,
with "Uninstall Qoder CN.exe" (electron-builder's
%LOCALAPPDATA%\Programs\<productName>; the folder itself not seen).
The plugin now keeps a runtime per site (RUNTIMES): Qoder CN reads its own
helper (those paths, its CLI's folders, QODERCN_RUNTIME_INFO, never the
international Qoder's) with environment 0, and sends Cosy-MachineToken and
Cosy-MachineType on the list, the claim and the campaigns proxy. As the
desktop does, a Qoder CN request without a readable identity still goes
out, so an account that was claiming without Qoder CN installed (0.2.21's
live PAT claim) keeps doing so. When such a list offers no daily claim,
the check-in is ineligible for the day, saying to install Qoder CN desktop
or sign in to its CLI (no helper), or failed and asked again (a helper that
didn't answer), instead of "inactive". International Qoder is unchanged.
Run: in packages/qoder, TMPDIR=$H HOME=$H/home bun test: 195 pass, 0 fail.
On the old index.mjs the new tests are 9 red (checkin.test.mjs 5 lookup
tests and the env-0 proxy test, native-checkin.test.mjs the env-0 claim,
the ineligible and the failed cases). Repo root at this commit
(rebased on 26e3e5f): 2151 pass, 1 skip, 0 fail; bun scripts/check.mjs ok.
Not tried: a real Qoder CN account (none available) or a real Qoder CN
install, so whether Qoder CN now hides the daily claim from a request
without the identity is inferred from its clients, not seen on the wire;
the Windows install folder is electron-builder's default, not seen; the
desktop's own claim happens in a remote page (campaignPopupUrl) whose
calls weren't seen, so the list/claim pages stay those of 0.2.21;
Cosy-MachineCode, which both Qoder CN clients send, is not sent.
Version 0.2.29 is open PR #319's (QwenWork).
#290 (Codex side session on Ultimate read 0% from cache). Qoder's own
client (qoder-agent-sdk in Qoder.app 0.4.3, qodercli 1.1.75) sends, on
every agent_chat_generation request:
- cache_control {type: ephemeral} on the last non-thinking, non-tool
block of the last message when it is a user turn (none when the last
turn is tool results);
- each user turn's blocks as `contents` beside `content`;
- request_id / chat_record_id / request_set_id per request and a stable
session_id per conversation.
The plugin sent none of that, and gave a tool call without an id a new
random id on each request, so the prefix changed every turn. Now:
- cacheMarked() marks as above, without touching the caller's turns;
- session_id is a UUID-shaped sha256 of prompt_cache_key (Codex's
thread, which magpie forwards) or else of the system text and first
user turn; the key itself never goes out;
- an id-less call's id is sha256(turn, place, name, arguments).
Check-in (accomplish on Discord, 10-21: Qoder intl can't check in, CN
can). Only the international site needs Qoder's runtime-info helper;
on Windows only %LOCALAPPDATA%\Programs\Qoder was searched. A
machine-wide install under %ProgramFiles%\Qoder is now found too. This
is one possible cause, not a confirmed one: the reporter's error text
and OS are unknown.
Run at this tree (rebased on 15d536a):
- HOME=$(mktemp -d) bun test in packages/qoder: 173 pass, 0 fail.
- Red on the old index.mjs: 3 of 5 cache.test.mjs tests (marker,
session, stable call ids) and the new Program Files test.
- cn.test.mjs's exact-shape assertion updated to the marked last turn.
Not tried: a real Qoder account (no hit-rate measurement on Ultimate
or Fast), a real Windows machine-wide install, accomplish's account.
Qoder CN offers the PAT sign-in too (its /api/v1/jobToken/exchange takes a
personal_token as qoder.com's does; the prompt names qoder.cn's console),
and a PAT account, which has no device token, signs the campaigns pages and
the daily check-in with its job token instead of rotating a device token it
doesn't have. The account keeps the name its browser sign-in takes
(email || uid), so a renewed PAT sign-in replaces its lapsed row.
Run at d7db9f2b987c46cbf100cda9d89a8a546e374fb6:
- bun test packages/qoder: 155 pass, 0 fail; bun scripts/check.mjs passes.
- The PR's check-in tests go through the loader's campaigns fetch, not
auth.checkin. Two local tests calling auth.checkin with a PAT account
(qoder and qoder-cn: claimed on the job token, no deviceToken refresh;
a 403 is "failed", not rotated) pass on this head and both fail with the
checkin hook's change reverted by hand. They follow on main.
- Probe: POST openapi.qoder.com.cn/api/v1/jobToken/exchange with an
invalid pt- token answers 400 BadRequest, as openapi.qoder.sh does (an
unknown path answers 401), so the endpoint exists on CN and a bad PAT
maps to "refused the PAT". qoder.cn/account/integrations redirects to
sign-in, as qoder.com's does.
- Not tried: a live qoder.cn PAT exchange, chat or claim; that rests on
the author's live run.
0.2.9 (#49) looked for the CLI's cached runtime in ~/.qoder/.bin/umid-<platform>-<arch>-*/ on every platform. qodercli 1.1.66 (npm) and the worker in Qoder desktop 0.4.3 (extractBinary) make that folder only on Windows (umid-win32-<arch>-<hash>\runtime-info.exe with sgsdk.dll); on macOS and Linux they write a file, ~/.qoder/.bin/runtime-info-<platform>-<arch>-<hash>. And the Linux desktop installs to /opt/Qoder/resources/umid/runtime-info (Qoder 0.4.3's .deb and .rpm), which wasn't looked at. So a macOS user with only the CLI, and every Linux user, got HTTP 502 on the international check-in, while Qoder CN (which needs no runtime) checked in.
campaignRuntime now looks at /opt/Qoder on Linux, reads the CLI's cache as the CLI writes it (the newest matching file, a .tmp being written skipped), and follows the CLI's own folder settings (QODER_CONFIG_DIR, QODER_CLI_HOME, QODER_CONFIG_DIR_NAME). Windows and macOS desktop lookup is unchanged.
checkin.test.mjs lays out the CLI cache as qodercli writes it on win32/x64, darwin arm64/x64 and linux x64/arm64, plus /opt/Qoder and the config-folder variables: 6 of the new tests fail on 0.2.9 (the Windows case passes on both, as 0.2.9 had it right), all pass now. bun test packages/qoder (87 pass) and scripts/check.mjs qoder under a temp HOME pass. On this Mac the real lookup returns /Applications/Qoder.app/Contents/Resources/umid/runtime-info. Not run: the runtime itself against a real account, or on Linux/Windows.