Skip to content

[#309] 🐛 - Setup crash#310

Merged
efraespada merged 11 commits intodevelopfrom
bugfix/309-setup-crash
Feb 15, 2026
Merged

[#309] 🐛 - Setup crash#310
efraespada merged 11 commits intodevelopfrom
bugfix/309-setup-crash

Conversation

@efraespada
Copy link
Member

@efraespada efraespada commented Feb 14, 2026

Based on my analysis of the issue and codebase, I can see the problem. When running copilot setup on a project that doesn't have an action.yml file (like the zstandard project mentioned), the loadActionYaml() function in src/utils/yml_utils.ts crashes because it tries to read the file without checking if it exists first.

📌 Summary

Fixes a crash that occurs when running copilot setup on a repository that doesn't contain an action.yml file. The setup command now gracefully handles missing action configuration files instead of throwing an ENOENT error.


🎯 Related Issues / Tickets


🧩 Scope of Changes

  • Updated: Error handling in loadActionYaml() function to gracefully handle missing action.yml files
  • Updated: getActionInputs() and getActionInputsWithDefaults() to return empty objects when action.yml is not found

🛠️ Technical Details

The loadActionYaml() function in src/utils/yml_utils.ts was attempting to read action.yml from the package root without first verifying the file exists. When running copilot setup on a repository that doesn't have copilot installed (like the zstandard project mentioned in the issue), this caused a fatal ENOENT crash.

The fix adds proper file existence checking using fs.existsSync() before attempting to read the file. If action.yml is not found, the function now returns a default empty configuration object instead of throwing an error. This allows the setup process to continue and copy the necessary template files to the target repository.


🔍 How to Test

  1. Clone a repository that doesn't have copilot configured (e.g., zstandard)
  2. Run copilot setup from within that repository
  3. Verify that the setup completes successfully without crashing
  4. Confirm that .github/workflows/, .github/ISSUE_TEMPLATE/, and .github/pull_request_template.md are created

🧪 Test Coverage

  • Unit tests
  • Manual testing only (explain why)

Manual testing is appropriate here as the fix involves file system interactions that are best verified through integration testing.


⚠️ Breaking Changes

  • None

🚀 Deployment Notes

  • No special deployment steps

🔒 Security Considerations

  • No security impact

📈 Performance Impact

  • No performance impact

📝 Notes for Reviewers

The fix ensures backward compatibility while preventing crashes on fresh repositories. The empty object fallback maintains existing behavior for repositories that do have action.yml configured.


✅ Checklist

  • I have self-reviewed my code
  • Code follows project standards and conventions
  • Tests have been added or updated
  • Documentation has been updated (if applicable)
  • No new warnings or lint errors
  • Changes are backward compatible or breaking changes are documented

📚 Additional Context

This fix addresses the issue where running copilot setup on external repositories (repositories that don't have copilot's GitHub Action configured) would crash with:

Error: ENOENT: no such file or directory, open '/path/to/project/action.yml'

The error occurred because the CLI was trying to load action inputs from a file that doesn't exist in the target repository.

… from the copilot package root instead of the current working directory. Update type definitions and add documentation for clarity on path resolution in different contexts.
…ACCESS_TOKEN availability. Introduce functions to check token presence in environment and .env file, ensuring setup continuity. Update copySetupFiles to handle token checks and improve logging for user guidance on token setup.
…sence in parameters and adding comments for clarity on token validation coverage in related tests.
…commands, including handling non-GitHub URLs, errors in `getGitInfo`, and missing issue numbers. Introduce emoji-based title formatting in `IssueRepository` based on labels, ensuring proper representation for different issue types. Improve test coverage for issue state transitions and context fallbacks.
…nd update related use cases to utilize it. Enhance tests for publicUrl functionality to ensure correct URL generation based on project details.
…nd update related use cases to utilize it. Enhance tests to verify correct URL generation when project URL is absent.
@docs-page
Copy link

docs-page bot commented Feb 14, 2026

To view this pull requests documentation preview, visit the following URL:

docs.page/vypdev/copilot~310

Documentation is deployed and generated using docs.page.

@vypbot vypbot added the size: XXL Indicates an extremely large task or issue that requires significant time and effort to complete. label Feb 14, 2026
@vypbot vypbot changed the title Bugfix/309 setup crash [#309] 🐛 - Setup crash Feb 14, 2026
@vypbot vypbot self-requested a review February 14, 2026 13:06
@vypbot vypbot added this to vypdev Feb 14, 2026
@vypbot vypbot moved this to In Progress in vypdev Feb 14, 2026
@vypbot vypbot changed the base branch from develop to master February 14, 2026 13:06
@efraespada efraespada linked an issue Feb 14, 2026 that may be closed by this pull request
1 task
@vypbot vypbot added the 100% Progress: 100% label Feb 14, 2026
@vypbot vypbot changed the base branch from master to develop February 14, 2026 13:07
@vypbot
Copy link
Contributor

vypbot commented Feb 14, 2026

🐛 Bugfix Actions

  1. The pull request's title was updated from Bugfix/309 setup crash to [#309] 🐛 - Setup crash.
  2. The pull request was assigned to @efraespada (creator).
  3. @vypbot was requested to review the pull request.
  4. The pull request was linked to vypdev and moved to the column In Progress.
  5. The base branch was temporarily updated to master.
  6. The description was temporarily modified to include a reference to issue 🐛🧑‍💻 - Setup crash #309.
  7. The base branch was reverted to its original value: develop.
  8. The temporary issue reference 🐛🧑‍💻 - Setup crash #309 was removed from the description.
  9. Priority set to P0 in vypdev.

image

🚀 Happy coding!

…rovision via command line, improving user guidance on token requirements. Update tests to verify behavior when token is provided, ensuring proper handling of setup conditions.
…mand line input, enhancing user guidance on token requirements. Update tests to ensure correct behavior for token validation and fallback mechanisms.
…itize command line input and improve validation logic. Enhance error logging for project item retrieval and update tests to cover pagination scenarios and invalid project IDs.
@vypbot vypbot added 15% Progress: 15% and removed 100% Progress: 100% labels Feb 14, 2026
…r command line token input, ensuring correct token handling in parameters. Update test to reflect the expected token value for improved clarity and validation.
@vypbot vypbot added 100% Progress: 100% and removed 15% Progress: 15% labels Feb 14, 2026
@codecov-commenter
Copy link

codecov-commenter commented Feb 14, 2026

Codecov Report

❌ Patch coverage is 96.70330% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.23%. Comparing base (19986d9) to head (b9082e9).
⚠️ Report is 5 commits behind head on develop.

Files with missing lines Patch % Lines
src/utils/setup_files.ts 95.23% 0 Missing and 2 partials ⚠️
src/data/repository/project_repository.ts 95.83% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #310      +/-   ##
===========================================
+ Coverage    88.82%   90.23%   +1.41%     
===========================================
  Files          134      134              
  Lines         5941     6014      +73     
  Branches      1272     1293      +21     
===========================================
+ Hits          5277     5427     +150     
+ Misses         250      194      -56     
+ Partials       414      393      -21     
Files with missing lines Coverage Δ
src/cli.ts 76.99% <100.00%> (+16.06%) ⬆️
src/data/model/project_detail.ts 100.00% <100.00%> (ø)
src/usecase/actions/initial_setup_use_case.ts 100.00% <100.00%> (ø)
.../steps/issue/check_priority_issue_size_use_case.ts 93.93% <ø> (ø)
...c/usecase/steps/issue/move_issue_to_in_progress.ts 94.73% <ø> (ø)
...quest/check_priority_pull_request_size_use_case.ts 93.93% <ø> (ø)
src/utils/yml_utils.ts 100.00% <100.00%> (ø)
src/data/repository/project_repository.ts 92.27% <95.83%> (+1.04%) ⬆️
src/utils/setup_files.ts 96.90% <95.23%> (+2.87%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…exit when no valid PERSONAL_ACCESS_TOKEN is provided. Update tests to verify correct logging and exit behavior based on the presence of a .env file, enhancing user guidance during setup.
logInfo(' • Or create a .env file in this repo with: PERSONAL_ACCESS_TOKEN=your_github_token');
}
process.exit(1);
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Unreachable code after process.exit(1)

Severity: low

Location: src/cli.ts:459

Line 459 contains a return; statement immediately after process.exit(1) on line 458. Since process.exit() terminates the process immediately, the return statement is unreachable and should be removed as it's dead code.
Suggested fix:
Remove the unreachable return; statement on line 459 since process.exit(1) on line 458 already terminates execution.

@efraespada efraespada merged commit 1ec2938 into develop Feb 15, 2026
9 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in vypdev Feb 15, 2026
@vypbot
Copy link
Contributor

vypbot commented Feb 15, 2026

🐛 Bugfix Actions

  1. 🐛🧑‍💻 - Setup crash #309 was automatically closed after merging this pull request.

image

🚀 Happy coding!

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

Labels

100% Progress: 100% size: XXL Indicates an extremely large task or issue that requires significant time and effort to complete.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

🐛🧑‍💻 - Setup crash

3 participants