workbuddy 0.1.30: a refused line quoted back into an assistant message is reworded there too (#291)

tearslee measured on 0.1.29 that the "Web GUI whose URL the runtime
context names. When the user refers" line is refused as 11128 in an
assistant message, where the system-prompt move can't reach it, so a
long DeepSeek Harness chat stays refused for good. Its wording "...
names. The interface, when the user refers" went 400 -> 200 for them.
It joins FLAGGED, which unflag applies to every message, assistant
ones included. The README now says the move doesn't cover an assistant
message and that only a new chat clears words not in the list.

Run: bun test in packages/workbuddy (sandbox HOME), 112 pass; the new
test covers a string and a parts assistant message and a line break
between the sentences.
Not tried: the 400 itself. A short probe with the line through magpie
got 200, so the refusal needs more of the chat than I have; the 400 ->
200 is tearslee's measurement.
This commit is contained in:
yetone
2026-10-23 09:31:24 +08:00
parent e7f65641df
commit 575f1e23e7
4 changed files with 29 additions and 3 deletions
+5 -2
View File
@@ -92,8 +92,11 @@ WorkBuddy's default system prompt in its place: WorkBuddy checks only the
system and assistant messages, and the line it matched is then in neither.
A system message later in the chat becomes a user message where it stands.
The plugin remembers each refused system prompt while it is loaded, so that
agent's next chats go moved at once. A refusal that stands after the move
(words in an assistant message) ends in a hint that names no one client
agent's next chats go moved at once. The move can't reach an assistant
message, so words the model quotes back into one keep that chat refused
until they are in the list reworded in every message (since 0.1.30, the "Web GUI whose URL the runtime
context names" line, #291); otherwise only a new chat clears it. A refusal
that stands after the move ends in a hint that names no one client
(since 0.1.28): WorkBuddy refused words in this client's prompt; use it from
Hermes, OpenCode or Pi, or add another provider to the group. Neither
refusal rests the account.
+5
View File
@@ -467,6 +467,11 @@ const FLAGGED = [
// WorkBuddy refuses as 11128 (magpie-community/plugins#279; the same
// refusal traced in smart-open/TraeWorkAssistant#125).
[/You are an AI agent powered by DeepSeek Harness\.?/gi, "You are an AI agent that helps the user with programming tasks."],
// A line WorkBuddy refuses in a long DeepSeek Harness chat, measured 400
// then 200 with this wording by tearslee (magpie-community/plugins#291). The
// model can quote it back into an assistant message, which the move to
// the user's instructions can't reach, so it is reworded in every message.
[/Web GUI whose URL the runtime context names\.\s+When the user refers/gi, "Web GUI whose URL the runtime context names. The interface, when the user refers"],
]
function unflagged(text) {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/opencode-workbuddy-auth",
"version": "0.1.29",
"version": "0.1.30",
"description": "OpenCode provider plugins for WorkBuddy's plans: WorkBuddy (CodeBuddy, copilot.tencent.com) and WorkBuddy AI (www.workbuddy.ai)",
"type": "module",
"main": "./index.mjs",
+18
View File
@@ -51,3 +51,21 @@ test("a chat with nothing flagged is sent as it came", () => {
const body = JSON.stringify({ messages: [{ role: "system", content: "be brief" }, { role: "user", content: "hi" }] })
expect(withSystem(body)).toBe(body)
})
test("a refused line quoted back into an assistant message is reworded there too (#291)", () => {
const line = "There is a Web GUI whose URL the runtime context names. When the user refers to it, open it."
const fixed = "There is a Web GUI whose URL the runtime context names. The interface, when the user refers to it, open it."
expect(unflagged(line)).toBe(fixed)
expect(unflagged(line.replace(". When", ".\nWhen"))).toBe(fixed)
expect(unflagged(fixed)).toBe(fixed)
const body = JSON.stringify({ messages: [
{ role: "system", content: "be brief" },
{ role: "user", content: "hi" },
{ role: "assistant", content: line },
{ role: "assistant", content: [{ type: "text", text: line }] },
{ role: "user", content: "go on" },
] })
const b = JSON.parse(withSystem(body))
expect(b.messages[2].content).toBe(fixed)
expect(b.messages[3].content[0].text).toBe(fixed)
})