troilus1011 on X: WorkBuddy's DeepSeek in OpenCode through magpie thought at low and high, never at the default. OpenCode's default variant names no reasoning_effort, and WorkBuddy doesn't think without one: measured on www.workbuddy.ai with 0.1.42, deepseek-v4.1-flash gave 0 reasoning tokens with no effort (2 of 2), 0 at none, 16/37 at low, 34/56 at high. WorkBuddy's own client (CLI 2.165.0 in WorkBuddy 5.9.3, configureThinkingSettings) sends the session's effort, else the reasoningEffort setting, else the model's reasoning.defaultEffort from /v3/config, which is "high" for this model on both builds. A chat that names no effort now gets the model's own defaultEffort when its listed levels hold it, read from the same cached /v3/config list (one read per minute; a failed read leaves the chat as it came and is not retried on every chat). An effort the client names, none included, is untouched and the list isn't read for it. Models with no reasoning config get nothing. runmiNeverstop on X: 2.89 GB up to copilot.tencent.com through magpie. WorkBuddy's client gzips a model request's body (GzipRequestProcessor, on with productFeatures.RequestBodyGzip, true in both builds' product.json and not turned off by the remote config); the plugin sent it as plain JSON. Agent chat JSON (the whole history each turn, tool schemas) compresses several-fold, so the upload was several times what the official client sends for the same turns. A chat-completions body now goes gzipped with Content-Encoding: gzip on both builds; unanswered() weighs the gzipped size against the front door's 2 MiB. Claude's Messages route goes as it came (not tried gzipped live). Run (on mote, HOME=$(mktemp -d) bun test in packages/workbuddy): 197 pass, 0 fail. bun scripts/check.mjs: exit 0. Fakes that parse the sent body gunzip it (testdata/unz.mjs); reset.test.mjs's 2 MiB bodies are random base64 so they stay over 2 MiB on the wire. Live (www.workbuddy.ai, a real account in a sandbox HOME): with 0.1.43 the default sent reasoning_effort high gzipped and thought (34 and 51 reasoning tokens), none stayed 0, low and high as before, all 200. A gzipped chat answered 200 the same as a plain one. Broken by hand: origin/main's index.mjs with the new default-effort.test.mjs: 5 of 8 red (default effort, failed-read reuse, both gzip tests, defaultEffortOf); the 3 that pass guard what must not change (named efforts, models without a default, Messages). Not tried: a live chat on the China build (copilot.tencent.com answered 401 to every token available here, its /v3/config read fine); Messages gzipped; the reporters' own OpenCode sessions end to end.
68 lines
3.1 KiB
JavaScript
68 lines
3.1 KiB
JavaScript
// WorkBuddy drops an assistant message's reasoning_content and reads its own
|
|
// client's `reasoning` (uk.jent on Discord, 2026-10-27: Grok Build's
|
|
// chat.completions history lost its thinking on WorkBuddy). The history is
|
|
// the one Grok Build 1.0.67 sends after a tool call.
|
|
import { expect, test } from "bun:test"
|
|
import { WorkBuddyAIAuthPlugin, _internal } from "./index.mjs"
|
|
import { unz } from "./testdata/unz.mjs"
|
|
|
|
const { asReasoning } = _internal
|
|
|
|
const thought = "The user wants the files. Codeword ZEBRA-42."
|
|
const history = (assistant) => [
|
|
{ role: "system", content: "You are Grok." },
|
|
{ role: "user", content: "List the files here." },
|
|
{ role: "assistant", content: "", tool_calls: [{ id: "call_1", type: "function", function: { name: "list_files", arguments: "{}" } }], ...assistant },
|
|
{ role: "tool", tool_call_id: "call_1", content: "a.txt\nb.txt" },
|
|
{ role: "user", content: "And now?" },
|
|
]
|
|
|
|
async function upstream(messages) {
|
|
const realFetch = globalThis.fetch
|
|
const sent = []
|
|
globalThis.fetch = async (url, init) => {
|
|
if (String(url).includes("/chat/completions")) sent.push(JSON.parse(unz(init.body)))
|
|
return new Response("data: [DONE]\n\n", { headers: { "content-type": "text/event-stream" } })
|
|
}
|
|
try {
|
|
const hooks = await WorkBuddyAIAuthPlugin({ client: {} })
|
|
const loader = await hooks.auth.loader(async () => ({ type: "oauth", access: "access", uid: "uid", expires: Date.now() + 3600_000 }))
|
|
const res = await loader.fetch("https://www.workbuddy.ai/v2/chat/completions", { method: "POST", body: JSON.stringify({ model: "kimi-k2.6", stream: true, messages }) })
|
|
expect(res.status).toBe(200)
|
|
} finally {
|
|
globalThis.fetch = realFetch
|
|
}
|
|
expect(sent.length).toBe(1)
|
|
return sent[0].messages
|
|
}
|
|
|
|
test("an earlier turn's reasoning_content goes as reasoning, as WorkBuddy's own client sends it", async () => {
|
|
const m = await upstream(history({ reasoning_content: thought, model_id: "kimi-k2.6" }))
|
|
expect(m[2].reasoning).toBe(thought)
|
|
expect(m[2].reasoning_content).toBeUndefined()
|
|
expect(m[2].tool_calls[0].id).toBe("call_1")
|
|
// nothing is folded into what the model said
|
|
expect(m[2].content).toBe("")
|
|
expect(m[4]).toEqual({ role: "user", content: "And now?" })
|
|
})
|
|
|
|
test("reasoning_details' text goes as reasoning too", async () => {
|
|
const m = await upstream(history({ reasoning_details: [{ type: "reasoning.text", text: "The user wants " }, { type: "reasoning.text", text: "the files." }] }))
|
|
expect(m[2].reasoning).toBe("The user wants the files.")
|
|
expect(m[2].reasoning_details).toBeUndefined()
|
|
})
|
|
|
|
test("a reasoning the client set already is kept", () => {
|
|
const messages = history({ reasoning: "own words", reasoning_content: thought })
|
|
expect(asReasoning(messages)).toBe(true)
|
|
expect(messages[2].reasoning).toBe("own words")
|
|
expect(messages[2].reasoning_content).toBeUndefined()
|
|
})
|
|
|
|
test("a history without reasoning fields is left as sent", () => {
|
|
const messages = history({ reasoning: "own words" })
|
|
const before = JSON.stringify(messages)
|
|
expect(asReasoning(messages)).toBe(false)
|
|
expect(JSON.stringify(messages)).toBe(before)
|
|
})
|