Skip to content

fix(aikit): drop thinking from other models instead of sending it as text - #104

Merged
sanchitrk merged 4 commits into
canaryfrom
claude/cod-187-drop-foreign-thinking-49035c
Oct 26, 2026
Merged

sanchitrk merged 4 commits into
canaryfrom
claude/cod-187-drop-foreign-thinking-49035c

Conversation

@sanchitrk

Copy link
Copy Markdown
Contributor

Stacked on #102.

What

  • Message.transformMessages now drops thinking from a different provider, protocol or model (signed, unsigned and redacted alike). Before, readable thinking was sent as plain text.
  • Same-model replay is unchanged, except a redacted block without a signature is now kept.
  • Text and tool calls from other models are still kept.
  • The Copilot thinking comment in transform.ts now describes the only case left: thinking the endpoint cannot replay natively.
  • Formatting skips .agents/** and .claude/**, so vp check at the repo root passes.

Why

Sent as text, the old model's reasoning showed up inside the new model's own earlier replies, and the new model could start writing its reasoning into the visible answer. Signatures and encrypted reasoning only verify on the model that produced them. Dropping the thinking also saves input tokens on every later request.

Tests

  • Unit: flipped the "thinking becomes text" case. Added cases for drops across models, readable thinking never sent as text, alternating models A → B → A, and same-model redacted blocks.
  • Live E2E (handoff.e2e.test.ts): claude-sonnet-4-6 ↔ openai-codex gpt-6-luna with thinking on, in both directions. It checks that no thinking text or signature reaches the other model's request, snapshots the request shape to __artifacts__/thinking-handoff.*.json, and continues the conversation live. Both directions fail on the old code.
  • vp check, vp run typecheck and the aikit unit tests (286) pass.

🤖 Generated with Claude Code

sanchitrk and others added 3 commits October 26, 2026 16:44
Tool calls now carry the input modalities of the model they answer
(`ToolCallContext.modelInput`). On a model without image input, `read`
adds a note that the image will be omitted, next to the placeholder the
transform puts in its place. A session test reads an image on a
text-only model, switches to a vision model and snapshots both requests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…text

Thinking from a different provider, protocol or model is now dropped,
signed, unsigned and redacted alike. Sent as text, it made the new model
read the old model's reasoning as part of its own replies, and signatures
only verify on the model that produced them. Text and tool calls are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from claude/linear-cod-184-ca812a to canary October 26, 2026 13:04
# Conflicts:
#	packages/harness/test/__artifacts__/tools.read.vision.json
#	packages/harness/test/tools.read.vision.test.ts
@sanchitrk
sanchitrk merged commit cab51e8 into canary Oct 26, 2026
2 checks passed
@sanchitrk
sanchitrk deleted the claude/cod-187-drop-foreign-thinking-49035c branch October 26, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant