Skip to content

Comments

fix(loop): avoid DB tool_call ID collisions from provider IDs#196

Open
ChristmasSun wants to merge 1 commit intoConway-Research:mainfrom
ChristmasSun:fix-tool-call-id-collision
Open

fix(loop): avoid DB tool_call ID collisions from provider IDs#196
ChristmasSun wants to merge 1 commit intoConway-Research:mainfrom
ChristmasSun:fix-tool-call-id-collision

Conversation

@ChristmasSun
Copy link

Summary

Fix a persistence bug where provider tool call IDs were being reused as tool_calls.id primary keys.

The loop was overwriting internally generated ULIDs with provider IDs before DB insert. Provider IDs are not guaranteed globally unique across turns, which can trigger:
UNIQUE constraint failed: tool_calls.id

Changes

  • Keep internal ULID-based ToolCallResult.id in the loop.
  • Do not overwrite it with inference/provider tc.id.
  • Add regression test that reuses the same provider tool-call ID across multiple turns and verifies persisted IDs remain unique.

Testing

  • npx vitest run src/__tests__/loop.test.ts
  • npm test (26 files, 991 tests, all pass)

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.

1 participant