Skip to content

fix: ensure config.yaml exists and is populated when accessed#11915

Merged
RomneyDa merged 2 commits intomainfrom
dallin/config-loading-bugs
Mar 27, 2026
Merged

fix: ensure config.yaml exists and is populated when accessed#11915
RomneyDa merged 2 commits intomainfrom
dallin/config-loading-bugs

Conversation

@RomneyDa
Copy link
Copy Markdown
Contributor

@RomneyDa RomneyDa commented Mar 27, 2026

Summary

  • Gear icon (open config profile) now creates config.yaml with defaults if the file is missing, matching the behavior on startup
  • Empty config.yaml is detected and populated with the default config instead of causing a parse error

Test plan

  • Delete ~/.continue/config.yaml, click the gear icon in the GUI — file should be created with defaults and opened
  • Create an empty ~/.continue/config.yaml, reload — should be populated with default config
  • Normal startup with existing config.yaml — no behavior change

Summary by cubic

Create and populate config.yaml with defaults when opening the config profile and when the file exists but is empty. This prevents parse errors and aligns behavior with startup.

  • Bug Fixes
    • getConfigYamlPath() now writes defaults if config.yaml is missing or empty, with a simplified existence check for readability.
    • Opening a local config profile (gear icon) calls getConfigYamlPath() first to ensure the file exists with defaults.

Written for commit 2008894. Summary will update on new commits.

- Opening a config profile (gear icon) now creates config.yaml with
  defaults if the file is missing, matching startup behavior
- Empty config.yaml files are detected and populated with default config
  instead of causing parse errors
@RomneyDa RomneyDa requested a review from a team as a code owner March 27, 2026 00:55
@RomneyDa RomneyDa requested review from sestinj and removed request for a team March 27, 2026 00:55
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Mar 27, 2026
@continue
Copy link
Copy Markdown
Contributor

continue bot commented Mar 27, 2026

Docs Review

No documentation updates needed for this PR.

Reason: This is a bug fix that improves the robustness of existing documented behavior. The docs already state that Continue "generates a config.yaml with sensible defaults" (in Understanding Configs). This PR simply ensures that behavior works correctly in additional edge cases (clicking the gear icon, empty config files) without changing the user-facing contract.

The implementation details of when and how the default config is created are internal concerns that don't need to be documented.

@continue
Copy link
Copy Markdown
Contributor

continue bot commented Mar 27, 2026

Test Coverage Review

This PR introduces bug fixes to getConfigYamlPath() that would benefit from regression tests:

Suggested Test Cases for getConfigYamlPath()

  1. New bug fix scenario: When config.yaml exists but is empty → should populate with default config
  2. Existing behavior preserved: When neither config.yaml nor config.json exist → should create config.yaml with defaults
  3. Existing behavior preserved: When config.yaml exists with content → should not overwrite it
  4. Existing behavior preserved: When config.json exists but config.yaml doesn't → should not create config.yaml

Why Tests Are Recommended

Per the project's test expectations for bug fixes: "If a PR fixes a bug, there should be a regression test that reproduces the original bug condition and verifies the fix resolves it."

Currently, there are no existing tests for getConfigYamlPath() in the codebase. Adding tests would prevent regressions of this empty-file handling logic.

Test Location

Tests could be added to a new core/util/paths.vitest.ts file or within the existing core/config/ test files, using the established Vitest pattern.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Mar 27, 2026
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 27, 2026
@RomneyDa RomneyDa merged commit fd7ade8 into main Mar 27, 2026
65 of 66 checks passed
@RomneyDa RomneyDa deleted the dallin/config-loading-bugs branch March 27, 2026 01:19
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Mar 27, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants