Skip to content

Conversation

@etraut-openai
Copy link
Collaborator

@etraut-openai etraut-openai commented Jan 14, 2026

When an invalid config.toml key or value is detected, the CLI currently just quits. This leaves the VSCE in a dead state.

This PR changes the behavior to not quit and bubble up the config error to users to make it actionable. It also surfaces errors related to "rules" parsing.

This allows us to surface these errors to users in the VSCE, like this:

Screenshot 2026-01-13 at 4 29 22 PM Screenshot 2026-01-13 at 4 45 06 PM

When an invalid config.toml key or value is detected, the CLI currently just quits. This leaves the VSCE in a dead state.

This PR changes the behavior to not quit and bubble up the config error to users to make it actionable. It also surfaces errors related to "rules" parsing.
@etraut-openai etraut-openai changed the title Improved handling of config errors when using the app server Improve handling of config and rules errors for app server clients Jan 14, 2026
.with(otel_logger_layer)
.with(otel_tracing_layer)
.try_init();
for warning in &config_warnings {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If warnings is non-empty, should we start up or should we just exit?

Admittedly, this would be more palatable if we were able to help the user find the errant config.toml and fix it...

Copy link
Collaborator Author

@etraut-openai etraut-openai Jan 14, 2026

Choose a reason for hiding this comment

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

We should definitely start up. The current code just exits, and that leaves the user with a broken experience in the VSCE (just a spinner with no indication of a failure).

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ConfigWarningNotification {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I realize it is not easy to do, but it would probably be most helpful if we could include the file (or files) that caused the issue and then helped the user open them in VS Code so they can make the necessary fixes and then reload?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I thought about that. I didn't want to make this PR more complicated. Could be a follow-on PR.


match load_exec_policy(config_stack).await {
Ok(policy) => Ok((policy, None)),
Err(err @ ExecPolicyError::ParsePolicy { .. }) => Ok((Policy::empty(), Some(err))),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar to falling back to a default config, falling back to an empty could be particularly harmful/confusing for a user.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agree — that's why it's important to surface the warning to them.

Copy link
Collaborator

Choose a reason for hiding this comment

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

#9187 should help a bit so that at least all ExecPolicyError variants have a PathBuf associated with them.

Maybe we should have a sources: Vec<PathBuf> on ConfigWarningNotification now, even if it's just an empty array, so we can start experimenting with building UI against it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can you think of a case where we need multiple paths? Shouldn't we always be able to map an error to a specific file?

Also, do you think we should go so far as to provide a line number and character offset? Or even a character range?

This is a slippery slope which is why I kind of didn't want to go there right now since my main objective is to just keep the VSCE from hanging on startup.

Copy link
Collaborator

@bolinfest bolinfest left a comment

Choose a reason for hiding this comment

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

I like the UI in your screenshots, but in VS Code, we might want to use vscode.window.showErrorMessage() as well, just in case our sidebar is closed?

@etraut-openai etraut-openai merged commit 31d9b6f into main Jan 14, 2026
32 checks passed
@etraut-openai etraut-openai deleted the etraut/config_errors branch January 14, 2026 01:57
@github-actions github-actions bot locked and limited conversation to collaborators Jan 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants