provider: WorkBuddy plugin min 0.2.5, the filter's line with its newlines (plugins #540)

itspig (plugins #540, 2026-10-30) found v0.1.2278 with workbuddy 0.2.4
still passed WorkBuddy's content_filter refusal to the agent: the real
chunk's content is "\nSorry, I can't respond to this question.\n", and
0.2.4 trimmed only the leading newline, so the line went on as an answer
and the group's next member was never asked. workbuddy 0.2.5 (plugins
b5cc782) trims both sides.

- The workbuddy mover's min is 0.2.5 (npm view --prefer-online: 0.2.5).
- TestDeepSeekRefusalAfterThinkingFailsOver gets a subtest with what
  0.2.5 hands on from itspig's literal chunks (empty content and refusal
  on the reasoning chunk, extra_fields/function_call null, role on the
  content_filter chunk): the try fails as refused and b answers.

Run on mote at this tree: go test ./internal/gateway -run
TestDeepSeekRefusalAfterThinkingFailsOver -count=1 ok (3 subtests);
go test ./internal/provider -run 'Mover|Moved|Workbuddy|WorkBuddy' ok;
gofmt -l clean.

Broken by hand: the new subtest fed 0.2.4's output (the line with its
newlines left in the content_filter chunk) goes red.

Not tried: a live WorkBuddy account; the full ./... suite.
This commit is contained in:
yetone
2026-10-31 07:20:40 +08:00
parent 3eb5aa2add
commit f1d5bedba6
2 changed files with 18 additions and 1 deletions
+17
View File
@@ -183,6 +183,23 @@ func TestDeepSeekRefusalAfterThinkingFailsOver(t *testing.T) {
t.Fatalf("tries: %+v", r.Tries)
}
})
// What workbuddy 0.2.5 hands on from itspig's literal WorkBuddy chunks
// (plugins #540): the reasoning chunk with an empty content and refusal,
// and the content_filter chunk with "\nSorry, I can't respond to this
// question.\n" taken out, its null and empty fields kept.
workbuddy := sse(`data: {"choices":[{"delta":{"content":"","extra_fields":null,"function_call":null,"reasoning_content":" node","refusal":""},"finish_reason":null,"index":0,"logprobs":null}],"created":1793401068,"id":"c56c77084382622efa17c799396db5cf","model":"deepseek-v4.1-flash","object":"chat.completion.chunk","usage":null}`,
`data: {"choices":[{"delta":{"extra_fields":null,"function_call":null,"refusal":"","role":"assistant"},"finish_reason":"content_filter","index":0,"logprobs":null}],"created":0,"id":"c56c77084382622efa17c799396db5cf","model":"deepseek-v4.1-flash","object":"chat.completion.chunk","usage":null}`,
`data: [DONE]`)
t.Run("workbuddy's own chunks", func(t *testing.T) {
a, b, s, code, body := run(t, workbuddy)
if code != 200 || !strings.Contains(body, "from b") || strings.Contains(body, `"refusal"`) || strings.Contains(body, " node") || a.n != 1 || b.n != 1 {
t.Fatalf("%d %s (a %d, b %d)", code, body, a.n, b.n)
}
r := lastRoute(s)
if len(r.Tries) != 2 || r.Tries[0].Fail != failRefused || r.Tries[0].Rest != nil || r.Status != 200 {
t.Fatalf("tries: %+v", r.Tries)
}
})
t.Run("answered", func(t *testing.T) {
a, b, _, code, body := run(t, answered)
if code != 200 || !strings.Contains(body, "The user is asking") || !strings.Contains(body, "from a") || strings.Contains(body, "from b") || a.n != 1 || b.n != 0 {
File diff suppressed because one or more lines are too long