Skip to content

Commit ae3c873

Browse files
onematchfoxclaude
andauthored
fix(ui): save memory config to spec.declarative.memory (#1887)
Memory was being written to `spec.memory` on the Agent CR, but the v1alpha2 CRD defines `memory` under `spec.declarative`, not at the top level of `AgentSpec` - see https://github.com/kagent-dev/kagent/blob/e03ee3a61be8387f6148d4fae9205e75eb45d2ab/go/api/v1alpha2/agent_types.go#L162-L224. The backend silently ignored the misplaced field, causing memory configuration to appear to save but never actually persist. Also removed a dead fallback in the edit-load path that attempted to read `spec.memory` (a field that never exists in v1alpha2) masking the underlying issue. Signed-off-by: Brian Fox <878612+onematchfox@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e03ee3a commit ae3c873

3 files changed

Lines changed: 2 additions & 3 deletions

File tree

ui/src/app/actions/agents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ function fromAgentFormDataToAgent(agentFormData: AgentFormData): Agent {
193193
const memoryModelName = k8sRefUtils.isValidRef(memoryModel)
194194
? k8sRefUtils.fromRef(memoryModel).name
195195
: memoryModel;
196-
base.spec!.memory = {
196+
base.spec!.declarative!.memory = {
197197
modelConfig: memoryModelName,
198198
ttlDays: agentFormData.memory.ttlDays,
199199
};

ui/src/app/agents/new/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ function AgentPageContent({ isEditMode, agentName, agentNamespace }: AgentPageCo
200200
const useDeclarativeForm = agent.spec.type === "Declarative";
201201
if (useDeclarativeForm) {
202202
const decl = agent.spec?.declarative;
203-
const memorySpec = decl?.memory ?? (agent.spec as { memory?: { modelConfig: string; ttlDays?: number } })?.memory;
203+
const memorySpec = decl?.memory;
204204
const memoryModelConfig = memorySpec?.modelConfig
205205
? `${agent.metadata.namespace}/${memorySpec.modelConfig}`
206206
: "";

ui/src/types/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ export interface AgentSpec {
289289
byo?: BYOAgentSpec;
290290
description: string;
291291
skills?: SkillForAgent;
292-
memory?: MemorySpec;
293292
}
294293

295294
export interface DeclarativeDeploymentSpec {

0 commit comments

Comments
 (0)