Skip to content

[upstream #16551] Compaction abort can orphan its response when the anchor is deleted after the existence check #248

Description

@berry-13

Raised by the local cross-family review of LibreChat-AI#16551 (finding local:73acf4a:L-002).

The compaction abort path in api/server/routes/agents/index.js asks resolveAbortedTurnAnchorDecision (packages/api) whether the projected anchor row exists, then saves the aborted response with that anchor as parentMessageId. If the anchor row is deleted between the existence read and the save (a user deleting the message while Stop is in flight), the response is written as an orphan.

The window predates LibreChat-AI#16551: on dev the abort route saves without any anchor check, and LibreChat-AI#16551 narrows it to the read-to-write span. Closing it needs a conditional, parent-checked write in a data-schemas method (or a transaction) rather than a separate existence read, the same shape as the fix for #232.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: apireviewctl followups statearea: packagesreviewctl followups stateblocked: root openreviewctl followups statebugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions