feat(video): support Agnes task status and result URLs - #6699
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (6)
WalkthroughThe Sora adapter now uses Agnes-specific status URLs and extracts Agnes metadata video URLs. The video proxy accepts validated Agnes result URLs without channel authentication. Other providers retain their standard endpoints and bearer authentication. ChangesAgnes video URL handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant VideoProxy
participant TaskAdapter
participant AgnesAPI
VideoProxy->>TaskAdapter: resolve task result URL
TaskAdapter->>AgnesAPI: fetch /agnesapi?video_id={taskID}
AgnesAPI-->>TaskAdapter: return metadata.url
TaskAdapter-->>VideoProxy: provide validated result URL
VideoProxy->>AgnesAPI: request result URL without channel authentication
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@controller/video_proxy.go`:
- Around line 116-120: Update the Authorization header assignment in the
content-request flow around resolveOpenAIVideoContentURL to prefer
task.PrivateData.Key when present, falling back to channel.Key only when the
stored task key is unavailable. Preserve the existing Bearer format and apply
this credential selection for both non-Agnes content and Agnes fallback
requests.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f48fa880-bbd4-4f95-9832-90c740f362f1
📒 Files selected for processing (6)
controller/video_proxy.gocontroller/video_proxy_test.gorelay/channel/task/sora/adaptor.gorelay/channel/task/sora/adaptor_test.gorelay/channel/task/taskcommon/provider.gorelay/channel/task/taskcommon/provider_test.go
| var useChannelAuth bool | ||
| videoURL, useChannelAuth = resolveOpenAIVideoContentURL(baseURL, task.GetUpstreamTaskID(), task.GetResultURL()) | ||
| if useChannelAuth { | ||
| req.Header.Set("Authorization", "Bearer "+channel.Key) | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Reuse the stored task credential for content requests.
For non-Agnes content and Agnes fallback requests, Line 119 uses mutable channel.Key. A key rotation or per-task key causes the content request to use a different credential than task submission.
Use task.PrivateData.Key when it is present. Use channel.Key only as a legacy fallback.
Proposed fix
case constant.ChannelTypeOpenAI, constant.ChannelTypeSora:
var useChannelAuth bool
videoURL, useChannelAuth = resolveOpenAIVideoContentURL(baseURL, task.GetUpstreamTaskID(), task.GetResultURL())
if useChannelAuth {
- req.Header.Set("Authorization", "Bearer "+channel.Key)
+ apiKey := task.PrivateData.Key
+ if apiKey == "" {
+ apiKey = channel.Key
+ }
+ req.Header.Set("Authorization", "Bearer "+apiKey)
}Based on learnings, follow-up requests must reuse authentication captured at task submission time and prefer task.PrivateData.Key.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| var useChannelAuth bool | |
| videoURL, useChannelAuth = resolveOpenAIVideoContentURL(baseURL, task.GetUpstreamTaskID(), task.GetResultURL()) | |
| if useChannelAuth { | |
| req.Header.Set("Authorization", "Bearer "+channel.Key) | |
| } | |
| var useChannelAuth bool | |
| videoURL, useChannelAuth = resolveOpenAIVideoContentURL(baseURL, task.GetUpstreamTaskID(), task.GetResultURL()) | |
| if useChannelAuth { | |
| apiKey := task.PrivateData.Key | |
| if apiKey == "" { | |
| apiKey = channel.Key | |
| } | |
| req.Header.Set("Authorization", "Bearer "+apiKey) | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@controller/video_proxy.go` around lines 116 - 120, Update the Authorization
header assignment in the content-request flow around
resolveOpenAIVideoContentURL to prefer task.PrivateData.Key when present,
falling back to channel.Key only when the stored task key is unavailable.
Preserve the existing Bearer format and apply this credential selection for both
non-Agnes content and Agnes fallback requests.
Source: Learnings
b2183c2 to
77f2b2e
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
77f2b2e to
6ea8f13
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Important
📝 变更描述 / Description
为 Agnes 官方 API 主机
apihub.agnes-ai.com补充异步视频任务兼容:/agnesapi?video_id=<id>。metadata.url,并由现有视频代理在 SSRF 校验后转发该绝对 URL。/v1/videos/{id}、/content路径和鉴权逻辑。AI assistance disclosure: This change was prepared with AI assistance. The scope constraints, implementation, and tests were reviewed during preparation; no credentials or deployment changes are included.
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
Summary by CodeRabbit