Commit Graph
1 Commits
Author SHA1 Message Date
yetone 1a342edfae devin 0.1.36: another model's reasoning goes back as its thinking (#703)
kamikakushi (#703): swe-2 is conditioned on the assistant turns before
it having thinking (ChatMessagePrompt field 11). The plugin sent field
11 only beside a signature (#665), and no builder handed it a non-Claude
model's reasoning, so swe-2 stopped emitting delta_thinking on a tool
loop's later turns (the reporter's A/B against swe-2-high: no field 11,
0 bytes of thinking; field 11 without 12, thinking on 5 of 5 runs).
Each claim checked against index.mjs at 0.1.35: build() read only
content and tool_calls, v2Chat() dropped reasoning parts, encodeMsg()
gated 11 on the signature.

- encodeMsg: field 11 whenever the thinking has text; 12 and 18 only
  with a signature, as before.
- build (chat completions): reasoning_content (or reasoning, as some
  clients name it) goes on the assistant prompt as unsigned thinking, to
  a model that isn't Claude. joinSplitCalls keeps both halves'.
- v2Chat (OpenCode 2): reasoning parts become reasoning_content, which
  build then handles.
- buildMessages (/v1/messages, the sibling the issue doesn't name): a
  non-Claude model's thinking block goes back as its text alone, never
  with its signature.
- Claude: unchanged. A chat completion still sends Claude no thinking
  (no field for a signature there), and Messages sends only signed
  thinking with its signature and type, as #665 did: Anthropic refuses a
  thinking block without a valid signature, so unsigned text never goes
  to Claude on any path.

Not done: the issue's optional made-up thought for a history turn whose
client sent no reasoning (Pi's openai-completions default). Nothing is
written into the model's history that it didn't say.

Run (mote, bun 1.4.2, HOME a temp dir): packages/devin 208 pass, 0 fail;
repo root bun test 5411 pass, 0 fail, 19 skip; bun scripts/check.mjs ok.
Broke it by hand:
- index.mjs from origin/main: 7 red (the 6 new non-Claude tests and the
  updated "another model's goes without a signature"); the Claude tests
  pass both ways.
- only encodeMsg's old gate put back: the same 7 red.
- build's Claude gate removed: "Claude gets no unsigned thinking from a
  chat completion", "a chat completion's request is the same as before"
  and the v2 Claude check red.
Not tried: a real Devin account; frames are built from the proto's
field numbers, and swe-2's behaviour rests on the reporter's A/B.
2026-11-04 13:49:17 +08:00