fix(server): resolve agent cwd to absolute path at creation time

Relative paths like "." resolve differently depending on where the
server is started, causing agent history files to be stored under
different directories. This fixes the empty state issue when loading
agents created with relative paths.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Mohamed Boudra
2025-11-28 19:01:00 +00:00
parent eea28d59c9
commit 7278a9515f

View File

@@ -1,4 +1,5 @@
import { randomUUID } from "node:crypto";
import { resolve } from "node:path";
import type {
AgentCapabilityFlags,
@@ -773,6 +774,12 @@ export class AgentManager {
config: AgentSessionConfig
): Promise<AgentSessionConfig> {
const normalized: AgentSessionConfig = { ...config };
// Always resolve cwd to absolute path for consistent history file lookup
if (normalized.cwd) {
normalized.cwd = resolve(normalized.cwd);
}
const resolvedModel = await resolveAgentModel({
provider: normalized.provider,
requestedModel: normalized.model,