Skip to content

env: register DEGRADED_TRANSCRIPT_THRESHOLD so .env value is picked up#737

Open
23241a6749 wants to merge 2 commits into
mvanhorn:mainfrom
23241a6749:fix/degraded-transcript-threshold-env-registration
Open

env: register DEGRADED_TRANSCRIPT_THRESHOLD so .env value is picked up#737
23241a6749 wants to merge 2 commits into
mvanhorn:mainfrom
23241a6749:fix/degraded-transcript-threshold-env-registration

Conversation

@23241a6749

Copy link
Copy Markdown
Contributor

Problem

DEGRADED_TRANSCRIPT_THRESHOLD was missing from the env.py keys tuple. Users who set this value in their .env file found it silently ignored:

  • _is_youtube_degraded() in quality_nudge.py:199 reads via config.get('DEGRADED_TRANSCRIPT_THRESHOLD')
  • config.get() always returned None because the key was never loaded from .env into the config dict
  • The default of 0.5 was used regardless of the user's .env setting

This is the same bug pattern as FUN_LEVEL (#707), GITHUB_TOKEN (#724), and LAST30DAYS_REPORT_CACHE_TTL_SECONDS (#732).

Fix

Register ('DEGRADED_TRANSCRIPT_THRESHOLD', None) in the env.py keys tuple (one line). Same pattern as every other env var in the list.

Impact

Users who explicitly configure DEGRADED_TRANSCRIPT_THRESHOLD in .env will now have it picked up correctly. No behavior change for users relying on the default.

@greptile-apps

greptile-apps Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR registers DEGRADED_TRANSCRIPT_THRESHOLD in env.py's keys tuple so values set in .env are loaded into the config dict, and adds corresponding documentation in CONFIGURATION.md.

  • env.py: Adds ('DEGRADED_TRANSCRIPT_THRESHOLD', None) to the get_config keys list, following the same pattern as other recently-fixed vars (FUN_LEVEL, GITHUB_TOKEN, LAST30DAYS_REPORT_CACHE_TTL_SECONDS). The default None causes quality_nudge.py line 199's or DEFAULT_DEGRADED_TRANSCRIPT_THRESHOLD fallback to fire correctly for unconfigured environments.
  • CONFIGURATION.md: Adds a new "YouTube degraded-run detection" section explaining the threshold semantics (ratio of fetched transcripts to eligible videos), with accurate worked examples for looser and stricter values and the 0-to-disable escape hatch.

Confidence Score: 5/5

Safe to merge — one-line key registration that unblocks a user-visible config knob, with accurate documentation added alongside it.

The change is minimal and follows an identical pattern used for three prior fixes in the same file. The threshold value flows through the or operator in quality_nudge.py correctly for all meaningful inputs including the string '0' (which is truthy and resolves to float('0') = 0.0, matching the documented 'disable' behaviour). No new code paths, no schema changes, no side effects for users relying on the default.

No files require special attention.

Important Files Changed

Filename Overview
skills/last30days/scripts/lib/env.py Adds the missing key registration for DEGRADED_TRANSCRIPT_THRESHOLD; one-line, correct pattern, no issues.
CONFIGURATION.md Adds documentation for the newly-active env var; threshold semantics, examples, and the 'set to 0 to disable' guidance all match the actual code logic in quality_nudge.py.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant dotenv as .env file
    participant envpy as env.py get_config()
    participant config as config dict
    participant nudge as quality_nudge.py

    dotenv->>envpy: "DEGRADED_TRANSCRIPT_THRESHOLD=0.3"
    Note over envpy: keys tuple now includes<br/>('DEGRADED_TRANSCRIPT_THRESHOLD', None)
    envpy->>config: "config['DEGRADED_TRANSCRIPT_THRESHOLD'] = '0.3'"
    nudge->>config: config.get('DEGRADED_TRANSCRIPT_THRESHOLD')
    config-->>nudge: '0.3'
    Note over nudge: float('0.3') = 0.3<br/>(was always None → used default 0.5)
    nudge->>nudge: _is_youtube_degraded(results, 0.3)
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 dotenv as .env file
    participant envpy as env.py get_config()
    participant config as config dict
    participant nudge as quality_nudge.py

    dotenv->>envpy: "DEGRADED_TRANSCRIPT_THRESHOLD=0.3"
    Note over envpy: keys tuple now includes<br/>('DEGRADED_TRANSCRIPT_THRESHOLD', None)
    envpy->>config: "config['DEGRADED_TRANSCRIPT_THRESHOLD'] = '0.3'"
    nudge->>config: config.get('DEGRADED_TRANSCRIPT_THRESHOLD')
    config-->>nudge: '0.3'
    Note over nudge: float('0.3') = 0.3<br/>(was always None → used default 0.5)
    nudge->>nudge: _is_youtube_degraded(results, 0.3)
Loading

Reviews (3): Last reviewed commit: "docs: document DEGRADED_TRANSCRIPT_THRES..." | Re-trigger Greptile

('EXCLUDE_SOURCES', ''),
('LAST30DAYS_DEFAULT_SEARCH', ''),
('LAST30DAYS_YOUTUBE_SSH_HOST', None),
('DEGRADED_TRANSCRIPT_THRESHOLD', None),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 CONFIGURATION.md not updated

AGENTS.md says CONFIGURATION.md must be kept in sync with user-facing knobs. DEGRADED_TRANSCRIPT_THRESHOLD is explicitly called out in quality_nudge.py as operator-tunable ("Tunable via DEGRADED_TRANSCRIPT_THRESHOLD env var if operators need to adjust without code changes"), so it qualifies. Now that the key is actually loaded from .env, users who discover it in quality_nudge.py comments won't find any documentation in CONFIGURATION.md describing the expected range, units (ratio 0–1), or effect.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Codex Fix in Claude Code Fix in Cursor Fix in Conductor

Users who set DEGRADED_TRANSCRIPT_THRESHOLD in .env found it silently
ignored — the key was missing from the env.py keys tuple, so config.get()
always returned None even when the .env file had a value.
This caused _is_youtube_degraded() to always use the default 0.5
threshold regardless of the user's .env setting.
@23241a6749
23241a6749 force-pushed the fix/degraded-transcript-threshold-env-registration branch from 73d097f to 4e16ee7 Compare July 3, 2026 13:27
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