feat: static image support in content agent callback#438
feat: static image support in content agent callback#438recoup-coding-agent wants to merge 1 commit intotestfrom
Conversation
Editorial content callback now accepts and posts `imageUrl` alongside video results. Static images are posted before videos in Slack threads. - `contentRunResultSchema` accepts optional `imageUrl` - `postVideoResults` downloads and posts images before videos - 3 new tests for image posting behavior (9 total, all green) Co-Authored-By: Paperclip <noreply@paperclip.ing>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 26 minutes and 1 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
✨ 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.
1 issue found across 3 files
Confidence score: 3/5
- There is a concrete runtime risk in
lib/agents/content/postVideoResults.ts: the non-null assertionv.videoUrl!can fail now thatvideoUrlis optional andimageUrlmay be used instead. - Because this is a user-facing data handling change with severity 7/10, there’s some merge risk even though it’s localized.
- Pay close attention to
lib/agents/content/postVideoResults.ts- optionalvideoUrlis forced non-null and could throw.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="lib/agents/content/postVideoResults.ts">
<violation number="1" location="lib/agents/content/postVideoResults.ts:35">
P1: Custom agent: **Enforce Clear Code Style and Maintainability Practices**
Non-null assertion `v.videoUrl!` applied to every video, but `videoUrl` is optional. Now that `imageUrl` exists as an alternative, a result without `videoUrl` will pass `undefined` to `downloadVideoBuffer` and post literal `"undefined"` to Slack. Filter `videoUrls` the same way `imageUrls` is filtered, and use an index counter in the video-posting loop (as you already do for images).</violation>
</file>
Architecture diagram
sequenceDiagram
participant Agent as Content Agent
participant Logic as postVideoResults
participant CDN as External CDN
participant Slack as Slack Thread API
Note over Agent,Logic: Schema now allows optional imageUrl
Agent->>Logic: Provide VideoResults (runId, videoUrl, imageUrl)
Logic->>Logic: NEW: Collect imageUrls and videoUrls separately
Note over Logic,CDN: Parallel Download (Async)
par
Logic->>CDN: Download Image Buffers
CDN-->>Logic: Buffers or null
and
Logic->>CDN: Download Video Buffers
CDN-->>Logic: Buffers or null
end
Note over Logic,Slack: Posting Phase (Sequential for Slack order)
loop For each VideoResult
opt NEW: imageUrl is present
alt Image Download Success
Logic->>Slack: NEW: post("**Editorial Image**") with PNG file
else Image Download Failed
Logic->>Slack: NEW: post("**Editorial Image:** {url}") text fallback
end
end
end
loop For each VideoResult
alt Video Download Success
Logic->>Slack: post video file (mp4)
else Video Download Failed
Logic->>Slack: post video URL text fallback
end
end
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
| const buffers = await Promise.all(videos.map(v => downloadVideoBuffer(v.videoUrl!))); | ||
| // Collect all URLs to download in parallel | ||
| const imageUrls = videos.map(v => v.imageUrl).filter(Boolean) as string[]; | ||
| const videoUrls = videos.map(v => v.videoUrl!); |
There was a problem hiding this comment.
P1: Custom agent: Enforce Clear Code Style and Maintainability Practices
Non-null assertion v.videoUrl! applied to every video, but videoUrl is optional. Now that imageUrl exists as an alternative, a result without videoUrl will pass undefined to downloadVideoBuffer and post literal "undefined" to Slack. Filter videoUrls the same way imageUrls is filtered, and use an index counter in the video-posting loop (as you already do for images).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At lib/agents/content/postVideoResults.ts, line 35:
<comment>Non-null assertion `v.videoUrl!` applied to every video, but `videoUrl` is optional. Now that `imageUrl` exists as an alternative, a result without `videoUrl` will pass `undefined` to `downloadVideoBuffer` and post literal `"undefined"` to Slack. Filter `videoUrls` the same way `imageUrls` is filtered, and use an index counter in the video-posting loop (as you already do for images).</comment>
<file context>
@@ -17,25 +18,54 @@ interface Thread {
- const buffers = await Promise.all(videos.map(v => downloadVideoBuffer(v.videoUrl!)));
+ // Collect all URLs to download in parallel
+ const imageUrls = videos.map(v => v.imageUrl).filter(Boolean) as string[];
+ const videoUrls = videos.map(v => v.videoUrl!);
+
+ const [imageBuffers, videoBuffers] = await Promise.all([
</file context>
Summary
Test plan
Summary by cubic
Adds static image support to the content agent callback and posts images before videos in Slack threads to improve editorial context. Implements Linear REC-65.
imageUrltocontentRunResultSchema.postVideoResultsdownloads images and videos; posts image first as PNG with "Editorial Image" label; falls back to URL text if image download fails.postVideoResultstests).Written for commit 7db6943. Summary will update on new commits.