fix: Pass context window in agent update (#159)

This commit is contained in:
Kevin Lin
2025-12-05 21:38:38 -08:00
committed by GitHub
parent 0f55a3da52
commit 82ea8bf345

View File

@@ -358,15 +358,11 @@ export async function createAgent(
// Note: Preflight check above falls back to 'memory' when 'memory_apply_patch' is unavailable. // Note: Preflight check above falls back to 'memory' when 'memory_apply_patch' is unavailable.
// Apply updateArgs if provided (e.g., reasoningEffort, verbosity, etc.) // Apply updateArgs if provided (e.g., context_window, reasoning_effort, verbosity, etc.)
// Skip if updateArgs only contains context_window (already set in create) // We intentionally pass context_window through so updateAgentLLMConfig can set
// context_window_limit using the latest server API, avoiding any fallback.
if (updateArgs && Object.keys(updateArgs).length > 0) { if (updateArgs && Object.keys(updateArgs).length > 0) {
// Remove context_window if present; already set during create await updateAgentLLMConfig(agent.id, modelHandle, updateArgs);
const otherArgs = { ...updateArgs } as Record<string, unknown>;
delete (otherArgs as Record<string, unknown>).context_window;
if (Object.keys(otherArgs).length > 0) {
await updateAgentLLMConfig(agent.id, modelHandle, otherArgs);
}
} }
// Always retrieve the agent to ensure we get the full state with populated memory blocks // Always retrieve the agent to ensure we get the full state with populated memory blocks