Skip to content

Conversation

@visualDust
Copy link
Owner

Bug: as titled. caused by I rarely restoring previous sessions before so didnt notice this bug.

OpenAI's API have some restrictions, tool messages had timestamps from when they were executed (during permission handling), not when saved. When storage was sorted by timestamp, tool messages appeared before their parent assistant messages, creating invalid sequences for that API. When loading messages within the token budget, the truncation could include tool messages but exclude their parent assistant messages with tool_calls.

So timestamp sorting was removed, and added a workaround that add parent assistant message for orphaned tool messages.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants