8000 fix(agents-api): preserve history when summarization fails by jihtsan · Pull Request #3589 · inkeep/agents · GitHub
[go: up one dir, main page]

Skip to content

fix(agents-api): preserve history when summarization fails - #3589

Open
jihtsan wants to merge 1 commit into
inkeep:mainfrom
jihtsan:codex/3586-preserve-history-on-compression-failure
Open

jihtsan wants to merge 1 commit into
inkeep:mainfrom
jihtsan:codex/3586-preserve-history-on-compression-failure

Conversation

@jihtsan
@jihtsan jihtsan commented Nov 11, 2026
Copy link
Copy Markdown

Changes

When conversation summarization fails, return the fallback messages for the current turn without writing a compression summary. Artifact collection normalizes copies of the message rows, so retained tool results still render during fallback. Later turns can retry, and identifiable failed summaries already in storage no longer hide preceding messages.

The conversation compression span records the failure. The mid-generation fallback keeps its existing behavior.

Closes #3586.

Verification

  • Reproduced the provider rejection and artifact fallback persisting invalid summaries on main. Reproduced a retained tool result becoming blank before the final artifact normalization correction.
  • Ran 131 tests across 10 API files, including six new regression cases. These exercise the real compressor, distillation and history retrieval with PGlite and a stubbed model provider. The cases cover rejection, tool result rendering, successful retry, trace status, and legacy and explicit fallback summaries.
  • Passed pnpm --filter @inkeep/agents-api typecheck, pnpm --filter @inkeep/agents-api lint, pnpm format:check, pnpm check:changeset-packages, and the staged pre-commit check, which runs the full API suite. Used Node 22.22.1 and pnpm 12.8.1.
  • The monorepo pnpm check did not complete successfully. Two CLI tests timed out during that run. All 12 tests across those two CLI files passed when rerun in isolation. Regression tests did not call a live model or an external database.

@changeset-bot
changeset-bot Bot commented Nov 11, 2026
Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 67f62b9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@inkeep/agents-api Patch
@inkeep/agents-manage-ui Patch
@inkeep/agents-cli Patch
@inkeep/agents-core Patch
@inkeep/agents-email Patch
@inkeep/agents-mcp Patch
@inkeep/agents-sdk Patch
@inkeep/agents-work-apps Patch
@inkeep/ai-sdk-provider Patch
@inkeep/create-agents Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector
chatgpt-codex-connector Bot commented Nov 11, 2026 •
Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T01:24:45.418886Z 67f62b9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions
Copy link
Copy Markdown
Contributor

Thanks for the contribution!

What happens next:

  • A maintainer will review your PR.
  • If you don't hear back within a few business days, please comment here to nudge our team.
  • This repository is maintained through an internal mirror. When your change is accepted, this PR will close automatically. Don't be alarmed when it closes — that's how it merges, and your authorship is preserved.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 67f62b91c1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +686 to +687
if (Array.isArray(compressionResult.summary)) {
return compressionResult.summary;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Apply the fallback array on the recompression path

When history includes a prior successful summary (for example with messageTypes: []) and summarization fails after the newer messages require truncation, this returns the reduced message array, but getConversationHistoryWithCompression discards it in its wasRecompressed === false branch and reuses messagesAfterCompression. Previously summarized conversations therefore bypass the current-turn fallback and can still exceed the primary model's context window during a summarizer outage. Keep the prior summary, but append recompressResult rather than the original post-summary messages.

Useful? React with 👍 / 👎.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has not had recent activity.
It will be closed in 7 days if no further activity occurs.

If this PR is still relevant:

  • Rebase it on the latest main branch
  • Add a comment explaining its current status
  • Request a review if it's ready

Thank you for your contributions!

@github-actions github-actions Bot added the stale label Nov 19, 2026

This branch is waiting to be deployed

1 waiting deployment
inkeep-oss-sync — 67f62b91 Waiting Nov 11, 2026 by jihtsan via sync #2685
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conversation compression: summarizer failure permanently replaces history with a placeholder (or empty) summary

1 participant

0