workbuddy 0.1.40: chats carry the current desktop client's headers
WorkBuddy accounts are being restricted, and a report says WorkBuddy now checks request-header fingerprints. Diffed the plugin's chat request against each build's current desktop app, read (never run) from the update feeds on 2026-10-28: - China: WorkBuddy 5.9.3.42398134 (copilot.tencent.com/v2/update), bundled @genie/agent-cli 2.165.0. - WorkBuddy AI: 5.8.4.41366630 (www.workbuddy.ai/v2/update), CLI 2.161.0. The chat is the CLI's OpenAI client (openai 6.25.0) through axiosToFetchAdapter, with UserAgentHttpInterceptor and the desktop's CLIENT_INFO_* env (sidecar-manager getCachedBaseEnv). What differed, and now matches: - User-Agent: was WorkBuddy/5.5.6; the client sends "WorkBuddy/<app> <applicationName>/<app> CLI/<cli>": WorkBuddy/5.9.3 WorkBuddy/5.9.3 CLI/2.165.0 (China), WorkBuddy/5.8.4 workbuddy-ai/5.8.4 CLI/2.161.0 (AI). The /v3/config models call (was CLI/2.0.0 WorkBuddy/5.5.6) takes the same one, as the CLI's CloudProductProvider sends it through the same interceptor. - X-IDE-Version: was 5.5.6; now the app's version. - X-Agent-Type: main was sent on WorkBuddy AI only; the adapter sets it on every model call on both builds. - X-Agent-Runtime: local-agent, new in 5.9 (the desktop's local transport puts agentRuntime local-agent in the prompt meta); China build only, 5.8.4 has no such header. - Accept: application/json and the OpenAI SDK's X-Stainless-* (Lang js, Package-Version 6.25.0, OS/Arch of this machine, Runtime node, Runtime-Version v22.21.1 = Electron 37.10.3's Node, Retry-Count 0, Timeout 1200); the adapter strips them only in its skip-auth mode. - The desktop's own calls (billing, plugin API) send WorkBuddy/<app>; they now send the current app version instead of 5.5.6. Not matched: X-Device-Token (TuringShield native SDK, sent since at least 5.6.2), traceparent (only while server-side tracing is enabled), and transport-level differences (Bun's fetch vs axios on Node: header order, Accept-Encoding). Run: HOME=$(mktemp -d) bun test packages/workbuddy: 184 pass, 0 fail. With the old index.mjs the 4 changed tests fail (UA, IDE version, config UA, the new per-build header test). Not tried: a real account's chat or /v3/config with the new User-Agent (unauthenticated /v3/config answers the same for old and new). No text added names magpie or WorkBuddy's limits.
This commit is contained in:
@@ -116,7 +116,37 @@ test("WorkBuddy AI takes the ids too, with its client's headers", async () => {
|
||||
expect(turn(ai)).toMatch(HEX32)
|
||||
expect(conv(ai)).toMatch(HEX32)
|
||||
expect(ai.get("x-ide-name")).toBe("WorkBuddy")
|
||||
expect(ai.get("user-agent")).toBe("WorkBuddy/5.5.6")
|
||||
expect(ai.get("user-agent")).toBe("WorkBuddy/5.8.4 workbuddy-ai/5.8.4 CLI/2.161.0")
|
||||
})
|
||||
|
||||
// What WorkBuddy's desktop CLI sends with a chat, read from each build's
|
||||
// current app (China 5.9.3 with CLI 2.165.0, WorkBuddy AI 5.8.4 with CLI
|
||||
// 2.161.0): UserAgentHttpInterceptor's User-Agent, the app's version as
|
||||
// the IDE's, X-Agent-Type on both builds, 5.9's X-Agent-Runtime, and the
|
||||
// OpenAI SDK's headers its fetch passes on.
|
||||
test("each build's chat carries its desktop client's headers", async () => {
|
||||
const sdk = {
|
||||
accept: "application/json",
|
||||
"x-agent-type": "main",
|
||||
"x-stainless-lang": "js",
|
||||
"x-stainless-package-version": "6.25.0",
|
||||
"x-stainless-runtime": "node",
|
||||
"x-stainless-runtime-version": "v22.21.1",
|
||||
"x-stainless-retry-count": "0",
|
||||
"x-stainless-timeout": "1200",
|
||||
}
|
||||
const want = {
|
||||
workbuddy: [WorkBuddyAuthPlugin, { ...sdk, "user-agent": "WorkBuddy/5.9.3 WorkBuddy/5.9.3 CLI/2.165.0", "x-ide-version": "5.9.3", "x-agent-runtime": "local-agent" }],
|
||||
"workbuddy-ai": [WorkBuddyAIAuthPlugin, { ...sdk, "user-agent": "WorkBuddy/5.8.4 workbuddy-ai/5.8.4 CLI/2.161.0", "x-ide-version": "5.8.4", "x-agent-runtime": null }],
|
||||
}
|
||||
for (const [provider, [plugin, heads]] of Object.entries(want)) {
|
||||
const h = await ask(send("hi"), { provider, plugin, headers: { "x-agent-runtime": "cloud-agent" } })
|
||||
for (const [name, v] of Object.entries(heads)) expect([provider, name, h.get(name)]).toEqual([provider, name, v])
|
||||
expect(h.get("x-stainless-os")).toMatch(/^(MacOS|Windows|Linux|FreeBSD|OpenBSD|Android|Other:.+)$/)
|
||||
expect(h.get("x-stainless-arch")).toMatch(/^(x64|arm64|arm|x32|other:.+)$/)
|
||||
// nothing in what is sent names magpie or a tool other than WorkBuddy's
|
||||
for (const [k, v] of h) expect([k, v.toLowerCase()].join(" ")).not.toMatch(/magpie|opencode/)
|
||||
}
|
||||
})
|
||||
|
||||
test("both builds carry what the usage list shows as the client (使用端)", async () => {
|
||||
@@ -126,7 +156,6 @@ test("both builds carry what the usage list shows as the client (使用端)", as
|
||||
"x-agent-purpose": "conversation",
|
||||
"x-ide-name": "WorkBuddy",
|
||||
"x-ide-type": "WorkBuddy",
|
||||
"x-ide-version": "5.5.6",
|
||||
"x-product": "SaaS",
|
||||
"x-agent-intent": "craft",
|
||||
"x-requested-with": "XMLHttpRequest",
|
||||
|
||||
Reference in New Issue
Block a user