Skip to content

Fix stale model budgets and add staged lossless remote compaction #256

Description

@andrei-hasna

Problem

Recent sanitized Codewith logs show gpt-5.6-sol remote compaction using model_context_window_tokens=258400 while failing single-pass compact requests carry roughly 1.75-2.78 MB of model-visible history. PR #245 preserves history when overflow occurs, but it intentionally does not implement staged recovery.

Expected

Use authoritative model context metadata and compact oversized histories in bounded, provenance-preserving stages.

Acceptance

  • Correct known current OpenAI model context-window metadata without changing unrelated provider caps.
  • Budget the serialized request including instructions, tools, and history.
  • Summarize bounded chunks before final compaction.
  • Preserve unsummarized history and checkpoint state on every failure.
  • Do not loop after deterministic overflow.
  • Return a typed, actionable recovery result.
  • Add large-history, resume, model-switch, cached-input, and tool-output regressions.

Related PR: #245
Related Todos: e6164e35, 5f509275, b1ce3ef0, aaa695d2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions