Skip to content

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

Merged
mmabrouk merged 1 commit into
release/v0.105.6from
port/claude-thinking-decomp
Jul 18, 2026
Merged

[AGE-3962] fix(runner): surface Claude extended-thinking in the playground#5380
mmabrouk merged 1 commit into
release/v0.105.6from
port/claude-thinking-decomp

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

Problem

In the agent playground, the Claude Code harness shows no thinking for some models. Sonnet and Opus show nothing; Haiku works — even though all three 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".

Supersedes #5372

This PR supersedes #5372 (same author's fix), ported onto the decomposed runner layout. The runner engine was split since #5372 was opened: the monolithic sandbox_agent.ts is now a thin facade over engines/sandbox_agent/*. #5372's new claude-thinking.ts module and its test are byte-identical here; its one session-init insertion (the import and the claudeThinking / claudeMeta merge) now lands in engines/sandbox_agent/environment.ts, next to where claudeSystemPromptMeta and the sessionInit payload are already assembled — the block that moved out of the monolith. No behavior change from #5372. #5372 can be closed in favor of this one.

Testing

  • New unit test for the claudeThinkingMeta helper.
  • pnpm run typecheck clean; pnpm test green — 1205 tests (was 1204, +1 for the new test).

https://claude.ai/code/session_01DnWRxU3dCJ11hgDidm26vW

Recent Claude models default extended-thinking display to "omitted"
(signature-only, empty text), so claude-agent-acp emits no
agent_thought_chunk and the playground shows no reasoning for Sonnet/Opus
while Haiku works. Request visible ("summarized") adaptive thinking via
_meta.claudeCode.options for the Claude harness only, so reasoning
surfaces for every model without forcing a budget. Pi harness untouched.

Ports open PR #5372 onto the decomposed runner layout: the session-init
insertion now lives in sandbox_agent/environment.ts.

Claude-Session: https://claude.ai/code/session_01DnWRxU3dCJ11hgDidm26vW
@linear-code

linear-code Bot commented Jul 18, 2026

Copy link
Copy Markdown

AGE-3962

@vercel

vercel Bot commented Jul 18, 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 18, 2026 7:16pm

Request Review

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Jul 18, 2026
@mmabrouk

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a Claude extended-thinking metadata helper, requests adaptive summarized reasoning for Claude sessions, merges it with existing system-prompt metadata, and adds unit coverage for the configuration.

Changes

Claude thinking configuration

Layer / File(s) Summary
Thinking metadata contract and test
services/runner/src/engines/sandbox_agent/claude-thinking.ts, services/runner/tests/unit/claude-thinking.test.ts
Exports ClaudeThinkingMeta and claudeThinkingMeta(), which configure adaptive thinking with summarized display; the unit test verifies the nested options.
Session initialization integration
services/runner/src/engines/sandbox_agent/environment.ts
Generates Claude thinking metadata for Claude agents and shallow-merges it with existing system-prompt metadata before attaching _meta to sessionInit.

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

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly matches the main change: surfacing Claude extended-thinking in the playground.
Description check ✅ Passed The description accurately explains the Claude thinking metadata fix and its playground impact.
✨ 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 port/claude-thinking-decomp

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.

@github-actions

github-actions Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Status Destroyed (PR closed)

Updated at 2026-07-18T23:40:47.777Z

@mmabrouk mmabrouk left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

lgtm

@mmabrouk mmabrouk added lgtm This PR has been approved by a maintainer needs-review Agent updated; awaiting Mahmoud's review labels Jul 18, 2026
@mmabrouk
mmabrouk changed the base branch from main to release/v0.105.6 July 18, 2026 23:40
@mmabrouk
mmabrouk merged commit 2d4a5c1 into release/v0.105.6 Jul 18, 2026
109 of 118 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer needs-review Agent updated; awaiting Mahmoud's review 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

1 participant