Restore writeTranscript bool return instead of empty-string sentinel · Entire

Restore writeTranscript bool return instead of empty-string sentinel

aeb6150→main·computermode·3w ago·1 file·+12 added/-15 removed

writeTranscript returned a bool on main ("was a transcript written"). The compact-transcript change switched it to return the pointer filename (or "" when nothing was written) so the pointer could target transcript.jsonl. That pointer move was deferred — the metadata pointer is always full.jsonl now — so the string return carried no more information than the bool, just an empty-string sentinel. Restore the bool signature; the caller uses paths.TranscriptFileName directly.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

Sessions

f4a5bc6e74e2View transcript

Changes

1

406 unmodified lines

407 408 409 410 410 411 412 413 414 415 414 415 416 417 418 305 unmodified lines

724 725 726 727 728 729 730 727 728 729 730 731 732 9 unmodified lines

742 743 744 746 745 746 747 748 749 750 752 751 752 753 754 7 unmodified lines

762 763 764 766 765 766 767 768 7 unmodified lines

776 777 778 780 779 780 781 782 12 unmodified lines

795 796 797 799 798 799 800 801 7 unmodified lines

809 810 811 813 812 813 814 4 unmodified lines

819 820 821 824 822 826 823 824 825 826

406 unmodified lines

// Write transcript. The pointer targets full.jsonl, which CLI // rewind/resume/explain read by filename. The compact transcript.jsonl is // also written into the tree (so it is pushed) but is not yet pointed at. transcriptPointer, err := s.writeTranscript(ctx, opts, sessionPath, entries) wroteTranscript, err := s.writeTranscript(ctx, opts, sessionPath, entries) if err != nil { return filePaths, err } if transcriptPointer != "" { filePaths.Transcript = "/" + sessionPath + transcriptPointer if wroteTranscript { filePaths.Transcript = "/" + sessionPath + paths.TranscriptFileName filePaths.ContentHash = "/" + sessionPath + paths.ContentHashFileName } }

305 unmodified lines

// writeTranscript writes the transcript, compact transcript, and content hash // to the checkpoint entries. The compact transcript.jsonl is written into the // tree (so it is pushed alongside full.jsonl) but is not yet referenced by // metadata. Returns the session-relative filename the metadata transcript // pointer should target: full.jsonl, or "" when the transcript was empty and // nothing was written. func (s *GitStore) writeTranscript(ctx context.Context, opts WriteCommittedOptions, basePath string, entries map[string]object.TreeEntry) (string, error) { // metadata. Returns true when a transcript was written, false when it was // empty and nothing was written. func (s *GitStore) writeTranscript(ctx context.Context, opts WriteCommittedOptions, basePath string, entries map[string]object.TreeEntry) (bool, error) { logCtx := logging.WithComponent(ctx, "checkpoint") transcriptBytes := opts.Transcript.Bytes()

9 unmodified lines

if len(rawData) > 0 { redacted, redactErr := redact.JSONLBytes(rawData) if redactErr != nil { return "", fmt.Errorf("failed to redact transcript from file: %w", redactErr) return false, fmt.Errorf("failed to redact transcript from file: %w", redactErr) } transcriptBytes = redacted.Bytes() } } if len(transcriptBytes) == 0 { return "", nil return false, nil }

if opts.Agent == agent.AgentTypeCodex { 7 unmodified lines

if err != nil { chunkTranscriptSpan.RecordError(err) chunkTranscriptSpan.End() return "", fmt.Errorf("failed to chunk transcript: %w", err) return false, fmt.Errorf("failed to chunk transcript: %w", err) } chunkTranscriptSpan.End() chunkDuration := time.Since(chunkStart) 7 unmodified lines

if err != nil { writeTranscriptBlobsSpan.RecordError(err) writeTranscriptBlobsSpan.End() return "", err return false, err } entries[chunkPath] = object.TreeEntry{ Name: chunkPath, 12 unmodified lines

if err != nil { contentHashSpan.RecordError(err) contentHashSpan.End() return "", err return false, err } entries[basePath+paths.ContentHashFileName] = object.TreeEntry{ Name: basePath + paths.ContentHashFileName, 7 unmodified lines

// full.jsonl for now — pointing it at the compact transcript is deferred to // a later change. s.writeCompactTranscript(logCtx, opts.Agent, opts.CheckpointTranscriptStart, transcriptBytes, basePath, entries) pointerFile := paths.TranscriptFileName

logging.Debug(logCtx, "write transcript timings", slog.String("session_id", opts.SessionID), 4 unmodified lines

slog.Int64("write_transcript_content_hash_ms", time.Since(contentHashStart).Milliseconds()), slog.Int("transcript_bytes", len(transcriptBytes)), slog.Int("chunk_count", len(chunks)), slog.String("transcript_pointer", pointerFile), ) return pointerFile, nil return true, nil }

// compactAgentName resolves the agent slug used in compact transcript lines