Commit Graph

16 Commits

Author SHA1 Message Date
teknium1 7114da3de6 refactor(agent): manual /compress runs through one core with --preview/--aggressive on every surface
CLI, gateway, TUI and ACP each re-sequenced the same chain (partial split -> estimate ->
_compress_context(force=True) -> lock-skip detection -> rejoin tail -> summary), and the
flag set differed per surface: TUI treated `--preview` as a focus topic, ACP ignored
arguments entirely. For the one command that legitimately breaks the prompt cache that
divergence is a correctness problem, not a style one.

`agent/conversation_compression_manual.py::compress_now` owns the sequence; surfaces parse
their own argv, install `after_messages`, re-anchor session ids and render. TUI and ACP gain
`--preview`, `--aggressive` refusal and `here [N]` parity.
2026-09-13 05:20:26 -07:00
Teknium fc3d60af09 feat(compression): provider-scoped model_thresholds keys ("<provider>:<substr>")
A bare `astra: 0.85` in compression.model_thresholds was written for the Codex
OAuth route, where Astra is capped at 272K and 50% would compact at ~136K. The
key is substring-matched on the model name alone, so it also fired on
openai/gpt-6-astra via OpenRouter and Nous, where the window is 1.1M: the user's
0.5 global threshold was silently replaced by 0.85 and the session sat at 620K
(~59%) without compacting.

Keys may now carry a provider prefix: `"openai-codex:astra": 0.85` applies only
when the session's provider is openai-codex; bare keys keep their route-agnostic
behaviour. Ranking is by model-substring length with scope as the tie-break, so
`astra-900k` still outranks `openai-codex:astra` for the 900K picker. The
provider flows through ContextCompressor (ctor + update_model), the ContextEngine
base class and the TUI hot-reload path, so a /model switch between routes
re-scopes the override.
2026-09-11 02:07:48 -07:00
Teknium e83816a4d1 review-fix(comments): restore lost #NNNN rationale comments across non-test source (mechanical sweep, condensed, code unchanged)
For each issue anchor present in BASE 63279301bc non-test .py and absent on HEAD, the BASE comment/docstring block was re-attached at the HEAD location of the code it explained (matched by the distinctive code line / enclosing def). Sentences already covered by an existing HEAD comment were deduped; the issue number always survives. Insert-only: no code lines changed.
2026-09-03 09:44:26 -07:00
Teknium f70b499494 refactor(tui): hug marker clear/model-switch calls 2026-09-03 00:18:31 -07:00
Teknium ac9f93525c refactor(tui): compact module/function docstrings and comments (WHY preserved) 2026-09-03 00:03:43 -07:00
Teknium fff5e4f0a2 refactor(tui): drop intra-function blank lines in group C modules 2026-09-02 23:58:07 -07:00
Teknium b139f4f418 refactor(tui): compact native-threshold coercion and terminal-error surface classification 2026-09-02 23:56:33 -07:00
Teknium f95cbee4df refactor(tui): session_compression — inline model-threshold resolution and ctx coercion 2026-09-02 23:50:12 -07:00
Teknium 0e7c1d2b89 refactor(tui): compact docstrings in compression/auto-continue split modules 2026-09-02 23:27:45 -07:00
Teknium 42dc3eebce refactor(tui): session_compression — module-attr approval calls, tail-driven partial rejoin 2026-09-02 23:15:33 -07:00
Teknium 5d3c675443 refactor(tui): drop unused HandlerRegistry seeds, compact payload/snapshot assembly 2026-09-02 23:11:52 -07:00
Teknium 75d472f408 refactor(tui): session_compression — suppress-based int adoption, merged assignments 2026-09-02 23:06:04 -07:00
Teknium cd670b86bf refactor(tui): session_compression — drop compat fallbacks for ContextCompressor attrs that always exist in-tree 2026-09-02 22:43:24 -07:00
Teknium 765599a1a6 refactor(tui): session_compression — collapse defensive try/except layers, flatten partial-compress split 2026-09-02 22:25:33 -07:00
Teknium 99433742dc refactor(tui): extract the prompt turn into prompt_turn.py; compact methods_*/session_*/agent_callbacks; split _start_agent_build into scope/wiring helpers
- server.py 7663 -> 5319: _run_prompt_submit and its goal/loop/voice/scope
  phases move to tui_gateway/prompt_turn.py (bound via method_ctx.bind_module);
  _start_agent_build split into _bind/_release_build_profile_scopes,
  _deferred_build_agent_kwargs, _wire_session_agent, _start_session_services;
  _load_enabled_toolsets split (_enabled_mcp_server_names, _resolve_explicit_toolsets).
- methods_slash: _LIVE_SLASH_OUTPUT dispatch table; methods_tools: _SLASH_BUILTINS,
  _guarded; tool_progress: _PROGRESS_HANDLERS; methods_config_set:
  _REASONING_DISPLAY_WORDS; methods_voice: _VOICE_TOGGLE_ACTIONS.
- Unified: _denied_source (methods_session) replaces _WORKER_SOURCES in
  methods_profiles; _compress_live_with_feedback / _compute_host_slash shared by
  the slash mirror and /compress; _end_voice_chat shared by stop-phrase paths;
  _watcher_mtime_ns; _reaper_session_is_detached_idle; _notif_* helpers.
- Dead: _profile_dir_or_err, _resume_info, _slash_builtin_table (refs.py: 0 hits).
- acp_adapter/server.py: docstring compaction only (AST-identical).
- Every file semantically reviewed hunk-by-hunk for wire/log/lock/order parity.
2026-09-02 14:09:13 -07:00
Teknium 0a1057c709 refactor(tui): split live model-switch and compression logic out of server.py 2026-09-02 14:09:12 -07:00