Conversation
e88e8b5 to
f620dd1
Compare
fa711aa to
b16f48a
Compare
|
What more would you need to see added for this to be considered "complete system of identification" @matifali? |
I think when
|
See my commnet on issue: #20 (comment) |
b16f48a to
93e3a75
Compare
| getResponseIDFunc: getAnthropicResponseID, | ||
| createRequest: createAnthropicMessagesReq, | ||
| expectedMsgID: "msg_01Pvyf26bY17RcjmWfJsXGBn", | ||
| userAgent: "GitHubCopilotChat/0.37.2026011603", |
There was a problem hiding this comment.
Nice 👍 This is the one used for Copilot in VSCode.
nit: maybe you could also add a test for Copilot CLI, user agent is usually something like User-Agent: copilot/0.0.403 (client/cli linux v24.11.1)
There was a problem hiding this comment.
Oh good call; we probably want to distinguish the CLI and VS Code versions (and others).
| Model string | ||
| Provider string | ||
| StartedAt time.Time | ||
| UserAgent string |
There was a problem hiding this comment.
Since we already have Client do we need to store this? Wouldn't it be possible to add it to Metadata?
There was a problem hiding this comment.
I would consider UserAgent a separate entity from Metadata.
The way we store it in coder DB (as part of metadata) is an implementation detail. If AI Bridge would be part of coder/coder repo then yes it would make sense to add it to metadata here.
There was a problem hiding this comment.
I would consider UserAgent a separate entity from Metadata.
Why is that? I'm not too familiar with how metadata is used in aibridge.
I think storing client as a separate field makes sense since it's data we validate and generate ourselves. But the raw user agent header is just additional context that may not always be relevant (e.g., when client is "unknown").
Since the user agent ends up being added to metadata in coder anyway, couldn't we just add it directly to metadata here and skip the extra field/proto changes?
This is a non-blocking comment: I'm not saying this is wrong, just trying to understand the reasoning 🙂
There was a problem hiding this comment.
In general I'm open to adding user agent as a field to metadata and I agree that it would simplify a bit code in coder PRs but since we have separate repos I'd like to maintain "neutrality" and rather not think about coder implementation details in AI Bridge PRs. Maybe I'm a bit too strict with this approach.
I think this approach makes it more flexible. If AI Bridge user wants to store user-agent in metadata it is possible (how later PRs are doing) if they rather store it differently it is also possible without deleting things from metadata. With separate fields there is clear boundary Metadata == what was set in AsActor.Metadata. If user would like to have it in metadata it could be added sooner in AsActor. Maybe this would be better approach (although then each user would have to extract user-agent himself)?.
Now that I look at it, it seems a bit unnecessary that metadata is simply going back and forth but I think there will be some use for it later.
| ClientRoo = "Roo Code" | ||
| ClientCursor = "Cursor" | ||
| ClientUnknown = "Unknown" | ||
| ) |
There was a problem hiding this comment.
Can we add cline and JetBrains to the list?
There is some investigation here
There was a problem hiding this comment.
Unfortunately for both cline and JetBrains user agents are not useful.
If I understand correctly both are from some JS and Kotlin library.
There was a problem hiding this comment.
I think it's safe to assume that ktor-client will always be JetBrains
Ideally, we should allow folks to specify their own mapping somewhere in the UI, but that's for another time.
There was a problem hiding this comment.
Maybe I'm too defensive here but I think we should set client only when we have very high confidence the client is correct, so when user agent (or some other header) uniquely identifies application.
My assumption is that it would be better to have as little false positives as possible, even with the cost of not recording JetBrains 90% of the time correctly. For investigating there is fallback with raw user agent being added to metadata if needed.
| case strings.HasPrefix(userAgent, "kilo-code/") || originator == "kilo-code": | ||
| return ClientKilo | ||
| case strings.HasPrefix(userAgent, "roo-code/") || originator == "roo-code": | ||
| return ClientRoo |
There was a problem hiding this comment.
When Provider is Anthropic Both kilo code and Roo code have a different user-agent. Please see: #20 (comment)
There was a problem hiding this comment.
In Anthropic cases user agents seem to not be useful as they look like they originate from JS library. If originator header is set then it should still work.
There was a problem hiding this comment.
If originator header is set then it should still work.
Unfortunatly this is also only set for OpenAI :(
d9c4ab2 to
38bfb12
Compare

Adds raw user agent value and heuristically guessed client name to interception recording.
Fixes: #31