Skip to content

Feature Request: Auto-compact to prevent CAPIError 400 before the error not after. #2008

@jpmicrosoft

Description

@jpmicrosoft

Describe the feature or problem you'd like to solve

In long sessions (190+ messages), the conversation context exceeds API limits causing CAPIError: 400 Bad Request, which kills the current turn and loses work in progress.

Proposed solution

Feature Request: Auto-compact to prevent CAPIError 400

In long sessions (190+ messages), the conversation context exceeds API limits causing CAPIError: 400 Bad Request, which kills the current turn and loses work in progress. Please add an auto_compact config option (e.g., in ~/.copilot/config.json) that automatically triggers compaction when context usage exceeds a configurable threshold (e.g., 80%). This would prevent the error entirely without requiring manual /compact intervention. Long coding sessions with iterative development are a core use case and shouldn't require users to monitor context size manually.

Example prompts or workflows

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions