Skip to content

🪢 fix: Settle Compaction Rows Past Anchor Collisions and Legacy Parts - #16552

Draft
berry-13 wants to merge 4 commits into
followup/33-compaction-abort-finalizefrom
followup/33-compaction-collision-settlement
Draft

berry-13 wants to merge 4 commits into
followup/33-compaction-abort-finalizefrom
followup/33-compaction-collision-settlement

Conversation

@berry-13

@berry-13 berry-13 commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

Related to berry-13#33. Stacked on the abort persistence and failed-turn finalization PR; review that one first.

Settling a compaction row after a failure still had gaps at the edges. A settle that only rewrote the envelope left legacy or imported failure parts without the identity marker, so a restored turn kept the wrong rerun target. When the error id collided with the anchor shape, the error row was either suppressed with nothing written or aimed at the anchor id itself. The settled-job guard applied to every turn rather than only compactions, and marking mutated shared parts in place.

This stamps legacy failure parts when settling, redirects a colliding error row to the live response id and withholds it when there is none, keeps pending rows as fallbacks, scopes the settled-job guard to compactions, and copies stamped parts instead of mutating them.

Type of change

  • Bug fix

Testing

Tested environments/configuration: jest for the unit and controller suites; MongoDB and the in-memory job store.

Automated tests:

  • packages/api: npx jest src/agents/compaction.spec.ts plus src/stream/__tests__/abortCompactionIdentity.spec.ts src/stream/__tests__/RedisJobStore.spec.ts: 134 passed
  • npx tsc --noEmit -p packages/api/tsconfig.json: clean
  • api: npx jest on the abort route, request partial disconnect and resume metadata suites: 195 passed

Screenshots / recordings

No user-facing change.

Risk / compatibility

Only compaction turns are affected; ordinary turns no longer pass through the settled-job guard.

Checklist

  • I reviewed my own changes
  • Relevant tests have been added or updated
  • Existing relevant tests pass
  • The change does not introduce new warnings or errors
  • Required documentation PR: N/A

@berry-13
berry-13 added this pull request to stack #16567 September 30, 2026 13:14
@codegraph-librechat codegraph-librechat Bot added the 🗺️ Backend Platform codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9) label Oct 1, 2026
@berry-13
berry-13 force-pushed the followup/33-compaction-collision-settlement branch from 1f2c160 to 676f074 Compare October 3, 2026 16:55
Copilot AI balanced review requested due to automatic review settings October 3, 2026 16:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🗺️ Backend Platform codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants