Commit Graph
2 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
yetone a064cf15e1 devin 0.1.35: Claude's thinking keeps its signature and goes back with it (#665)
Vigilans (#665): GetChatMessage's reply carries the thinking's signature
in delta_signature (10) and its type in delta_signature_type (21), and
ChatMessagePrompt takes the thinking back in thinking (11), signature
(12) and signature_type (18). The plugin read only delta_thinking (9),
so /v1/messages answered thinking blocks with signature "", and the
next request left the assistant's thinking out. Field numbers checked
against devin2api's all-protos.proto (GetChatMessageResponse,
ExaChatPb_ChatMessagePrompt) at e8547b6d.

- events() yields {signature} for field 10 and {signatureType} for 21.
- Messages, whole: the signature goes on the last thinking block. Stream:
  a signature_delta in the open thinking block, before its stop, as
  Anthropic streams it. Only when the request's model is Claude; another
  model's thinking stays unsigned, as before.
- The type is kept by signature (the last 512) since a Messages block has
  no field for it; one not kept goes back as "anthropic", what Devin says
  for Claude.
- buildMessages, to a Claude model: a signed thinking block goes back
  on the assistant prompt after it (its text, or the calls' prompt);
  a second one before any prompt gets an empty prompt of its own, and
  one after the text with calls following goes on the calls' prompt.
  Unsigned thinking, thinking to a model that isn't Claude, and a turn
  that only thought send nothing, as before.
- The chat completion and Messages streams read past events they send
  nothing for: a pull that enqueues nothing isn't pulled again in Bun,
  and the Messages stream hung on one (seen in the new tests before the
  loop).

Not changed: chat completions (and OpenCode 2's language model, which
goes through them) have no field for a signature, so they carry the
thinking text only, as before. thinking_redacted (reply 11, prompt 13)
isn't read or sent.

Run at this head on mote:
- bun test packages/devin (HOME a temp dir): 199 pass, 0 fail.
- repo root bun test: 5175 pass, 0 fail (15 skip); bun scripts/check.mjs ok.
- thinking-signature.test.mjs on origin/main 311d628: the six tests of
  the signature (read, whole, stream, replay, two thinking blocks, type)
  red; the four "as before" tests pass.
Not tried: a real Devin account (none in a sandbox); frames are built
from the proto's field numbers, not captured bytes.
2026-11-03 17:28:11 +08:00