Skip to content

Conversation

@seefs001
Copy link
Collaborator

@seefs001 seefs001 commented Jan 25, 2026

fix #2523 #2417

Summary by CodeRabbit

  • New Features

    • Introduced task ID mapping system to improve task tracking and synchronization between local and upstream services with robust error handling and backward compatibility support.
    • Enhanced task identification and resolution across integrated services.
  • Infrastructure

    • Updated database migrations to support persistent storage of task mapping data.

✏️ Tip: You can customize this high-level summary in your review settings.

@seefs001 seefs001 marked this pull request as draft January 25, 2026 09:36
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 25, 2026

Walkthrough

Introduces a TaskIDMapping model with database persistence and utility functions to bidirectionally map local task IDs to upstream task IDs. Integrates this mapping system into Gemini and Vertex task adaptors to enable channel-aware task ID resolution with fallback compatibility for legacy-encoded IDs.

Changes

Cohort / File(s) Summary
Migration Setup
model/main.go
Registers TaskIDMapping for database migration in both standard and fast-migration flows.
TaskIDMapping Model
model/task_id_mapping.go
New model defining TaskIDMapping struct with ID, CreatedAt, LocalTaskID, UpstreamTaskID fields. Provides helper functions: CreateTaskIDMapping, NewLocalTaskIDWithChannel, CreateTaskIDMappingWithChannel, GetUpstreamTaskIDByLocalTaskID, GetLocalTaskIDByUpstreamTaskID; includes input validation and not-found handling.
Gemini Task Adaptor
relay/channel/task/gemini/adaptor.go
DoResponse now creates channel-aware local task IDs via mapping and sets CreatedAt/Model fields. FetchTask and ConvertToOpenAIVideo resolve upstream IDs using GetUpstreamTaskIDByLocalTaskID with fallback to legacy decoding. ParseTaskResult populates response using local mapping if available.
Vertex Task Adaptor
relay/channel/task/vertex/adaptor.go
DoResponse creates channel-aware local task IDs via mapping. FetchTask and ConvertToOpenAIVideo resolve upstream IDs with two-step lookup and legacy fallback. New public method GetChannelName() added.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • fix veo3 #2140: Modifies relay/channel/task/gemini/adaptor.go to update task ID encoding and OpenAI video response handling, sharing similar refactoring patterns.
  • feat: vertex veo (#1450) #1659: Directly introduces TaskIDMapping model and integrates the same mapping functions into both Vertex and Gemini adaptor logic.
  • veo #1792: Modifies relay/channel/task/vertex/adaptor.go to change local/upstream task ID production and resolution logic.

Suggested reviewers

  • xyfacai
  • Calcium-Ion

Poem

🐰 Task IDs mapping, local and far,
Through channels they hop, like a star,
Gemini and Vertex, now hand in hand,
Resolving IDs across the land,
Legacy fallbacks keep harmony sweet! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: long task id mapping' accurately describes the main change: introducing task ID mapping functionality to bridge local and upstream task IDs.
Linked Issues check ✅ Passed The PR addresses issue #2523 by introducing a task ID mapping system with bidirectional lookup functions that enable proper handling of long task IDs beyond 191 characters.
Out of Scope Changes check ✅ Passed All changes directly support the task ID mapping objective: model definitions, database migrations, and adapter updates to use the new mapping system across Gemini and Vertex AI.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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