Skip to content

fix(init): honor RTK_TELEMETRY_DISABLED in consent prompt (#1307)#1369

Open
ousamabenyounes wants to merge 1 commit intortk-ai:developfrom
ousamabenyounes:fix/issue-1307
Open

fix(init): honor RTK_TELEMETRY_DISABLED in consent prompt (#1307)#1369
ousamabenyounes wants to merge 1 commit intortk-ai:developfrom
ousamabenyounes:fix/issue-1307

Conversation

@ousamabenyounes
Copy link
Copy Markdown
Contributor

Summary

  • Short-circuits prompt_telemetry_consent when RTK_TELEMETRY_DISABLED=1 so rtk init no longer hangs in non-interactive environments (devcontainer postCreateCommand, CI agents with pseudo-TTY) where is_terminal() alone is not enough.
  • Keeps the existing TTY fallback untouched; the new env check runs before it.
  • Mirrors the same env var gate already used by telemetry::maybe_ping, so both the prompt and the ping honour the documented opt-out consistently.

Fixes #1307

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test — 1591 pass, 0 clippy errors, format clean
  • Unit test added: test_telemetry_disabled_by_env_honors_opt_out covers unset, "1", and common non-"1" values ("0", "true", "false", "yes", "no", "") — bundled in one #[test] to serialize env-var mutations.
  • Manual review: diff is 57 lines added, 0 removed; no behaviour change when the env var is unset.

Important: All PRs must target the develop branch (not master).
See CONTRIBUTING.md for details.

`rtk init -g --hook-only --auto-patch` hangs in non-interactive
environments (devcontainer postCreateCommand, some CI agents) when
`is_terminal()` returns true on a pseudo-TTY that nobody can answer.
Setting `RTK_TELEMETRY_DISABLED=1` used to only gate `telemetry::maybe_ping`,
so the documented workaround still hit the blocking prompt.

Short-circuit `prompt_telemetry_consent` on that env var before the TTY
heuristic so the init flow exits cleanly in any non-interactive context.

Fixes rtk-ai#1307
@pszymkowiak pszymkowiak added bug Something isn't working effort-small Quelques heures, 1 fichier good first issue Good for newcomers labels Apr 17, 2026
@pszymkowiak
Copy link
Copy Markdown
Collaborator

[w] wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Fixes a hang in rtk init in non-interactive environments (devcontainers, CI with pseudo-TTY) by checking the RTK_TELEMETRY_DISABLED=1 env var before the TTY check in the telemetry consent prompt. This mirrors the existing env var gate in telemetry::maybe_ping for consistency. A unit test covering the opt-out logic is included.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #1307


Analyzed automatically by wshm · This is an automated analysis, not a human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working effort-small Quelques heures, 1 fichier good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants