-
Notifications
You must be signed in to change notification settings - Fork 339
fix(session): fail closed when tool-output eviction artifacts are unavailable #3969
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11645,10 +11645,21 @@ export class AgentSession { | |
| options?: { commitGate?: (actual: { prunedCount: number; tokensSaved: number }) => boolean }, | ||
| ): Promise<{ prunedCount: number; tokensSaved: number; committed: boolean } | undefined> { | ||
| const branchEntries = this.sessionManager.getBranch(); | ||
| const artifactManager = this.sessionManager.getArtifactManager(); | ||
| // Prefer ensureArtifactManager so in-memory / non-persistent sessions get an | ||
| // ephemeral store (or a visible install failure) instead of silently pruning | ||
| // without durable eviction. Fail closed when tool-output eviction is planned | ||
| // but no artifact store can be established. | ||
| const artifactManager = await this.sessionManager.ensureArtifactManager(); | ||
| const prunedArtifacts: Array<{ entryId: string; id: string; toolType: string; originalText: string }> = []; | ||
| let reservedArtifactId: string | undefined; | ||
| let artifactAllocationAvailable = artifactManager !== null; | ||
| const pruneEstimate = estimateToolOutputPruneSavings(branchEntries, DEFAULT_PRUNE_CONFIG, { | ||
| relaxedMinimum: overThreshold ? 0 : undefined, | ||
| artifactRefMaxChars: PRUNED_ARTIFACT_REF_MAX_CHARS, | ||
| }); | ||
| if (!artifactManager && pruneEstimate.prunableCount > 0) { | ||
| return undefined; | ||
|
Comment on lines
+11660
to
+11661
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a session already has an Useful? React with 👍 / 👎. |
||
| } | ||
| if (artifactManager) { | ||
| try { | ||
| reservedArtifactId = (await artifactManager.allocatePath("tool-output")).id; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the user-visible mid-run maintenance outcome and artifact-preservation behavior in
packages/coding-agent, but the commit adds no entry underpackages/coding-agent/CHANGELOG.md→Unreleased, so the fix will be absent from the package's release notes. Add a conciseFixedentry for the fail-closed behavior.AGENTS.md reference: AGENTS.md:L178-L178
Useful? React with 👍 / 👎.