Skip to content

[Checkpoints V2] Tag "thinking" lines for compact transcript#973

Draft
computermode wants to merge 2 commits intomainfrom
add-thinking-lines-compact-transcript
Draft

[Checkpoints V2] Tag "thinking" lines for compact transcript#973
computermode wants to merge 2 commits intomainfrom
add-thinking-lines-compact-transcript

Conversation

@computermode
Copy link
Copy Markdown
Contributor

@computermode computermode commented Apr 17, 2026

Adds "thinking..." tags to their corresponding message blocks in the compact transcript.

(Work in progress + this doesn't gate shipping checkpoints V2 and this information isn't consumed by the CLI or UI. It was requested internally.)


Note

Medium Risk
Changes the normalized transcript.jsonl output by retaining assistant thinking content for claude-code and emitting Gemini thoughts as thinking blocks, which may affect any downstream consumers expecting thinking to be stripped or thinking-only assistant lines to be dropped.

Overview
Compact transcript output now preserves assistant “thinking” content. For claude-code JSONL compaction, thinking blocks are kept (while redacted_thinking remains dropped), which also means assistant messages containing only thinking are no longer filtered out.

Gemini compaction now includes thoughts. Gemini messages’ thoughts[] are converted into {"type":"thinking","thinking":"..."} blocks and prepended to assistant content; tests and fixtures are updated accordingly.

Reviewed by Cursor Bugbot for commit 46c8809. Configure here.

Entire-Checkpoint: 5e0dbcccf51a
Entire-Checkpoint: c4da4bf56e17
Copilot AI review requested due to automatic review settings April 17, 2026 05:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the compact transcript generator to include explicit thinking blocks (and Gemini thoughts) in the emitted content arrays, so “thinking” can be associated with the surrounding assistant message blocks in the compact JSONL format.

Changes:

  • Preserve Claude Code thinking blocks (while still dropping redacted_thinking) during compacting.
  • Emit Gemini thoughts as {"type":"thinking","thinking":"..."} blocks in compact output (including thought-only assistant messages).
  • Update compact transcript fixtures and unit tests to expect the new thinking blocks.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cmd/entire/cli/transcript/compact/compact.go Adds a preserve-thinking path for Claude Code and updates assistant-content stripping to keep thinking blocks.
cmd/entire/cli/transcript/compact/compact_test.go Adjusts compact tests to expect preserved thinking blocks (including thinking-only assistant).
cmd/entire/cli/transcript/compact/gemini.go Adds Gemini thoughts parsing and emits them as thinking blocks in compact transcripts.
cmd/entire/cli/transcript/compact/gemini_test.go Adds test coverage for a Gemini assistant message with only thoughts (no content/tool calls).
cmd/entire/cli/transcript/compact/testdata/claude_expected.jsonl Updates expected Claude fixture output to include a thinking block.
cmd/entire/cli/transcript/compact/testdata/claude_expected2.jsonl Updates expected Claude fixture output to include thinking blocks (including empty thinking markers).
cmd/entire/cli/transcript/compact/testdata/gemini_expected.jsonl Updates expected Gemini fixture output to include thought-derived thinking blocks.

if preserveThinking && blockType == "thinking" {
stripped := make(map[string]json.RawMessage)
copyField(stripped, block, "type")
copyField(stripped, block, "thinking")
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

stripAssistantContent now preserves Claude thinking blocks (including the full thinking text) when opts.Agent == "claude-code". Since the redaction package doesn't appear to scrub thinking content, this can persist chain-of-thought / potentially sensitive reasoning into checkpoint metadata and increase transcript size. If the intent is only to tag that thinking occurred, consider emitting only a marker (e.g., keep type:"thinking" but blank/omit the thinking field, or replace with a constant placeholder) rather than storing the full text.

Suggested change
copyField(stripped, block, "thinking")
stripped["thinking"] = json.RawMessage(`"[thinking omitted]"`)

Copilot uses AI. Check for mistakes.
Comment on lines +163 to +182
for _, thought := range msg.Thoughts {
thinkingText := geminiThoughtText(thought)
if thinkingText == "" {
continue
}

blockType, err := json.Marshal("thinking")
if err != nil {
continue
}
thinking, err := json.Marshal(thinkingText)
if err != nil {
continue
}

content = append(content, map[string]json.RawMessage{
"type": blockType,
"thinking": thinking,
})
}
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

emitGeminiAssistant serializes thoughts into output thinking blocks containing the full subject/description text. If the goal is just to tag that thinking occurred (as the PR title/description suggest), persisting the full thought text may unintentionally store sensitive chain-of-thought into the compact transcript. Consider emitting a marker-only thinking block (or dropping the description content) and relying on other fields for analytics.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants