Add timeout to explain summary generation - #876
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a default timeout around AI summary generation to prevent the explain --generate (and other shared summarization call sites) from hanging indefinitely.
Changes:
- Add a 30s context timeout wrapper inside
summarize.GenerateFromTranscript. - Improve Claude CLI generator error handling to surface context cancellation/timeouts consistently.
- Update
explainsummary generation to emit a user-facing “Generating…” message and add a unit test for timeout behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| cmd/entire/cli/summarize/summarize.go | Adds a default timeout and timeout-specific error handling around generator execution. |
| cmd/entire/cli/summarize/generator_config_test.go | Adds a new unit test intended to validate timeout behavior. |
| cmd/entire/cli/summarize/claude.go | Returns context.DeadlineExceeded / context.Canceled when the context ends during Claude CLI execution. |
| cmd/entire/cli/explain.go | Wires through an error writer and prints progress text while generating a checkpoint summary. |
Contributor
Author
|
@BugBot review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 1b2851e. Configure here.
Entire-Checkpoint: c8bb257f3d46
Entire-Checkpoint: 512e7cbbecb7
peyton-alt
force-pushed
the
fix/explain-summary-timeout
branch
from
April 10, 2026 04:46
66c2071 to
5c18bb6
Compare
pjbgf
approved these changes
Apr 10, 2026
Soph
enabled auto-merge
April 10, 2026 11:31
peyton-alt
added a commit
that referenced
this pull request
May 14, 2026
Two paired user-facing improvements to `entire explain --generate`: 1. Live progress on TTY. summaryProgressWriter renders agent.GenerationProgress events from the streaming generator as provider-neutral phase lines: "Sending request to provider...", "Provider responded (TTFT Xs, Nk cached input tokens)", "Writing summary... (~Nk tokens)", "Summary generated (Ds, N output tokens)". In-place line updates on TTY; one line per event in non-TTY/CI. ACCESSIBLE=1 swaps the styled glyphs (→ / ✓) for ASCII (-> / *) and suppresses ANSI escapes. 2. Observable-state timeout diagnostic. When --summary-timeout-seconds fires, the error message is built from captured subprocess state, not a generic three-cause list. Streaming providers (Claude) get phase- specific attribution: "never sent its request" / "received no response" / "responded but did not finish". Non-streaming providers (Codex/ Cursor/Copilot/Gemini) surface captured stderr and distinguish "produced no output" from "was generating output when killed". The three-cause shrug message from PR #876 is removed. Adds summaryAttempt as the diagnostic state value type (separate from the UI writer), providerCLIName for binary-name lookup, and *agent.TextGenerationError for the non-streaming provider stderr-capture path through RunIsolatedTextGeneratorCLI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7 tasks
peyton-alt
added a commit
that referenced
this pull request
May 20, 2026
Two paired user-facing improvements to `entire explain --generate`: 1. Live progress on TTY. summaryProgressWriter renders agent.GenerationProgress events from the streaming generator as provider-neutral phase lines: "Sending request to provider...", "Provider responded (TTFT Xs, Nk cached input tokens)", "Writing summary... (~Nk tokens)", "Summary generated (Ds, N output tokens)". In-place line updates on TTY; one line per event in non-TTY/CI. ACCESSIBLE=1 swaps the styled glyphs (→ / ✓) for ASCII (-> / *) and suppresses ANSI escapes. 2. Observable-state timeout diagnostic. When --summary-timeout-seconds fires, the error message is built from captured subprocess state, not a generic three-cause list. Streaming providers (Claude) get phase- specific attribution: "never sent its request" / "received no response" / "responded but did not finish". Non-streaming providers (Codex/ Cursor/Copilot/Gemini) surface captured stderr and distinguish "produced no output" from "was generating output when killed". The three-cause shrug message from PR #876 is removed. Adds summaryAttempt as the diagnostic state value type (separate from the UI writer), providerCLIName for binary-name lookup, and *agent.TextGenerationError for the non-streaming provider stderr-capture path through RunIsolatedTextGeneratorCLI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
peyton-alt
added a commit
that referenced
this pull request
May 20, 2026
Two paired user-facing improvements to `entire explain --generate`: 1. Live progress on TTY. summaryProgressWriter renders agent.GenerationProgress events from the streaming generator as provider-neutral phase lines: "Sending request to provider...", "Provider responded (TTFT Xs, Nk cached input tokens)", "Writing summary... (~Nk tokens)", "Summary generated (Ds, N output tokens)". In-place line updates on TTY; one line per event in non-TTY/CI. ACCESSIBLE=1 swaps the styled glyphs (→ / ✓) for ASCII (-> / *) and suppresses ANSI escapes. 2. Observable-state timeout diagnostic. When --summary-timeout-seconds fires, the error message is built from captured subprocess state, not a generic three-cause list. Streaming providers (Claude) get phase- specific attribution: "never sent its request" / "received no response" / "responded but did not finish". Non-streaming providers (Codex/ Cursor/Copilot/Gemini) surface captured stderr and distinguish "produced no output" from "was generating output when killed". The three-cause shrug message from PR #876 is removed. Adds summaryAttempt as the diagnostic state value type (separate from the UI writer), providerCLIName for binary-name lookup, and *agent.TextGenerationError for the non-streaming provider stderr-capture path through RunIsolatedTextGeneratorCLI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
peyton-alt
added a commit
that referenced
this pull request
Jul 21, 2026
Two paired user-facing improvements to `entire explain --generate`: 1. Live progress on TTY. summaryProgressWriter renders agent.GenerationProgress events from the streaming generator as provider-neutral phase lines: "Sending request to provider...", "Provider responded (TTFT Xs, Nk cached input tokens)", "Writing summary... (~Nk tokens)", "Summary generated (Ds, N output tokens)". In-place line updates on TTY; one line per event in non-TTY/CI. ACCESSIBLE=1 swaps the styled glyphs (→ / ✓) for ASCII (-> / *) and suppresses ANSI escapes. 2. Observable-state timeout diagnostic. When --summary-timeout-seconds fires, the error message is built from captured subprocess state, not a generic three-cause list. Streaming providers (Claude) get phase- specific attribution: "never sent its request" / "received no response" / "responded but did not finish". Non-streaming providers (Codex/ Cursor/Copilot/Gemini) surface captured stderr and distinguish "produced no output" from "was generating output when killed". The three-cause shrug message from PR #876 is removed. Adds summaryAttempt as the diagnostic state value type (separate from the UI writer), providerCLIName for binary-name lookup, and *agent.TextGenerationError for the non-streaming provider stderr-capture path through RunIsolatedTextGeneratorCLI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

Summary
Adds a timeout to checkpoint summary generation for
entire explain --generateso the command cannot hang indefinitely when the Claude CLI stalls.What Changed
explain --generateinexplain.gosummarize.GenerateFromTranscriptgeneric for other call sitesGenerating checkpoint summary...whileexplain --generateis waitingWhy
A stalled Claude summary generation path currently leaves users waiting without a bounded failure mode. This change keeps the fix narrowly scoped to
explain --generateinstead of changing shared summarize behavior for other callers.Current state before this fix:
entire explain --generate^Cfailed to generate summary: failed to generate summary: claude CLI failed (exit -1):Verification
go test ./cmd/entire/cli -run 'TestGenerateCheckpointAISummary|TestExplainCmd_RejectsPositionalArgs'go test ./cmd/entire/cli/summarizemise run lintmise run test