-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve reporting auth errors (#6639)
Fixes https://linear.app/sourcegraph/issue/CODY-4648 ## Changes This PR improves error reporting if auth configuration is broken. ![image](https://github.com/user-attachments/assets/96766d33-6070-4bf0-95ef-82a350a9a16d) ## Test plan 1. Configure custom auth provider as described in #6526 2. Change config to be invalid, e.g. in the `commandLine` change `echo` to `echox` and save a config. 3. You should get logged out and see a detailed error message describing what is wrong. 4. Fix the issue and save the config, error should disappear and you should be logged in back.
- Loading branch information
Showing
12 changed files
with
194 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 9 additions & 2 deletions
11
...ib/src/main/kotlin/com/sourcegraph/cody/agent/protocol_generated/CodyContextFilterItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport") | ||
package com.sourcegraph.cody.agent.protocol_generated; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
data class CodyContextFilterItem( | ||
val repoNamePattern: String, | ||
val repoNamePattern: RepoNamePatternEnum, // Oneof: .* | ||
val filePathPatterns: List<String>? = null, | ||
) | ||
) { | ||
|
||
enum class RepoNamePatternEnum { | ||
@SerializedName(".*") Wildcard, | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python3 | ||
import json | ||
import time | ||
from datetime import datetime | ||
|
||
def generate_credentials(): | ||
current_epoch = int(time.time()) + 100 | ||
|
||
credentials = { | ||
"headers": { | ||
"Authorization": "Bearer SomeUser", | ||
"Expiration": current_epoch, | ||
}, | ||
"expiration": current_epoch | ||
} | ||
|
||
# Print JSON to stdout | ||
print(json.dumps(credentials)) | ||
|
||
if __name__ == "__main__": | ||
generate_credentials() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters