Skip to content

[AGE-3962] fix(runner): surface Claude extended-thinking in the playground#5372

Closed
ardaerzin wants to merge 1 commit into
mainfrom
fix/claude-extended-thinking-display
Closed

[AGE-3962] fix(runner): surface Claude extended-thinking in the playground#5372
ardaerzin wants to merge 1 commit into
mainfrom
fix/claude-extended-thinking-display

Conversation

@ardaerzin

@ardaerzin ardaerzin commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Problem

In the agent playground, the Claude Code harness shows no thinking/reasoning for some models — Sonnet shows nothing, Haiku works — even though both stream fine. Closes #5355 (AGE-3962).

Root cause

Recent Claude models default extended-thinking display to "omitted": the Anthropic API returns signature-only thinking blocks whose text is empty. @agentclientprotocol/claude-agent-acp emits an agent_thought_chunk only when that text is non-empty, so on those models the runner never sees any reasoning and nothing renders — in streaming or batch. Models that return thinking text (e.g. Haiku) are unaffected. The runner set no thinking config, so recent models fell to the omitted default.

This is emission-side (the reasoning never reaches us), not a rendering bug.

Fix

For the Claude harness, request visible ("summarized") thinking display via _meta.claudeCode.options.thinking — the same _meta channel the system-prompt append already uses, which claude-agent-acp spreads over its env-derived thinking config (so it wins):

{ claudeCode: { options: { thinking: { type: "adaptive", display: "summarized" } } } }
  • type: "adaptive" leaves the think-or-not decision to the model (no forced budget).
  • "summarized" still returns the thinking signature, so multi-turn thinking continuity is unaffected.
  • Guarded by plan.acpAgent === "claude"Pi harness is untouched (it has its own reasoning path).

The change is model-agnostic within the Claude harness: it fixes Sonnet/Opus (same omitted-default cause) and leaves Haiku/default behavior unchanged (summarized is their existing default, now explicit).

Before / after

  • Before: Claude Code + Sonnet → no "Thought" in the playground.
  • After: Claude Code + Sonnet → reasoning streams and renders as "Thought".

Testing

  • New unit test for the claudeThinkingMeta helper; full runner suite green (pnpm test, pnpm run typecheck).
  • Verified live in the playground: Sonnet (now surfaces thinking), Opus (now surfaces thinking), Haiku (unchanged — still works).

Notes

  • A separate, complementary issue exists where reasoning is dropped when a turn resolves in batch mode (fold() in the SDK); that's tracked separately and not included here.

@linear-code

linear-code Bot commented Jul 17, 2026

Copy link
Copy Markdown

AGE-3962

@vercel

vercel Bot commented Jul 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jul 17, 2026 10:57pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3e3b0620-dddc-492f-b8ea-c96242a971b5

📥 Commits

Reviewing files that changed from the base of the PR and between 68a7a89 and 12a5f36.

📒 Files selected for processing (3)
  • services/runner/src/engines/sandbox_agent.ts
  • services/runner/src/engines/sandbox_agent/claude-thinking.ts
  • services/runner/tests/unit/claude-thinking.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • services/runner/src/engines/sandbox_agent/claude-thinking.ts
  • services/runner/src/engines/sandbox_agent.ts
  • services/runner/tests/unit/claude-thinking.test.ts

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Claude runs now display summarized extended-thinking content in the playground.
    • Thinking settings are applied consistently when starting or resuming sessions.
  • Bug Fixes

    • Prevented newer Claude models from hiding thinking content by default.

Walkthrough

Claude sandbox sessions now send adaptive, summarized extended-thinking metadata alongside existing system-prompt metadata. A helper and unit test define and verify the configuration, while acquireEnvironment merges it into Claude session initialization.

Changes

Claude thinking display

Layer / File(s) Summary
Define and validate thinking metadata
services/runner/src/engines/sandbox_agent/claude-thinking.ts, services/runner/tests/unit/claude-thinking.test.ts
Adds the exported ClaudeThinkingMeta shape and claudeThinkingMeta() helper, with a unit test asserting adaptive summarized thinking configuration.
Merge metadata into session initialization
services/runner/src/engines/sandbox_agent.ts
Merges Claude thinking metadata with existing system-prompt metadata in the Claude sessionInit payload.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 60.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: surfacing Claude extended-thinking in the playground.
Description check ✅ Passed The description matches the code changes and explains the Claude thinking display fix in the playground.
Linked Issues check ✅ Passed The changes address #5355 by enabling Claude thinking output to appear while preserving final responses.
Out of Scope Changes check ✅ Passed The diff appears focused on the Claude thinking meta helper, runner wiring, and a matching unit test.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/claude-extended-thinking-display

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ardaerzin
ardaerzin marked this pull request as ready for review July 17, 2026 22:36
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Jul 17, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b49a5598-61e8-42ef-905a-0fa6c69dc52f

📥 Commits

Reviewing files that changed from the base of the PR and between 6c0265a and 68a7a89.

📒 Files selected for processing (3)
  • services/runner/src/engines/sandbox_agent.ts
  • services/runner/src/engines/sandbox_agent/claude-thinking.ts
  • services/runner/tests/unit/claude-thinking.test.ts

Comment thread services/runner/src/engines/sandbox_agent.ts
…round

Recent Claude models (e.g. Sonnet) default extended-thinking `display` to
"omitted" — the API returns signature-only thinking blocks whose text is empty.
claude-agent-acp emits an `agent_thought_chunk` only when that text is non-empty,
so the runner never sees the reasoning and the playground shows none, while models
that return thinking text (e.g. Haiku) work.

For the Claude harness, request `display: "summarized"` via
`_meta.claudeCode.options.thinking` so the reasoning text is returned for every
model. `type: "adaptive"` leaves the think-or-not decision to the model, and
"summarized" still returns the signature, so multi-turn thinking continuity is
unaffected.
@mmabrouk

Copy link
Copy Markdown
Member

Ported onto the decomposed runner layout in #5380 (the runner engine was split since this PR was opened; the session-init insertion now lives in engines/sandbox_agent/environment.ts). #5380 supersedes this PR — no behavior change. Leaving this open for the author to close.

@mmabrouk

Copy link
Copy Markdown
Member

deprecated

@mmabrouk mmabrouk closed this Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Provider thinking output is not shown in the playground in Claude Code

2 participants