Teknium
551fe6ea78
refactor(agent/conversation_compression): fold heartbeat suppress predicate, lease-refresh swallow, cooldown capture ordering
2026-09-02 19:57:49 -07:00
Teknium
3a1e4a7661
refactor(agent/compression): fold boundary bookkeeping locals; pack one-item-per-line call/def argument lists (AST-identical)
2026-09-02 19:51:06 -07:00
Teknium
264cc6bd99
refactor(agent/conversation_compression): thread an _Attempt carrier through compress_context phases
2026-09-02 19:45:08 -07:00
Teknium
fa4fc3ea1b
refactor(agent/compression): reflow docstrings/comment blocks to 118 cols (word-identical)
2026-09-02 19:39:34 -07:00
Teknium
ec0984c62b
refactor(agent/conversation_compression): flatten _strip_stale_todo_snapshot list branch
2026-09-02 19:37:58 -07:00
Teknium
0419866f01
refactor(agent/conversation_compression): fold anchor placement, steer markers, orphan reopen, timeout config parsing
2026-09-02 19:37:08 -07:00
Teknium
e0d7f18fc4
refactor(agent/compression): drop blank lines after function-local imports (AST-identical)
2026-09-02 19:31:44 -07:00
Teknium
64215c980c
refactor(agent/conversation_compression): log-and-swallow try/except -> _swallow() context manager (27 sites)
2026-09-02 19:30:28 -07:00
Teknium
4fc0d74fe3
refactor(agent/compression): try/except-pass -> contextlib.suppress (21 sites)
2026-09-02 19:24:14 -07:00
Teknium
7bd7c1114a
refactor(agent/compression): join fragmented adjacent string literals (AST-identical)
2026-09-02 19:19:41 -07:00
Teknium
4051b537e5
refactor(agent/compression_facade): lift pooled timeout run, marker mirror and caller rebind out of _compress_context
2026-09-02 19:16:38 -07:00
Teknium
4b0116025b
refactor(agent/conversation_compression): lift durable lock acquire + contention sit-out out of _acquire_compression_lease
2026-09-02 19:13:27 -07:00
Teknium
ec16f113a4
refactor(agent/compression): reflow to 120 columns (AST-identical); joins fragmented call/string continuations
2026-09-02 19:08:36 -07:00
Teknium
37b0aaa530
refactor(agent/conversation_compression): collapse duplicated commit rollback branches
2026-09-02 19:07:05 -07:00
Teknium
ac7591019e
refactor(agent/conversation_compression): extract codex route and start-announcement from compress_context
2026-09-02 19:01:49 -07:00
Teknium
9672db5399
refactor(agent/conversation_compression): extract attempt prologue and lease sit-out helper; fold codex failure flag
2026-09-02 18:59:05 -07:00
Teknium
0f60feec52
refactor(agent/conversation_compression): lift feasibility threshold-lowering warning out of check_compression_model_feasibility
2026-09-02 18:54:31 -07:00
Teknium
0e9d46511a
refactor(agent/conversation_compression): lift image-shrink nested helpers, lease lock-API resolution, rotation state carry-over, durable cooldown rollback
2026-09-02 18:49:03 -07:00
Teknium
58c7789e36
refactor(agent/conversation_compression): extract summary phase of compress_context and the timeout wrapper's wait/cancel/unwind helpers
2026-09-02 18:33:49 -07:00
Teknium
719cbb6e55
refactor(agent/conversation_compression): extract SessionDB commit phase; fold automatic gate + codex fence bracket
2026-09-02 18:27:34 -07:00
Teknium
7524e9ec8a
refactor(agent/compression): unify session rebind, scoped-twin stamping; lift facade timeout callbacks to module helpers
2026-09-02 18:17:52 -07:00
Teknium
56202613ef
Merge branch 'simp/r2-loop' into simp/integration2
2026-09-02 17:49:25 -07:00
Teknium
7dc43c94d1
refactor(turn): sub-split handle_api_error / check_api_response / run_tool_round so no new turn_* function exceeds 300 LOC
2026-09-02 17:28:22 -07:00
Teknium
013c528ef8
refactor(tool_executor): inline memory_manager_executor into resolve_invoke_tool_executor
...
Single-caller factory replaced by the equivalent closure; comment compaction only
otherwise.
2026-09-02 17:07:36 -07:00
Teknium
c6136d946f
refactor(tool_executor): split execute_tool_calls_concurrent into _ConcurrentBatch + shared result helpers
...
Behavior-neutral extraction of the 686-LOC concurrent executor and the 429-LOC
sequential executor into focused helpers:
- _ConcurrentBatch (run_worker / submit_all / await_completion / run) and
_StartOrderGate replace the nested closures + nonlocal counters; _ToolOutcome
replaces the 7-tuple result slots; _ParsedCall/_parse_tool_call replaces the
6-tuple parsed-call rows in both executors (-> 2 sites).
- _append_skipped_tool_results unifies the four cancelled/skipped-result loops
(concurrent pre-flight, sequential pre-tool interrupt, sequential
KeyboardInterrupt, sequential post-tool interrupt) -> 4 sites; absorbs
_append_cancelled_tool_results.
- _observe_tool_result / _commit_tool_result / _finalize_tool_batch /
_print_tool_completed / _tool_progress_enabled unify the post-execution
guardrail-observe -> append+flush -> tool.completed -> budget -> /steer tail
shared by the concurrent, sequential and segmented paths (-> 2-3 sites each).
- _unfinished_tool_result, _blocked_tool_result, _abandoned_sequential_result
collapse the duplicated synthesize-result + terminal post_tool_call blocks.
- _registered_tool_worker / _interrupt_worker_tids unify worker tid tracking and
interrupt fan-out between the two middleware runners (-> 2 / 3 sites).
- _run_with_activity_heartbeat extracts the heartbeat thread wrapper.
- _resolve_sequential_dispatch + _SequentialDispatch turn the 5-branch
inline/delegate/context-engine/memory/registry if/elif into a resolver with
per-branch spinner/error/KeyboardInterrupt policy, preserving branch order.
- _cancelled_tool_result and _managed_values inlined (single caller each).
Public signatures (execute_tool_calls_concurrent/sequential/segmented, both
middleware runners, every symbol imported by run_agent.py/agent/tests) are
unchanged; middleware/hook/persistence/progress-callback order is identical.
2026-09-02 17:07:35 -07:00
Teknium
0c27101562
refactor(turn): split finalize_turn into phase helpers (576 -> 264 LOC)
2026-09-02 17:07:35 -07:00
Teknium
a0b0ae9ce3
refactor(turn): split recover_from_overflow into per-error handlers on a _Recovery state (501-LOC function -> max 76)
2026-09-02 17:07:35 -07:00
Teknium
656f1c1c13
Merge branch 'simp/r2-loop-tex' into simp/integration2
2026-09-02 17:05:13 -07:00
Teknium
eb807c026f
Merge branch 'simp/r2-loop-fin' into simp/integration2
2026-09-02 17:05:12 -07:00
Teknium
e037d3d55e
Merge branch 'simp/r2-loop' into simp/integration2
2026-09-02 17:05:02 -07:00
Teknium
0f1c1d9388
refactor(turn): module docstrings list every helper in turn_iteration_prep / turn_api_call
2026-09-02 16:57:55 -07:00
Teknium
3d0e9af47a
refactor(tool_executor): inline memory_manager_executor into resolve_invoke_tool_executor
...
Single-caller factory replaced by the equivalent closure; comment compaction only
otherwise.
2026-09-02 16:51:42 -07:00
Teknium
3f93fdfc95
refactor(tool_executor): split execute_tool_calls_concurrent into _ConcurrentBatch + shared result helpers
...
Behavior-neutral extraction of the 686-LOC concurrent executor and the 429-LOC
sequential executor into focused helpers:
- _ConcurrentBatch (run_worker / submit_all / await_completion / run) and
_StartOrderGate replace the nested closures + nonlocal counters; _ToolOutcome
replaces the 7-tuple result slots; _ParsedCall/_parse_tool_call replaces the
6-tuple parsed-call rows in both executors (-> 2 sites).
- _append_skipped_tool_results unifies the four cancelled/skipped-result loops
(concurrent pre-flight, sequential pre-tool interrupt, sequential
KeyboardInterrupt, sequential post-tool interrupt) -> 4 sites; absorbs
_append_cancelled_tool_results.
- _observe_tool_result / _commit_tool_result / _finalize_tool_batch /
_print_tool_completed / _tool_progress_enabled unify the post-execution
guardrail-observe -> append+flush -> tool.completed -> budget -> /steer tail
shared by the concurrent, sequential and segmented paths (-> 2-3 sites each).
- _unfinished_tool_result, _blocked_tool_result, _abandoned_sequential_result
collapse the duplicated synthesize-result + terminal post_tool_call blocks.
- _registered_tool_worker / _interrupt_worker_tids unify worker tid tracking and
interrupt fan-out between the two middleware runners (-> 2 / 3 sites).
- _run_with_activity_heartbeat extracts the heartbeat thread wrapper.
- _resolve_sequential_dispatch + _SequentialDispatch turn the 5-branch
inline/delegate/context-engine/memory/registry if/elif into a resolver with
per-branch spinner/error/KeyboardInterrupt policy, preserving branch order.
- _cancelled_tool_result and _managed_values inlined (single caller each).
Public signatures (execute_tool_calls_concurrent/sequential/segmented, both
middleware runners, every symbol imported by run_agent.py/agent/tests) are
unchanged; middleware/hook/persistence/progress-callback order is identical.
2026-09-02 16:51:42 -07:00
Teknium
629e6eb1b5
refactor(turn): split finalize_turn into phase helpers (576 -> 264 LOC)
2026-09-02 16:46:33 -07:00
Teknium
529f1ac0aa
refactor(turn): drop section-banner comments in turn_facade_lease
2026-09-02 16:43:09 -07:00
Teknium
b4c38f2aa9
refactor(turn): lift run_conversation lease/liveness closures into agent.turn_facade_lease
2026-09-02 16:43:09 -07:00
Teknium
74b928b6a3
refactor(turn): compact log-call formatting in turn_context_compaction
2026-09-02 16:43:08 -07:00
Teknium
d6ef4190cc
refactor(turn): collapse preflight estimator branch, build_api_messages pops, docstrings; add turn_context_compaction tests
2026-09-02 16:42:25 -07:00
Teknium
84c2e326f2
refactor(turn): split build_turn_context into helpers; extract turn-start compaction to turn_context_compaction.py
2026-09-02 16:40:40 -07:00
Teknium
2769937936
refactor(turn): lift iteration entry/announce, Nous rate guard, API interrupt, retry-restart consumer and preflight-timeout result out of run_conversation
2026-09-02 16:37:14 -07:00
Teknium
4d1880e0bf
fix(integration): restore subprocess encoding/stdin guards dropped in simplification
...
Simplification workers collapsed subprocess call sites into shared kwargs
helpers and dropped the Windows/TUI safety kwargs on the way:
- encoding='utf-8', errors='replace' restored on text=True runs in
copilot_acp_client, hermes_cli/setup (vercel install), managed_uv
(codesign steps), local_runtime/hardware._stdout, a2a adapter.
- stdin=subprocess.DEVNULL restored on copilot probe, verify/runner
_SUBPROCESS_KW, iron_proxy._run, google_meet playwright/system_profiler,
simplex convert, whatsapp _RUN_TEXT, mem0 ollama serve Popen.
google_meet sudo/brew install keeps inherited stdin (user-confirmed,
may prompt) — marked noqa: subprocess-stdin.
- Windows-safe SIGKILL: getattr(signal, 'SIGKILL', SIGTERM) in
verify/runner; photon _kill call re-marked windows-footgun: ok
(unreachable on win32).
- scripts/check_subprocess_stdin.py now recognizes **kwargs splats
(**_KW / **_kw(...)) ONLY when the same-file definition provably sets
stdin= — covers tui_gateway _capture_run_kwargs/run_kw. Parity test added.
2026-09-02 16:36:10 -07:00
Teknium
a56f731ac6
refactor(turn): extract preflight gate + per-iteration transcript prep into agent/turn_preflight_gate.py, agent/turn_iteration_prep.py
2026-09-02 16:27:44 -07:00
Teknium
9780739e12
refactor(turn): extract per-iteration request assembly (api_messages/MoA/cache plan/pressure) into agent/turn_request_assembly.py
2026-09-02 16:10:07 -07:00
Teknium
9fda4e5bac
refactor(turn): extract retry-loop API error handler, request build, provider call and response check into agent/turn_api_*.py + agent/turn_response_check.py
2026-09-02 16:07:51 -07:00
Teknium
0dc36e0934
refactor(turn): extract tool round + final text response branches into agent/turn_tool_round.py, agent/turn_final_response.py
2026-09-02 15:40:17 -07:00
Teknium
67ef2e50fe
refactor(turn): extract response intake (normalize/hooks/scratchpad/codex-incomplete) into agent/turn_response_intake.py
2026-09-02 15:37:47 -07:00
Teknium
9c99769ad8
refactor(turn): split recover_from_overflow into per-error handlers on a _Recovery state (501-LOC function -> max 76)
2026-09-02 15:29:36 -07:00
Teknium
d42282ae9e
refactor(turn): extract outer-loop exception handler into agent/turn_loop_errors.py
2026-09-02 15:29:00 -07:00
Teknium
aa0163d361
Merge branch 'simp/agent-runtime' into simp/integration
...
Conflict in agent/error_classifier.py: both simp/agent-chat and
simp/agent-runtime simplified the same file. Kept simp/agent-chat's
rule-table version, which already subsumes agent-runtime's
billing/rate-limit/overflow verdict helpers (as _V_* verdicts + _first_match
rule tables) and its dead _THINKING_SIG_PATTERNS removal. Verified with a
60k-case differential fuzz: identical ClassifiedError output vs base and vs
agent-runtime's version.
2026-09-02 14:44:19 -07:00
Teknium
3721bcfd41
Merge branch 'simp/hclia-models' into simp/integration
2026-09-02 14:19:39 -07:00