mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-28 11:05:31 +08:00
fix(vscode): restrict feedback session IDs to the kilo provider
`isKiloGateway` used `startsWith("kilo")` which matches fictional
aliases like `kilo-dev`/`kilocloud`. The only real gateway provider
ID in the codebase is plain `kilo` — every other usage of it checks
`providerID === "kilo"`. Tighten to an exact match and drop the
`isKiloGateway` tests (it is now a one-line equality check) along
with the fabricated alias case in `buildFeedbackProperties`.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from "bun:test"
|
||||
import { buildFeedbackProperties, isKiloGateway } from "../../webview-ui/src/context/feedback-payload"
|
||||
import { buildFeedbackProperties } from "../../webview-ui/src/context/feedback-payload"
|
||||
|
||||
const baseInput = {
|
||||
messageID: "msg_abc",
|
||||
@@ -9,23 +9,6 @@ const baseInput = {
|
||||
variant: undefined as string | undefined,
|
||||
}
|
||||
|
||||
describe("isKiloGateway", () => {
|
||||
it("matches the canonical kilo provider", () => {
|
||||
expect(isKiloGateway("kilo")).toBe(true)
|
||||
})
|
||||
|
||||
it("matches aliased kilo providers", () => {
|
||||
expect(isKiloGateway("kilo-dev")).toBe(true)
|
||||
expect(isKiloGateway("kilocloud")).toBe(true)
|
||||
})
|
||||
|
||||
it("does not match direct providers", () => {
|
||||
expect(isKiloGateway("anthropic")).toBe(false)
|
||||
expect(isKiloGateway("openai")).toBe(false)
|
||||
expect(isKiloGateway("openrouter")).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe("buildFeedbackProperties — non-Kilo providers", () => {
|
||||
it("includes only provider/model/rating (no session or message IDs)", () => {
|
||||
const props = buildFeedbackProperties({ ...baseInput, providerID: "anthropic", next: "up" })
|
||||
@@ -68,11 +51,4 @@ describe("buildFeedbackProperties — Kilo Gateway", () => {
|
||||
parentMessageID: "msg_parent",
|
||||
})
|
||||
})
|
||||
|
||||
it("treats aliased kilo providers the same", () => {
|
||||
const props = buildFeedbackProperties({ ...baseInput, providerID: "kilo-cloud", next: "up" })
|
||||
expect(props.sessionID).toBe("ses_xyz")
|
||||
expect(props.messageID).toBe("msg_abc")
|
||||
expect(props.parentMessageID).toBe("msg_parent")
|
||||
})
|
||||
})
|
||||
|
||||
@@ -21,7 +21,7 @@ export interface RateInput {
|
||||
}
|
||||
|
||||
export function isKiloGateway(providerID: string): boolean {
|
||||
return providerID.startsWith("kilo")
|
||||
return providerID === "kilo"
|
||||
}
|
||||
|
||||
export function buildFeedbackProperties(input: RateInput, previousRating?: Rating): Record<string, unknown> {
|
||||
|
||||
Reference in New Issue
Block a user