Skip to content

fix(pipeline): forward pinned parameters in thin-source retry logic#795

Open
bastitva0-blip wants to merge 4 commits into
mvanhorn:mainfrom
bastitva0-blip:fix/retry-thin-sources-drops-user-params
Open

fix(pipeline): forward pinned parameters in thin-source retry logic#795
bastitva0-blip wants to merge 4 commits into
mvanhorn:mainfrom
bastitva0-blip:fix/retry-thin-sources-drops-user-params

Conversation

@bastitva0-blip

Copy link
Copy Markdown
Contributor

Summary

This PR fixes a bug in _retry_thin_sources where subreddits, tiktok_hashtags, tiktok_creators, and ig_creators were silently dropped during Phase 2b retry attempts. When these targeted sources returned low-volume data (<3 items) in Phase 1, the fallback retry fired without the user's explicit constraints—falling back to broad public discovery instead of honoring pinned --subreddits, --tiktok-creators, or --ig-creators flags.

Changes

  • Modified File: skills/last30days/scripts/lib/pipeline.py
    • Updated the _retry_thin_sources function signature to accept subreddits, tiktok_hashtags, tiktok_creators, and ig_creators.
    • Updated the primary call site within run() to correctly pass all four parameters down into _retry_thin_sources.
    • Updated _retry_one_source to forward these parameters cleanly into the inner _retrieve_stream call, mirroring the exact signature used in Phase 1.

Why This Matters

Unlike strict 5xx network error retries, the thin-source retry logic fires under regular operational conditions on lower-volume topics. Because it fails silently without throwing an exception, users simply receive weak or misattributed generic fallback results with no warnings. This is particularly problematic for niche brand monitoring where dedicated subreddits naturally have low volume and depend heavily on accurate retries.

Note: trustpilot remains safely isolated from this path via the existing _skip set (line 1159).

Testing

  • Verified that when low-volume/thin streams trigger Phase 2b retries, the explicit subreddits and social creator arrays are preserved in the subsequent stream retrieval signature rather than defaulting to generic public indices.
  • Ran uv run python -m pytest -q --tb=short

Related Issues

  • None (Direct Contribution): Submitted directly as a PR per maintainer guidelines ("I don't assign — submit PRs directly").
  • Structurally Related: This pattern is structurally identical to the parameter dropping fixed in fix(pipeline): pass missing trustpilot params in retry call #794 (the transient error retry bug), but targets the high-frequency thin-source code path across Reddit, TikTok, and Instagram modules.
  • Keywords/Tags: bug, pipeline, social-sources, retry-logic, data-integrity

@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a silent data-integrity bug where subreddits, tiktok_hashtags, tiktok_creators, and ig_creators were dropped from _retry_thin_sources during Phase 2b retries, causing the fallback to ignore the user's explicit pinned constraints.

  • _retry_thin_sources signature gains the four missing parameters, and the only call site in run() is updated to pass them through.
  • _retry_one_source (inner closure) captures those parameters and forwards them to _retrieve_stream, mirroring the Phase 1 call shape exactly.
  • trustpilot remains safely excluded from this retry path via the existing _skip set, so trustpilot_domain / trustpilot_domain_is_hint are intentionally absent here.

Confidence Score: 5/5

Safe to merge — the change is a narrowly scoped parameter-forwarding fix with no new logic, no altered control flow, and a single call site that was verified against the Phase 1 call shape.

The fix adds four keyword-only parameters to _retry_thin_sources and threads them through to _retrieve_stream via the inner closure. The diff is additive and mechanical; the trustpilot exclusion via _skip is pre-existing and correct; no other callers of _retry_thin_sources exist in the codebase; and the new parameter list matches the Phase 1 call shape exactly.

No files require special attention.

Important Files Changed

Filename Overview
skills/last30days/scripts/lib/pipeline.py Adds subreddits/tiktok_hashtags/tiktok_creators/ig_creators forwarding through _retry_thin_sources → _retry_one_source → _retrieve_stream; trustpilot is correctly excluded via the existing _skip set; the one call site in run() is updated; no other callers exist.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant run
    participant _retry_thin_sources
    participant _retry_one_source
    participant _retrieve_stream
    participant reddit/tiktok/instagram

    run->>_retry_thin_sources: "topic, bundle, plan, config, depth,<br/>subreddits, tiktok_hashtags,<br/>tiktok_creators, ig_creators (NEW)"
    _retry_thin_sources->>_retry_thin_sources: "identify thin_sources (<3 items)"
    _retry_thin_sources->>_retry_thin_sources: build retry_subquery (core subject)
    loop for each thin source (threaded)
        _retry_thin_sources->>_retry_one_source: source
        _retry_one_source->>_retrieve_stream: "topic, subquery, source,<br/>subreddits, tiktok_hashtags,<br/>tiktok_creators, ig_creators (NEW)"
        _retrieve_stream->>reddit/tiktok/instagram: query with pinned params honored
        reddit/tiktok/instagram-->>_retrieve_stream: results
        _retrieve_stream-->>_retry_one_source: raw_items
        _retry_one_source-->>_retry_thin_sources: normalized items
    end
    _retry_thin_sources-->>run: bundle updated (in-place)
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant run
    participant _retry_thin_sources
    participant _retry_one_source
    participant _retrieve_stream
    participant reddit/tiktok/instagram

    run->>_retry_thin_sources: "topic, bundle, plan, config, depth,<br/>subreddits, tiktok_hashtags,<br/>tiktok_creators, ig_creators (NEW)"
    _retry_thin_sources->>_retry_thin_sources: "identify thin_sources (<3 items)"
    _retry_thin_sources->>_retry_thin_sources: build retry_subquery (core subject)
    loop for each thin source (threaded)
        _retry_thin_sources->>_retry_one_source: source
        _retry_one_source->>_retrieve_stream: "topic, subquery, source,<br/>subreddits, tiktok_hashtags,<br/>tiktok_creators, ig_creators (NEW)"
        _retrieve_stream->>reddit/tiktok/instagram: query with pinned params honored
        reddit/tiktok/instagram-->>_retrieve_stream: results
        _retrieve_stream-->>_retry_one_source: raw_items
        _retry_one_source-->>_retry_thin_sources: normalized items
    end
    _retry_thin_sources-->>run: bundle updated (in-place)
Loading

Reviews (2): Last reviewed commit: "style: add missing trailing newline at E..." | Re-trigger Greptile

Comment thread skills/last30days/scripts/lib/pipeline.py Outdated
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