Skip to content

Refactor conversation info DTOs to reduce duplication while preserving split REST contracts #2469

@simonrosenberg

Description

@simonrosenberg

Summary

PR #2465 introduced _ConversationInfoBase plus separate ConversationInfo and ACPConversationInfo response DTOs to keep /api/conversations pinned to the legacy Agent contract while exposing ACP-capable schemas under /api/acp/conversations.

That shape is safe, but it duplicates most of ConversationState and creates a maintenance risk: future fields added to ConversationState may need to be mirrored manually into the response DTOs.

Goal

Evaluate whether we can simplify the response models without changing the OpenAPI or runtime serialization behavior that PR #2465 was protecting.

Specifically, test whether this style is equivalent:

class ConversationInfo(ConversationState):
    agent: Agent
    title: str | None = None
    metrics: MetricsSnapshot | None = None
    created_at: datetime
    updated_at: datetime

class ACPConversationInfo(ConversationState):
    agent: ACPEnabledAgent
    title: str | None = None
    metrics: MetricsSnapshot | None = None
    created_at: datetime
    updated_at: datetime

Acceptance criteria

  • Verify whether subclassing ConversationState preserves the exact OpenAPI split:
    • /api/conversations stays Agent-only
    • /api/acp/conversations stays ACP-capable
  • Verify serialization still behaves correctly for nested types like secrets and agent payloads
  • If equivalent, replace _ConversationInfoBase with the simpler inheritance model
  • If not equivalent, keep the current structure and add a regression test that catches DTO drift against ConversationState

Notes

This is intentionally a follow-up and not something to fold back into PR #2465 unless the schema equivalence is trivial and fully verified.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions