[VS Code] Increase logging during token refresh + consider storing the log permanently
Problem
We face one or more hard-to-reproduce bugs with our OAuth token refresh (&10941). One of the steps towards a solution is to increase logging.
We should also consider options for making the logs non-volatile (i.e. store them for longer than one session), so that when the user notices there is an error, they can send us full log. This could be done, for example, by creating a temp file with the logs (the /tmp
folder gets deleted during system restart which probably happens nowhere near as often as restarting VS Code windows), and storing the name of the temp file in the ExtensionContext.glablState
https://code.visualstudio.com/api/references/vscode-api#ExtensionContext. We would have to consider how to keep the current logging for WebIDE which doesn't have filesystem access.
The logging should be focused on the token refreshing and general access to the secret storage:
- https://gitlab.com/gitlab-org/gitlab-vscode-extension/blob/14e29c5f1b77d19cde09d0a18e08c3f7418a4327/src/desktop/gitlab/token_exchange_service.ts#L79
- https://gitlab.com/gitlab-org/gitlab-vscode-extension/blob/14e29c5f1b77d19cde09d0a18e08c3f7418a4327/src/desktop/accounts/account_service.ts#L183
The pre-requisite for this work should be connecting the extension to the local GDK and reducing the token expiry duration to some much shorter time (currently 2h in prod).