Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/api-key/command_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (c *command) delete(cmd *cobra.Command, args []string) error {

errs := multierror.Append(err, c.deleteKeysFromKeyStore(deletedIds))
if errs.ErrorOrNil() != nil {
return errors.NewErrorWithSuggestions(err.Error(), errors.ApiKeyNotFoundSuggestions)
return errors.NewErrorWithSuggestions(errs.Error(), errors.ApiKeyNotFoundSuggestions)
Comment on lines 48 to +50
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

errs can include failures from deleteKeysFromKeyStore (which ultimately calls Config.Save()), not just API-key-not-found/forbidden errors. Wrapping all aggregated errors with errors.ApiKeyNotFoundSuggestions will produce misleading guidance when the underlying failure is a local config/keystore write error. Consider branching on the error source (e.g., only attach ApiKeyNotFoundSuggestions when the delete API call failed; otherwise return/wrap the config-save error with a more relevant message/suggestions).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is a valid point, but the purpose of the PR is just to triage the panic.

Comment on lines 48 to +50
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

There’s no automated regression test covering the scenario described in the PR (API delete succeeds but updating the local config/keystore fails), which previously caused a panic. Please add a unit/integration test that forces Config.Save()/keystore.DeleteAPIKey to error and asserts api-key delete returns a non-nil error (and does not crash).

Copilot uses AI. Check for mistakes.
}

return nil
Expand Down