Commit Graph

31730 Commits

Author SHA1 Message Date
Teknium 93cf6b3dce Merge simp/r3-37 (late tail) into hermes/simplify-codebase 2026-09-03 04:35:51 -07:00
Teknium e73598a3c3 Merge branch 'simp/r3-36' into hermes/simplify-codebase 2026-09-03 04:34:20 -07:00
Teknium 8c4012fac0 Merge branch 'simp/r3-35' into hermes/simplify-codebase 2026-09-03 04:34:20 -07:00
Teknium e010327ff7 Merge branch 'simp/r3-34' into hermes/simplify-codebase 2026-09-03 04:34:19 -07:00
Teknium 3bff2a581d Merge origin/main (562ee8ab76): fold usage-less empty-response guard, unterminated tool-call strip, skills-first memory guidance into the simplified modules 2026-09-03 04:31:46 -07:00
Teknium 7ac5a9549f Merge branch 'simp/r3-36-X2' into simp/r3-36 2026-09-03 04:22:49 -07:00
Teknium fd1a0594c1 refactor(tui_gateway): X2 wave3 — compute_host guarded frame handlers + session-build split, groups profile/kwargs folds, project_tree placement/auto-bucket compaction, projects row/policy folds, entry+oauth plumbing trims (2653->2437 LOC) 2026-09-03 04:15:06 -07:00
Teknium ffe3f8ad48 refactor(tui_gateway): hosted-room service — keep send() prepare/wakeup explicit 2026-09-03 04:10:17 -07:00
Teknium 562ee8ab76 fix(prompt): agent routes task-learned knowledge (incl. user preferences/corrections) to skills; memory is the every-session exception
The memory guidance led with 'Save proactively' and the memory tool schema
ranked 'user preferences & corrections' as top priority, while the skills
nudge was a conditional 'offer to save'. In practice that asymmetry made
the agent end sessions writing memory entries (fighting a 2,200-char
budget) and skip updating the skill it had just used, even though the
procedure was the reusable artifact. Both surfaces now state the same
rule with skills first: what you learn doing a task, including the user's
preferences and corrections for that kind of work, goes in the task's
skill; memory is only for facts that apply to every session.
2026-09-03 04:02:35 -07:00
Teknium f2e82f6208 refactor(tui_gateway): hosted-room X1 — inline one-site wrappers, drop dead PeerRunsHTTPError attrs, compact lease/cancel plumbing 2026-09-03 03:59:09 -07:00
Teknium 7b72fd1247 fix(agent): stream cut mid tool-call markup no longer persists as assistant prose (#101899)
GLM-style models serialize tool calls as XML in the text channel; when the
stream drops mid-serialization with finish_reason=stop, the orphan
<arg_key>/<arg_value> fragment (or a bare unclosed <tool_call> opener)
matched neither the complete-block stripper nor the partial-stream guard
and was stored and displayed as ordinary assistant content.

strip_think_blocks (storage boundary) and the CLI display copy now strip
an unterminated block-boundary tool-call opener, or any line carrying
stray argument markup, to end of text. The response then reads as empty
and flows through the existing empty-retry path. Complete blocks and
inline prose mentions are unchanged.
2026-09-03 03:42:15 -07:00
Teknium c3e9defd18 fix(agent): trim usage-less empty fix to guard + observability
Drop the loop-side '(empty)' rewrite (the turn-completion explainer already
owns that at delivery, and gateway/desktop match on the sentinel) and the
extra token-count persistence. Keeps: usage-absent empty streaks arm the
deterministic fast-fail after two attempts with no content or reasoning,
and every completed API call logs even when the provider omits usage
(#101898).
2026-09-03 03:41:52 -07:00
fangliquan 3755dca7d6 fix(agent): handle usage-less empty responses 2026-09-03 03:41:52 -07:00
Teknium 89fe549af4 refactor(tui_gateway): hosted-room driver/peer-http/service — fold wrappers, unify bounded-body reads, pack payloads 2026-09-03 03:39:11 -07:00
Teknium 0071ba9965 Merge origin/main (561b053f79) into simp/forwardport: forward-port 220 main commits into the simplified tree 2026-09-03 03:31:03 -07:00
Teknium 7041d8ff9d Merge branch 'simp/r3-36-W1' into simp/r3-36 2026-09-03 03:26:10 -07:00
Teknium 7d48f1c5d2 Merge branch 'simp/r3-36-W4' into simp/r3-36 2026-09-03 03:20:25 -07:00
Teknium f61e0af783 Merge branch 'simp/r3-36-W2' into simp/r3-36 2026-09-03 03:20:24 -07:00
Teknium 58708befdb refactor(tui_gateway): W4 wave2 pass 21 — yolo/fast folds 2026-09-03 03:15:59 -07:00
Teknium f1d6a19873 refactor(tui_gateway): W4 wave2 pass 20 — voice.record + roster row folds 2026-09-03 03:14:09 -07:00
Teknium cf60ebbdfd refactor(tui_gateway): W4 wave2 pass 19 — readiness scope inlined, secret mirroring unified 2026-09-03 03:12:31 -07:00
Teknium c5e7d319b1 refactor(tui_gateway): W4 wave2 pass 18 — config.get profile/project/thinking folds 2026-09-03 03:09:24 -07:00
Teknium 7b52503cc5 refactor(tui_gateway): W4 wave2 pass 17 — ui_meta default-false fold 2026-09-03 03:06:56 -07:00
Teknium 5209d1d487 refactor(tui_gateway): methods_session — steer/redirect factory, one-line docstrings, final compaction (2134 -> 2099 LOC) 2026-09-03 03:06:33 -07:00
Teknium 64fd92723e Merge branch 'simp/r3-36-W5' into simp/r3-36 2026-09-03 03:05:11 -07:00
Teknium cb31284395 refactor(tui_gateway): W4 wave2 pass 16 — profile asset/configure folds, voice tts setter 2026-09-03 03:04:57 -07:00
Teknium bd0689b13e refactor(tui_gateway): W4 wave2 pass 15 — toggle setters table (density/battery/statusbar/mouse) 2026-09-03 03:03:19 -07:00
Teknium c398505e5a refactor(tui_gateway): W4 wave2 pass 14 — busy/approvals into word table 2026-09-03 03:02:44 -07:00
Teknium 9ef0c454a5 refactor(tui_gateway): W2 — _SIMPLE_RPCS table for one-expression handlers, rewind error ladder helper, complete.* walrus guards 2026-09-03 03:01:39 -07:00
Teknium 6e69a036ad refactor(tui_gateway): W4 wave2 pass 13 — word-validated config.set setters table 2026-09-03 03:01:18 -07:00
Teknium b1d541d111 refactor(tui_gateway): methods_session — fold oneshot/handoff/pet/spawn_tree ladders, resume mint prologue (2157 -> 2134 LOC) 2026-09-03 02:59:45 -07:00
Teknium db7b8c7d02 refactor(tui_gateway): W4 wave2 pass 12 — record_repos pairs comprehension, voice.tts/tts_stop folds 2026-09-03 02:57:32 -07:00
Teknium 110292b733 refactor(tui_gateway): W2 — module-handle lazy imports across handlers, goal/loop manager guard, undo notify loop, section banner squeeze 2026-09-03 02:56:05 -07:00
Teknium 6375896d4d refactor(tui_gateway): methods_session — table-drive billing write routes, fold resume/branch/title ladders (2214 -> 2157 LOC) 2026-09-03 02:55:18 -07:00
Teknium f5a3ea3686 refactor(tui_gateway): W4 wave2 pass 11 — profile mcp toggle / preview folds 2026-09-03 02:55:03 -07:00
Teknium f94a5e7358 refactor(tui_gateway): W4 wave2 pass 10 — profile ui_meta fields fold 2026-09-03 02:53:14 -07:00
Teknium 90e008098d refactor(tui_gateway): W4 wave2 pass 9 — _set_model deferred phase extracted 2026-09-03 02:52:21 -07:00
Teknium 13076a0c3c refactor(tui_gateway): browser connect keeps context-managed TCP probe (fake sockets in tests lack close()) 2026-09-03 02:50:48 -07:00
Teknium 861c9d83b4 refactor(tui_gateway): W2 — one-liner rpc lambdas, mirror table lambdas, mcp handler module handles, slash.exec dispatch routing fold 2026-09-03 02:50:39 -07:00
Teknium 8d1714018a refactor(tui_gateway): W4 wave2 pass 8 — split prompt/personality/skin setters, nest single-use voice helpers 2026-09-03 02:49:40 -07:00
Teknium 545e374a68 fix(integration): _tour_request keeps the verdict on an empty-but-registered session record
The r3 collapse to '_sessions.get(sid) or {}' treated a registered-but-empty session dict as
detached, writing the tour_bridge verdict to a throwaway — so an unanswered probe was re-paid
on every action. Restore the 'is None' distinction.
2026-09-03 02:47:37 -07:00
Teknium 48b336ef7e fix(integration): fal image_gen plugin keeps trailing-comma passthrough whitelist the capability-coverage test keys on
test_every_intree_plugin_declares_what_it_implements detects upscale support via the literal
'"upscale",' whitelist entry; the r3 tuple collapse turned it into '"upscale")'. Tool schema
(get_tool_definitions dump) is byte-identical to base 113f04616b before and after.
2026-09-03 02:47:01 -07:00
Teknium 69710e426e refactor(tui_gateway): keep history/run_kwargs locals in the turn finally for the heap-trim probe 2026-09-03 02:46:59 -07:00
Teknium 23b9ffc4fa fix(integration): restore subprocess stdin=DEVNULL / utf-8 encoding guards and windows-footgun gates dropped by round-3 compaction
Repo scanners (check_subprocess_stdin, check-windows-footguns --all) flagged 21 sites where
the r3 single-line collapses lost stdin=DEVNULL, encoding='utf-8'/errors='replace', the
'# windows-footgun: ok' same-line marker, or the getattr(os, 'geteuid') gate. Each guard is
restored at the call site (real portability/hang fixes, not suppressions).
2026-09-03 02:46:19 -07:00
Teknium dfd0a56ee9 refactor(tui_gateway): W4 wave2 pass 7 — fd_trip/deliver fold, describe_toolsets loop, voice banners 2026-09-03 02:45:12 -07:00
Teknium 561b053f79 perf(agents): run per-child timers on one shared scheduler thread
A fan-out of N in-process subagents used to add one sleeping daemon
thread per delegated child (delegate heartbeat, 30s) and one or two per
active turn (durable turn-lease refresher; turn-liveness watchdog).  A
profiled session with ~130 children was carrying ~1000 threads.  All
of these timers now run on a single process-wide daemon thread.

- agent/periodic_scheduler.py (new): heap-ordered periodic scheduler on
  one Condition-driven daemon thread.  schedule(fn, interval) -> handle;
  handle.cancel(wait=) blocks for an in-flight run like the old join.
  A callback returning False stops itself; a raising callback is logged
  at debug and rescheduled, so one bad timer cannot kill the rest.
- tools/delegate_tool.py: _heartbeat_loop body -> _heartbeat_tick,
  scheduled at _HEARTBEAT_INTERVAL; stale-cycle closure state and
  idle/in-tool thresholds unchanged; cancel(wait=5) in finally where the
  stop-event + join(5) lived.
- run_agent.py: _refresh_durable_turn_lease body scheduled at
  _lease_refresh_interval; lease-lost / refresh-error interrupt paths
  and the stop-event fencing are unchanged; the join(timeout=1.0) is now
  cancel(wait=1.0) so the interrupt clear still runs after any in-flight
  tick.
- agent/turn_liveness.py: TurnLivenessWatchdog.make_thread/start ->
  schedule(); the poll body is _tick(), same sampling state machine.

Bench (evals/fanout_resource_bench.py, 30 children / 10 worktrees,
ok=30/30 both): peak threads 168 -> 132.  At peak the old tree held 30
"Thread-N (_heartbeat_loop)" threads; the new one holds zero plus one
"hermes-periodic-scheduler".
2026-09-03 02:44:24 -07:00
Teknium c94d8e3689 refactor(tui_gateway): methods_session — compact resume phases, handoff, spawn_tree and title-read ladders (2235 -> 2214 LOC) 2026-09-03 02:42:37 -07:00
Teknium 0b937a599c refactor(tui_gateway): W4 wave2 pass 6 — full-duplex listener predicates 2026-09-03 02:42:03 -07:00
Teknium 5929c65f2f refactor(tui_gateway): W2 — _rpc/_scoped_rpc/_mcp_rpc method+guard decorators, _tools_mod lazy imports, skills action table, complete.* under _catch, retry/undo prelude helper 2026-09-03 02:41:26 -07:00
Teknium 104bbe564e refactor(tui_gateway): methods_session — unify db decorators, billing view factory, branch persistence, session_method (2289 -> 2235 LOC) 2026-09-03 02:39:15 -07:00