fix: permanently resolve agent name duplication yo-yo bug
This commit is contained in:
@@ -6,6 +6,8 @@ import {
|
||||
updateSessionAgent,
|
||||
setMainSession,
|
||||
getMainSessionID,
|
||||
registerAgentName,
|
||||
isAgentRegistered,
|
||||
_resetForTesting,
|
||||
} from "./state"
|
||||
|
||||
@@ -102,6 +104,17 @@ describe("claude-code-session-state", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("agent registration", () => {
|
||||
test("should register config-key lookup when given a display name", () => {
|
||||
// given
|
||||
registerAgentName("Atlas (Plan Executor)")
|
||||
|
||||
// when / then
|
||||
expect(isAgentRegistered("atlas")).toBe(true)
|
||||
expect(isAgentRegistered("Atlas (Plan Executor)")).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe("prometheus-md-only integration scenario", () => {
|
||||
test("should correctly identify Prometheus agent for permission checks", () => {
|
||||
// given - Prometheus session
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { getAgentConfigKey } from "../../shared/agent-display-names"
|
||||
|
||||
export const subagentSessions = new Set<string>()
|
||||
export const syncSubagentSessions = new Set<string>()
|
||||
|
||||
@@ -14,7 +16,13 @@ export function getMainSessionID(): string | undefined {
|
||||
const registeredAgentNames = new Set<string>()
|
||||
|
||||
export function registerAgentName(name: string): void {
|
||||
registeredAgentNames.add(name.toLowerCase())
|
||||
const normalizedName = name.toLowerCase()
|
||||
registeredAgentNames.add(normalizedName)
|
||||
|
||||
const configKey = getAgentConfigKey(name).toLowerCase()
|
||||
if (configKey !== normalizedName) {
|
||||
registeredAgentNames.add(configKey)
|
||||
}
|
||||
}
|
||||
|
||||
export function isAgentRegistered(name: string): boolean {
|
||||
|
||||
Reference in New Issue
Block a user