compress: route every trigger path through compress_and_save_session
- CompressionWorker keeps the real-token gate (ctx.context_tokens) but now
  delegates to compress_and_save_session(reason="postturn") — it used to
  call compress_context directly with its own save logic and silently
  no-op'ed on any summarizer failure, leaving the session over the
  threshold until the next turn's gates
- pre-turn and /compact gates use real_baseline_estimate instead of the
  chars//3 heuristic (mid-turn already did), so code-heavy contexts
  compress in time instead of tripping ContextTooLargeError
- summarizer input keeps head + tail instead of head-only truncation,
  which silently dropped the newest summarized messages closest to the
  keep window
- critical tool results over the 4000-char budget keep head+tail halves
  instead of collapsing to the 800-char non-critical preview (a 3999-char
  read survived whole, a 4001-char one lost 98%)
- images count 500 tokens each, not 500 per message carrying them
- _plan_compression is the single partition decision shared by
  compress_context and would_compress, so the dry-run prediction cannot
  drift from the real path; the trigger reason is now logged
  (preturn/midturn/postturn/forced)
1 parent 8032435 commit 70ce4ae76e66bafb89c8bccd7a4caa6a4163449a
@Eugene Sukhodolskiy Eugene Sukhodolskiy authored 19 hours ago
Showing 5 changed files
View
navi/core/agent.py
View
navi/core/compressor.py
View
navi/workers/compressor.py
View
tests/unit/core/test_compressor.py
View
tests/unit/workers/test_compression_worker.py