Skip to content

fix(widget): per-product proactive opener via product_session cap scope#396

Merged
AutomatosAI merged 1 commit into
mainfrom
fix/proactive-per-product-popup
May 29, 2026
Merged

fix(widget): per-product proactive opener via product_session cap scope#396
AutomatosAI merged 1 commit into
mainfrom
fix/proactive-per-product-popup

Conversation

@AutomatosAI
Copy link
Copy Markdown
Owner

@AutomatosAI AutomatosAI commented May 29, 2026

Summary

  • The proactive opener fired only once per session across every product page, so visiting a second product never re-triggered the popup.
  • Root cause: DEFAULT_WIDGET_PROACTIVE_CONFIG.frequency_cap.scope was "session" — the SDK's buildSlotKey keys a session-scoped cap by pageType alone, giving one shared slot for all products.
  • Fix: default scope → "product_session". The SDK then keys the slot by pageType_productHandle (proactive-engine.ts:51), so the opener fires once per product per session.

Important: existing stores need a backfill

The widget config serve path returns the stored config as-is (no default merge). This PR fixes the default for new stores only. Live stores still carry the old scope: "session" and need their stored widget_proactive.frequency_cap.scope flipped to product_session via PATCH /api/sites/{site_id}/settings (handled separately).

Test plan

  • tests/test_widget_proactive_prd007.py::test_default_widget_proactive_shape updated + passing
  • Verified SDK buildSlotKey honors product_session (keys by product handle)
  • Confirm live store config backfilled before verifying on a real product page

Summary by CodeRabbit

  • New Features
    • Updated Shopify widget frequency cap behavior to limit pop-ups on a per-product per-session basis instead of per-entire-session basis.

Review Change Stack

The proactive opener fired once per session across every product page
because the default frequency_cap.scope was "session" — one shared slot
keyed only by pageType. Moving to "product_session" keys the slot by
product handle (buildSlotKey in the SDK), so the opener fires once per
product per session. Existing stores still carry the old stored value
and need a settings backfill; this fixes the default for new stores.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2795ce4b-a8e0-4dea-936f-11a0182ad3a9

📥 Commits

Reviewing files that changed from the base of the PR and between 51f2f41 and 069a75e.

📒 Files selected for processing (2)
  • orchestrator/api/shopify.py
  • orchestrator/tests/test_widget_proactive_prd007.py

📝 Walkthrough

Walkthrough

Shopify widget proactive configuration's frequency_cap scope is updated from "session" to "product_session", limiting popups to one per product per session rather than one per entire session. Test assertion is updated to match.

Changes

Widget Frequency Cap Scope Update

Layer / File(s) Summary
Product-session frequency cap default and test
orchestrator/api/shopify.py, orchestrator/tests/test_widget_proactive_prd007.py
Default Shopify widget proactive configuration's frequency_cap.scope changed from "session" to "product_session" with added clarifying comments describing per-product behavior. Corresponding test assertion updated to expect "product_session".

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • AutomatosAI/automatos-ai#320: Introduces the PRD-007 default widget proactive configuration in DEFAULT_WIDGET_PROACTIVE_CONFIG that this PR modifies.

Poem

🐰 A widget that's wiser, refined now it knows—
One pop per product, not once for the whole show!
Per-session precision blooms fresh and so bright,
With comments to guide us, the config's just right! 🌸

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating the proactive opener to use product_session scope for per-product behavior instead of session scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/proactive-per-product-popup

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.

@AutomatosAI AutomatosAI merged commit c55f05a into main May 29, 2026
2 checks passed
@AutomatosAI AutomatosAI deleted the fix/proactive-per-product-popup branch May 29, 2026 11:23
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.

2 participants