devin 0.1.29: a failed tool result on the Messages path says "Error: " first (#566)
0.1.28 moved Devin's Claude models onto Anthropic's Messages API, where a failed result arrives as tool_result is_error. On chat completions magpie's gateway writes it into the text, "Error: " first (failedAsText: Devin has no failed mark), and TestPluginToolFailureSaid holds that; the Messages path dropped is_error. It now says it the same way. Run: - mote-run: HOME=$(mktemp -d) bun test in packages/devin, 156 pass 0 fail; bun scripts/check.mjs ok. - Broken by hand: without the prefix the new test fails. Not tried against the real Devin API (the change is text only).
This commit is contained in:
@@ -59,7 +59,8 @@ The plugin's `fetch` handles this:
|
||||
message after the results ("[From the result of …]").
|
||||
- The Claude models are asked on Anthropic's Messages API
|
||||
(`@ai-sdk/anthropic`, `POST …/devin/v1/messages`); every other model
|
||||
stays on chat completions (since 0.1.28, #566).
|
||||
stays on chat completions (since 0.1.28, #566). A failed tool result
|
||||
says so in its text, "Error: " first (0.1.29).
|
||||
- Each text block, system block, tool call turn and tool result is a
|
||||
`ChatMessagePrompt` of its own, in the order the client sent them, and
|
||||
one the client marked with `cache_control` carries
|
||||
|
||||
@@ -101,6 +101,24 @@ test("tool calls and results keep their own prompts and marks", () => {
|
||||
expect(offered).toEqual(["read_file"])
|
||||
})
|
||||
|
||||
test("a failed result says so in its text, as on chat completions", () => {
|
||||
const ps = prompts(
|
||||
buildMessages(
|
||||
{
|
||||
model: "claude-haiku-5-5",
|
||||
messages: [
|
||||
{ role: "user", content: "go" },
|
||||
{ role: "assistant", content: [{ type: "tool_use", id: "c1", name: "Bash", input: {} }] },
|
||||
{ role: "user", content: [{ type: "tool_result", tool_use_id: "c1", content: "exit status 1", is_error: true }] },
|
||||
],
|
||||
},
|
||||
"claude-haiku-5-5",
|
||||
"k",
|
||||
),
|
||||
)
|
||||
expect(ps.find((p) => p.role === 4).text).toBe("Error: exit status 1")
|
||||
})
|
||||
|
||||
test("a Messages request's effort is read as magpie reads it", () => {
|
||||
expect(anthropicEffort({ thinking: { type: "adaptive" }, output_config: { effort: "high" } })).toBe("high")
|
||||
expect(anthropicEffort({ thinking: { type: "enabled", budget_tokens: 10000 } })).toBe("medium")
|
||||
|
||||
@@ -1938,7 +1938,10 @@ function buildMessages(req, uid, key) {
|
||||
const inner = typeof b.content === "string" ? [{ type: "text", text: b.content }] : Array.isArray(b.content) ? b.content : []
|
||||
const text = inner.filter((x) => x?.type === "text" && x.text).map((x) => x.text).join("\n\n")
|
||||
const images = inner.map(anthropicImage).filter(Boolean)
|
||||
msgs.push({ role: TOOL, callID: pending[i].id, text: text || "(no output)", images, cache: marked(b) || marked(inner[inner.length - 1]) })
|
||||
// Devin has no failed mark on a result: it is said in the text, as
|
||||
// magpie's gateway says it on chat completions (failedAsText)
|
||||
const said = text || "(no output)"
|
||||
msgs.push({ role: TOOL, callID: pending[i].id, text: b.is_error ? "Error: " + said : said, images, cache: marked(b) || marked(inner[inner.length - 1]) })
|
||||
pending.splice(i, 1)
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@magpie-community/opencode-devin-auth",
|
||||
"version": "0.1.28",
|
||||
"version": "0.1.29",
|
||||
"description": "Devin subscriptions (the devin CLI's account) in OpenCode and magpie",
|
||||
"type": "module",
|
||||
"main": "./index.mjs",
|
||||
|
||||
Reference in New Issue
Block a user