-
Notifications
You must be signed in to change notification settings - Fork 92
feat(coding-agent): show generated session summaries in the resume picker #2155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
flora131
merged 24 commits into
bastani-inc:main
from
MarkAronov:feat/resume-session-summaries
Aug 12, 2026
Merged
Changes from 5 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
3a1313b
feat(coding-agent): persist per-session resume summaries
MarkAronov 2ac8b8b
Merge branch 'main' of https://github.com/bastani-inc/atomic into fea…
MarkAronov 5208463
feat(coding-agent): generate resume summaries when the agent goes idle
MarkAronov 74733f0
feat(coding-agent): show session summaries in the resume picker
MarkAronov 7afbdfe
feat(coding-agent): cancel, reseed and document session summaries
MarkAronov aedba63
Merge remote-tracking branch 'upstream/main' into feat/resume-session…
MarkAronov 9107f60
fix(coding-agent): stop a failed session summary from rejecting
MarkAronov 2946af1
fix(coding-agent): cancel the session summary at the right point in p…
MarkAronov 3bd7336
fix(coding-agent): apply one retirement rule to summaries, and honour…
MarkAronov 209144e
fix(coding-agent): cancel an in-flight session summary on tree naviga…
MarkAronov 9fc2a84
Merge remote-tracking branch 'upstream/main' into feat/resume-session…
MarkAronov aee30eb
Merge remote-tracking branch 'upstream/main' into feat/resume-session…
MarkAronov 9d340ab
fix(coding-agent): generate session summaries at a real idle boundary
MarkAronov 99ee61a
Merge remote-tracking branch 'upstream/main' into feat/resume-session…
MarkAronov 7eb28a1
Merge remote-tracking branch 'upstream/main' into feat/resume-session…
MarkAronov 83a4fc3
fix(coding-agent): collapse overlapping session-summary launches into…
MarkAronov 3563414
Merge branch 'main' into feat/resume-session-summaries
MarkAronov 63ec766
fix(test): keep the cycle-fallback request count to the prompt turn
MarkAronov 9bcb071
Merge branch 'main' into feat/resume-session-summaries
MarkAronov 7f30478
fix(coding-agent): render session summaries in a dedicated picker column
flora131 68e5250
fix(coding-agent): regenerate session summary after branch retirement
flora131 543ec1a
fix(coding-agent): restore the released 0.9.13-alpha.2 changelog section
flora131 c46bc9c
chore: retrigger CI
flora131 6654fac
Merge remote-tracking branch 'origin/main' into pr-2155
flora131 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| /** | ||
| * Session summary generation for the resume picker. | ||
| * | ||
| * Runs once the agent goes idle, decides whether a fresh summary is worth generating, and | ||
| * persists the result. Generation itself lives in core/compaction/session-summarization.ts. | ||
| */ | ||
|
|
||
| import type { AgentSessionInternalSurface as AgentSession } from "./agent-session-methods.ts"; | ||
| import { generateSessionSummary } from "./compaction/index.ts"; | ||
| import { getLastConversationMessageId, getLatestSessionSummary } from "./session-manager-entries.ts"; | ||
|
|
||
| /** Sessions shorter than this are already legible from their first message. */ | ||
| const MIN_ENTRIES_FOR_SUMMARY = 4; | ||
|
|
||
| export async function _maybeGenerateSessionSummary(this: AgentSession): Promise<void> { | ||
| // --- Bail-outs, cheapest first ------------------------------------------------------ | ||
| if (!this.settingsManager.getSessionSummarySettings().enabled) return; | ||
|
|
||
| // One-shot scripted runs should not pay for a background call; the process may exit before | ||
| // it lands. "tui" and "rpc" are the resumable, interactive modes. | ||
| if (this._extensionMode === "print" || this._extensionMode === "json") return; | ||
|
|
||
| if (this.isStreaming || this.isCompacting) return; | ||
| const model = this.model; | ||
| if (!model) return; | ||
|
|
||
| // Workflow-stage sessions are excluded from /resume entirely. | ||
| if (this.sessionManager.getHeader()?.internal) return; | ||
|
|
||
| const branch = this.sessionManager.getBranch(); | ||
| if (branch.length < MIN_ENTRIES_FOR_SUMMARY) return; | ||
|
|
||
| const throughId = getLastConversationMessageId(branch); | ||
| if (!throughId) return; | ||
|
|
||
| // On a resumed session the in-memory anchor starts empty, so fall back to the persisted | ||
| // summary. Without this the first idle after every resume regenerates a summary that is | ||
| // already current. | ||
| const lastSummarized = | ||
| this._lastSummarizedMessageId ?? getLatestSessionSummary(this.sessionManager.getEntries())?.summarizedThroughId; | ||
| if (throughId === lastSummarized) return; | ||
|
greptile-apps[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| // Claim the run. The token answers "is this still the current attempt, and is this state | ||
| // still mine to touch?" after the awaits below; the controller lives on the session so | ||
| // abortSessionSummary() can reach it from the prompt and shutdown paths. | ||
| this.abortSessionSummary(); | ||
| const sessionSummaryToken = ++this._sessionSummaryToken; | ||
| this._sessionSummaryAbortController = new AbortController(); | ||
| const signal = this._sessionSummaryAbortController.signal; | ||
|
|
||
| try { | ||
| const { apiKey, headers, baseUrl } = await this._getRequiredRequestAuth(model); | ||
| const result = await generateSessionSummary(branch, { | ||
| model, | ||
| apiKey, | ||
| headers, | ||
| baseUrl, | ||
| signal, | ||
| streamFn: this.agent.streamFunction, | ||
| retry: this.settingsManager.getRetrySettings(), | ||
| }); | ||
| // Failures stay silent: nothing awaits this, and the picker falls back on its own. | ||
| if (result.aborted || result.error || !result.summary) return; | ||
|
|
||
| // A newer run, or a newer message, means this summary no longer describes the session. | ||
| if (this._sessionSummaryToken !== sessionSummaryToken) return; | ||
| if (getLastConversationMessageId(this.sessionManager.getBranch()) !== throughId) return; | ||
|
|
||
| this.sessionManager.appendSessionSummary(result.summary, throughId, result.usage); | ||
|
greptile-apps[bot] marked this conversation as resolved.
|
||
| this._lastSummarizedMessageId = throughId; | ||
| } finally { | ||
| if (this._sessionSummaryToken === sessionSummaryToken) { | ||
| this._sessionSummaryAbortController = undefined; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| export function abortSessionSummary(this: AgentSession): void { | ||
| this._sessionSummaryAbortController?.abort(); | ||
| } | ||
|
greptile-apps[bot] marked this conversation as resolved.
|
||
|
|
||
| export const agentSessionSummaryMethods = { _maybeGenerateSessionSummary, abortSessionSummary }; | ||
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.