Skip to content

Commit 0bed518

Browse files
zardusclaude
andcommitted
discord-feedback: don't require the Discord token when resume skips scraping
The Discord bot token was validated unconditionally at startup, before the resume fast-path that re-attaches to an already-opened PR and only watches it. That fast-path never touches Discord, so a fresh shell without the token (e.g. a new screen window) couldn't resume a watch at all -- it died with "DISCORD_BOT_TOKEN is not set" despite needing no Discord access. Move the token requirement to point-of-use, right before the scrape. Resumes that skip the scrape now run without it; a real scrape still fails fast with the same clear message. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 4f2d878 commit 0bed518

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

tools/feedback/discord-feedback

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3389,11 +3389,10 @@ def feedback_command(
33893389
raise click.ClickException("--create-pr requires --apply.")
33903390
if create_pr and skip_tests:
33913391
raise click.ClickException("--create-pr cannot be combined with --skip-tests.")
3392+
# The Discord token is only needed to scrape. A resume that skips the scrape (notably the
3393+
# fast-path that re-attaches to an already-opened PR) must not require it -- otherwise a
3394+
# fresh shell without the token can't even resume a watch. Validated at point-of-use below.
33923395
token = os.environ.get(token_env)
3393-
if not token:
3394-
raise click.ClickException(
3395-
f"{token_env} is not set. Create a Discord bot token and export it first."
3396-
)
33973396
resuming = bool(resume_run_id) or resume_latest
33983397
if resume_run_id and resume_latest:
33993398
raise click.ClickException("Use either --resume or --resume-latest, not both.")
@@ -3486,6 +3485,10 @@ def feedback_command(
34863485
until = utc_now()
34873486
since = resolve_scrape_since(repo, until, hours, DEFAULT_FALLBACK_HOURS)
34883487

3488+
if not token:
3489+
raise click.ClickException(
3490+
f"{token_env} is not set. Create a Discord bot token and export it first."
3491+
)
34893492
api = DiscordAPI(token)
34903493
click.echo(f"Scraping Discord messages since {since.isoformat()} into {artifact_dir}")
34913494
channels, channels_by_id = discover_channels(

0 commit comments

Comments
 (0)