Skip to content

Agent Runtime: Context-summarized messages use 'assistant' role but should use 'user' #144

Description

@wangtsiao

Describe the bug

After context compaction/summarization, the summarized history messages are written to the session with role: "assistant". This is incorrect — the compaction process is part of the system's internal bookkeeping, and the compacted summary should be injected as role: "user" so the model treats it as part of the conversation history context rather than as an assistant-generated response.

Impact

  • Using "assistant" role for compacted content can confuse the model about what was actually generated vs. what is historical context
  • The model may incorrectly attribute the compacted summary as its own output
  • Can lead to unexpected behavior in subsequent turns

Expected behavior

Compacted/summarized context messages should use role: "user" to represent that these are historical conversation records being fed back as context.

Where to look

  • crates/core/src/context_pipeline.rs — compaction and context assembly
  • crates/core/src/session.rs — session state management
  • Rollout record writing for compaction events

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions