Skip to content

feat: static image support in content agent callback#438

Open
recoup-coding-agent wants to merge 1 commit intotestfrom
feature/rec-65-editorial-static-image
Open

feat: static image support in content agent callback#438
recoup-coding-agent wants to merge 1 commit intotestfrom
feature/rec-65-editorial-static-image

Conversation

@recoup-coding-agent
Copy link
Copy Markdown
Collaborator

@recoup-coding-agent recoup-coding-agent commented Apr 14, 2026

Summary

  • Add imageUrl field to content agent callback schema
  • postVideoResults downloads and posts static images before videos in Slack threads
  • Images labeled Editorial Image, posted as PNG files

Test plan

  • 3 new tests for image posting behavior
  • All 76 content agent tests pass (9 postVideoResults tests total)

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.

  • New Features
    • Add optional imageUrl to contentRunResultSchema.
    • postVideoResults downloads images and videos; posts image first as PNG with "Editorial Image" label; falls back to URL text if image download fails.
    • Add 3 tests for image behavior; all content agent tests pass (9 postVideoResults tests).

Written for commit 7db6943. Summary will update on new commits.

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>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recoup-api Ready Ready Preview Apr 14, 2026 9:02pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

Warning

Rate limit exceeded

@recoup-coding-agent has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 26 minutes and 1 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ad40512c-adb4-4ffb-b52b-b50667f82fea

📥 Commits

Reviewing files that changed from the base of the PR and between b9341e3 and 7db6943.

⛔ Files ignored due to path filters (1)
  • lib/agents/content/__tests__/postVideoResults.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
📒 Files selected for processing (2)
  • lib/agents/content/postVideoResults.ts
  • lib/agents/content/validateContentAgentCallback.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/rec-65-editorial-static-image

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.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 assertion v.videoUrl! can fail now that videoUrl is optional and imageUrl may 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 - optional videoUrl is 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
Loading

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!);
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Fix with Cubic

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