Skip to content

fix: wire video_presentation fan-in as a barrier so generate_slide_scene_codes fires once#1563

Open
mvanhorn wants to merge 1 commit into
MODSetter:devfrom
mvanhorn:fix/1531-video-presentation-fanin-barrier
Open

fix: wire video_presentation fan-in as a barrier so generate_slide_scene_codes fires once#1563
mvanhorn wants to merge 1 commit into
MODSetter:devfrom
mvanhorn:fix/1531-video-presentation-fanin-barrier

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Re-opening #1538 against the dev branch as requested by @MODSetter.

The video-presentation agent graph now uses a LangGraph list-based fan-in edge so the slide-generation node runs once after all upstream nodes complete, instead of once per incoming edge.

Description

The presentation node was wired to multiple upstream nodes with separate edges, so LangGraph triggered it once per completed predecessor rather than as a single join, producing duplicate slide-generation passes. This switches those edges to a list-based fan-in edge, which creates a proper barrier so the node runs exactly once.

Motivation and Context

Fixes #1531

Screenshots

N/A — backend agent-graph change with no visual surface.

API Changes

  • This PR includes API changes

Change Type

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation
  • Dependency/Build system
  • Breaking change

Testing Performed

  • Tested locally
  • Manual/QA verification

Added unit tests under surfsense_backend/tests/unit/agents/ that drive the graph and assert the fan-in node is triggered exactly once.

Checklist

  • Follows project coding standards and conventions

Summary by CodeRabbit

  • Bug Fixes

    • Updated the video presentation workflow so scene code generation waits for both required preparation steps to finish before running.
    • Prevented scene code generation from running more than once when branches complete at different times.
  • Tests

    • Added unit coverage for the new workflow behavior, including execution order and single-trigger validation.
    • Added a state-based test to confirm the join behavior remains consistent across staggered completion timing.

High-level PR Summary

This PR fixes a bug in the video presentation agent graph where the slide scene generation node was being triggered multiple times instead of once. The fix changes the fan-in pattern from separate edges to a single list-based barrier edge, ensuring that generate_slide_scene_codes runs exactly once after both create_slide_audio and assign_slide_themes complete. Unit tests are added to verify the single-trigger behavior and execution order, including a test case that validates the barrier works correctly even when branches complete at different times.

⏱️ Estimated Review Time: 15-30 minutes

💡 Review Order Suggestion
Order File Path
1 surfsense_backend/app/agents/video_presentation/graph.py
2 surfsense_backend/tests/unit/agents/test_video_presentation_graph.py

Need help? Join our Discord

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3f3923c1-0c24-4b20-86bd-941089b6e23c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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