Skip to content

Context drops the order being continued when it's longer than the completion window #433

Closed

Description

@robelest

fetchRecentAndSearchMessages reads the recent page, then one more page of at most 1,000 messages to finish the oldest order (#317). If that order is still incomplete, trimIncompleteOldestOrder drops all of it. When that order is the one being continued (promptMessageId), the model loses its prompt and, for approvals, the decision, so an approved tool doesn't run.

Found in review of #427: with default settings, a continued order of 1,104 messages reads 100 + 1,000 rows and keeps none of them (reproduced with simulated query pages). This affects every caller; excludeToolMessages only changes which rows count. The order being continued should never be trimmed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions