Fix codex MCP persistence conversationId metadata

This commit is contained in:
Mohamed Boudra
2025-12-24 19:45:02 +07:00
parent 055a1bcefe
commit 34d5b75428
2 changed files with 12 additions and 4 deletions
@@ -605,19 +605,24 @@ class CodexMcpAgentSession implements AgentSession {
describePersistence(): AgentPersistenceHandle | null {
if (this.persistence) {
const conversationId = this.conversationId ?? this.sessionId ?? undefined;
if (conversationId && this.persistence.metadata && typeof this.persistence.metadata === "object") {
(this.persistence.metadata as Record<string, unknown>).conversationId = conversationId;
}
return this.persistence;
}
if (!this.sessionId) {
return null;
}
const { model: _ignoredModel, ...restConfig } = this.config;
const conversationId = this.conversationId ?? this.sessionId ?? undefined;
this.persistence = {
provider: "codex-mcp" as AgentPersistenceHandle["provider"],
sessionId: this.sessionId,
nativeHandle: this.sessionId,
metadata: {
...restConfig,
conversationId: this.conversationId ?? undefined,
conversationId,
},
};
return this.persistence;