-
-
Notifications
You must be signed in to change notification settings - Fork 272
Fix GitHub issue report enabled by default - interactive config not being respected #2708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix GitHub issue report enabled by default - interactive config not being respected #2708
Conversation
|
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: bfae15d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…ot working Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
|
@copilot I don't think you need to modify the bin script, but make sure the user-provided configuration works as expected #2354 (comment) I'd imagine you can reproduce the error first, write the tests case for the fix, and finally the fix itself |
…on override Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
You're absolutely right. I've reverted the bin script changes and fixed the actual bug - the CLI was always overriding the user config with TTY auto-detection. The fix (commit 319fea7) simply removes the problematic auto-detection code from Added two test files:
All 877 tests pass ✅ |
|
@copilot did you confirm those tests will fail if you don't touch the bin script? |
… the bug Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
You're right - my original tests only tested I've added a new test (commit 769269f) that explicitly demonstrates the bug by testing // This shows how the bug worked:
const fileConfig = { interactive: false };
const cliConfigWithBug = { interactive: true }; // Bug: bin script set this
const merged = mergeConfigs(fileConfig, cliConfigWithBug);
expect(merged.interactive).toBe(true); // This was the bug - it overrode file configThis test documents the behavior that the bin script fix prevents - when CLI config has |
|
@copilot maybe we just want to move the default value setting from bin script to src? It has some valuable parts such as the use of environment flags. We want to use those if the user didn't explicitly provide value. Make sure we have tests for that too |
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Good suggestion! I've moved the TTY detection logic from the bin script to The
Added 6 new tests verifying each environment variable and TTY condition. All 884 tests pass ✅ |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2708 +/- ##
==========================================
+ Coverage 25.12% 26.25% +1.13%
==========================================
Files 386 386
Lines 37351 37363 +12
Branches 1783 1864 +81
==========================================
+ Hits 9385 9811 +426
+ Misses 27953 27539 -414
Partials 13 13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@copilot run the linter and commit the changes to fix the lint issues |
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
|
@copilot fix typecheck issues |
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Fixed typecheck issues in commit bfae15d. The changes:
All tests pass and typecheck is clean ✅ |
commit: |
Fix GitHub issue report enabled by default - interactive config not being respected
Problem
Users reported that the GitHub issue report prompt always appeared when the program crashed, even when:
interactive: falsewas set in configuration filesinteractiveshould default tofalseThe root cause was in the CLI entry point (
bin/index.cjs) which was always overriding theinteractivesetting based on TTY detection, completely ignoring any user configuration:This meant that config files with
interactive: falsewere completely ignored.Solution
Moved the TTY detection logic from
bin/index.cjstosrc/config/init.tswhere it's used as a smart fallback only when the user doesn't explicitly configure theinteractiveoption.How it works now:
interactive: User value is always respected (from config file or API)interactive: Falls back todetectInteractiveSession()which checks:process.stdin.isTTY- Is stdin a TTY?process.stdout.isTTY- Is stdout a TTY?!process.env.CI- Not in CI environment!process.env.NO_INTERACTIVE- NO_INTERACTIVE not set!process.env.NO_INTERACTION- NO_INTERACTION not setThis preserves the valuable environment variable checks (CI, NO_INTERACTIVE, NO_INTERACTION) while ensuring user configuration is never overridden.
Changes Made
Config System (
src/config/init.ts)detectInteractiveSession()function: Detects if session is interactive using TTY + environment variablesuserConfig.interactiveisundefinedTesting
Added comprehensive tests:
interactive.test.ts: Tests config-level behaviormergeConfigsbehavior showing how the bug overrode file configdetectInteractiveSession():falsewhenCIenvironment variable is setfalsewhenNO_INTERACTIVEenvironment variable is setfalsewhenNO_INTERACTIONenvironment variable is setfalsewhen stdin is not TTYfalsewhen stdout is not TTYtruewhen TTY is available and no blocking env vars are seterror.test.ts: Tests theshouldReportCrashfunction behaviorManual testing confirms:
interactive: falseprevents crash report promptinteractive: trueshows crash report promptBackward Compatibility
This change is fully backward compatible:
Example Usage
Via config file (explicit):
{ "input": "spec.json", "output": "./client", "interactive": false }Via environment variable:
The fix preserves the valuable TTY and environment variable logic while ensuring user configuration is never overridden.
Fixes #2354
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.