fix(server): show Codex and Claude thinking traces in V2 adapters - #12163
Draft
SunkenInTime wants to merge 530 commits into
Draft
SunkenInTime wants to merge 530 commits into
SunkenInTime wants to merge 530 commits into
Conversation
juliusmarminge
force-pushed
the
t3code/codex-turn-mapping
branch
2 times, most recently
from
September 17, 2026 06:46
d61550b to
e6cb2b5
Compare
Prune stale git worktree registration and recreate the saved branch at the saved path before provider startup. Recovery remains best effort so normal provider errors still report when repair is impossible. Finding: R10 Implemented by GPT-5.6 Sol in Codex.
Intercept /feedback in web and mobile, show the upload result and feedback ID in the thread, and block duplicate submissions while an upload is active. Audit: R12
R02: Append persisted paths for every uploaded file on provider sends and steering while reserving native image payloads for supported images.
Classify markdown image sources and request environment-scoped asset URLs for workspace files while leaving ordinary web images direct. Audit: R17
Normalize drive-path links and image sources before sanitization so file chips and signed workspace images receive usable paths. Audit: R18
R07: Project Codex last-turn and Claude assistant context usage, and retain the latest usage when terminal provider-turn updates omit it.
Keep ordinary file-chip clicks in the in-app preview while restoring modifier-click editor opening, configured editor labels, remote gating, and reveal-in-file-manager actions. Audit: R19
Use the owning thread or pull request environment for editor, shell, and remote-open actions instead of whichever environment is active. Add a multi-environment regression test for the action hooks. Audit: R20 Implemented by GPT-5.6 Sol with Codex.
Advertise and validate an explicit orchestration protocol before clients open RPC sessions. Announce the same protocol on WebSocket upgrades so hosts reject older clients before request decoding while preserving existing auth and relay parameters. Audit: D03 Implemented by GPT-5.6 Sol with Codex.
Document which thread metadata and transcript data migrate, which runtime history does not, and how the fresh provider continuation uses the latest 32,000 characters. Add a safe read-only recovery procedure without claiming an export API. Audit: D02 Written by GPT-5.6 Sol with Codex.
Explain the eligible timeline items, whitespace-normalized 240-character prefixes, omitted tail risk, and practical preparation for provider or fork handoffs. Distinguish this rule from the legacy import's 32,000-character transcript suffix. Audit: D04 Written by GPT-5.6 Sol with Codex.
Remove obsolete implementation plans and the probe write marker so temporary work artifacts no longer ship with the repository. Audit: H01 Implemented by GPT-5.6 Sol with Codex.
R14: Hold idle completion through prompt admission, reconcile status only for the current admission generation, and invalidate admission before abort.
Project AskUserQuestion as a structured user-input runtime request and return keyed answers to the Claude SDK instead of routing the tool through generic approval. Finding: R04 Model: GPT-5.6 Sol via Codex
Translate TodoWrite and ExitPlanMode tool input into canonical todo-list and proposed-plan artifacts so every client can render Claude planning state. Finding: R05 Model: GPT-5.6 Sol via Codex
Load at most one turn-item page per thread in a fork lineage before decoding, keyed by the stable history cursor. Restrict message, plan, and handoff reads to that page plus live actionable state so cold opens and older-page requests no longer decode complete historical tables. Finding: P01 Implemented by GPT-5.6 Sol in Codex.
Budget the serialized bounded projection after retaining live control state. Cap historical control arrays and large plan or handoff details only on the bounded route; the full thread-detail route remains available for complete text. Finding: P02 Implemented by GPT-5.6 Sol in Codex.
Pass the automatic compaction window to Claude and route resume-return dialogs through structured user input so users can compact, continue, or permanently dismiss the prompt. Finding: R06 Model: GPT-5.6 Sol via Codex
Permit the canonical orchestration protocol header in browser API preflights so cross-origin web and desktop clients can negotiate compatibility while retaining authorization and DPoP headers. Finding: D03 Model: GPT-5.6 Sol via Codex
Merge terminal provider updates with stored context usage before replacing the SQLite payload. Keep newer usage reports authoritative and verify the persisted projection after reload. Finding: R07 follow-up Model: GPT-5.6 Sol via Codex
Keep typed plan and todo records distinct from generic tool events, activate captured plans, and supersede older planning state within the owning thread. Ignore nested todo snapshots for the parent and retain identity across duplicate SDK messages. Finding: R05 follow-up Model: GPT-5.6 Sol via Codex
R04 follow-up Convert client multi-select answer arrays to the comma-separated string shape required by the pinned Claude SDK while preserving single-select strings. Implemented by GPT-5.6 Sol via Codex.
Stale cached user and status events could admit and complete a newly submitted OpenCode prompt. Generate the native message ID before submission and only advance admission when that exact message is observed. Finding: R14 Implemented by GPT-5.6 Sol with Codex.
R12 follow-up Insert persistent feedback blocks by their timestamp within the canonical timeline while preserving projected row order. Keep real optimistic sends appended and suppress duplicate local messages already committed by the server. Implemented by GPT-5.6 Sol via Codex.
R20 follow-up Give inspector reasoning markdown its projected source thread and retain the explicit environment fallback for proposed plans without a thread reference. Workspace links and images now resolve through their owning environment after removal of the active-environment fallback. Implemented by GPT-5.6 Sol via Codex.
Read the inclusive cursor, a full history page, and a look-behind row so older history does not terminate after one page. Finding: P01 pagination termination Model: GPT-5.6 Sol via Codex
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
juliusmarminge
force-pushed
the
t3code/codex-turn-mapping
branch
from
September 17, 2026 19:51
a6b73de to
3d45b30
Compare
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration
Bot
force-pushed
the
devin/1789601755-v2-thinking-traces
branch
from
September 17, 2026 20:01
3768fd3 to
4fab841
Compare
juliusmarminge
force-pushed
the
t3code/codex-turn-mapping
branch
16 times, most recently
from
September 19, 2026 04:23
5ff0a93 to
fd8ea2f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
Ports #11784 (
feat(chat): show provider thinking traces) into the V2 orchestration adapters, which the v2 rewrite left behind when it deleted the v1ProviderRuntimeIngestion/ClaudeAdapter/CodexAdapterfiles.CodexAdapterV2: handlesitem/reasoning/summaryTextDeltaanditem/reasoning/textDeltavia a secondmakeCodexAgentMessageDeltaCoalescer, emitting akind: "reasoning"node +type: "reasoning"turn item (streaming: truewhile deltas arrive). Indexed parts (summaryIndex/contentIndex) are joined with\n\n, mirroring main's ingestion.item/completedfor areasoningitem finalizes fromitem.summary/item.content;flushTurnruns at turn end. Summary text keeps the native item id; raw chain-of-thought (when Codex emits it) is a sibling item with id${itemId}:raw.ClaudeAdapterV2:thinkingcontent blocks on a completedassistantSDK message become one completedreasoningitem (${uuid}:thinking), emitted before the assistant text so it orders ahead of the answer. Query options now setshowThinkingSummaries: trueunless thethinkingoption is off or--thinking-display omittedis passed (same rule as main'sshouldRequestClaudeThinkingSummaries).apps/web/session-logic.ts:workEntryIndicatesToolNeutralStatusno longer treats a reasoning entry that has text as neutral. Without this, the completedreasoningitems are persisted but filtered out of the expanded Worked group (workEntryIsVisibleInGroup), so the trace was invisible even after the adapter fix. This also un-hides completed Cursor/OpenCode/Pi/ACP V2 reasoning items, which were already emitted but hidden.Focused tests: Codex replay transcript (summary + raw deltas, indexed separation, completion, ordering vs. final answer), Claude thinking-block projection +
showThinkingSummariesoption rule, and the web neutral-status rule.Why
On
t3code/codex-turn-mapping, Codex and Claude thinking traces are dropped:CodexAdapterV2registered noitem/reasoning/*handlers (despite advertisingstreamsReasoning: true) andClaudeAdapterV2ignoredthinkingblocks. Main's fix (052c7ae) is an ancestor of this branch but only touched v1 files that the V2 rewrite removed, so it merged as a no-op. The V2 contract (reasoningnode/turn item) and the UI mapping (reasoning-> "Thinking" work entry) already existed; only the adapters (and the group visibility rule) needed the port.Reproduction
No Codex/Claude credentials were available, so the repro drives the real web app against the repo's mock Codex app-server (
apps/server/src/provider/testFixtures/codexCollabMockPeer.sh), which replays scripted notifications onturn/start.vp run dev --home-dir <worktree>/.t3, never~/.t3/userdata);providers.codex.binaryPathin that.t3/userdata/settings.jsonpointed atcodexCollabMockPeer.sh; server started withT3_CODEX_COLLAB_SCRIPT=<script.json>.item/started(reasoning), twoitem/reasoning/summaryTextDelta(summaryIndex 0 and 1),item/completed(reasoning with both summaries), then anagentMessagefinal answer.f08294a11(pre-rewrite tip oft3code/codex-turn-mapping)): only the final answer; no Thinking row; the V2 DB contains zero reasoning items.UI Changes
f08294a11(pre-rewrite tip oft3code/codex-turn-mapping))V2 item inspector after the fix, showing
reasoning-1completed with both summaries:Verification
vp test runonCodexAdapterV2.test.ts,ClaudeAdapterV2.test.ts(183 passed) andapps/web/src/session-logic.test.ts.tsc --noEmitforapps/serverandapps/web(only pre-existing@cursor/sdktype errors in Cursor files beforepnpm install; clean after).vp checkon the changed files (only pre-existing unused-variable warnings).Verification blockers: not tested against live Codex or Claude CLIs (no credentials on the test machine), so real streaming timing, raw
textDeltacontent from Codex, and Claudethinkingblocks from the real SDK were only covered by unit tests. Desktop/mobile not exercised; mobile renders V2 work entries throughpackages/client-runtimeand was not changed.Checklist
Written by Devin (Claude) via the Devin harness.