mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
Closes the runner-side half of the split-brain described in issue #11016 by wiring the existing _session_run_generation counter through the session-slot promotion and release paths. Without this, an older async run could still: - promote itself from sentinel to real agent after /stop or /new invalidated its run generation - clear _running_agents on the way out, deleting a newer run's slot Both races leave _running_agents desynced from what the user actually has in flight, which is half of what shows up as 'No active task to stop' followed by late 'Interrupting current task...' acks. Changes: - track_agent() in _run_agent now calls _is_session_run_current() before writing the real agent into _running_agents[session_key]; if /stop or /new bumped the generation while the agent was spinning up, the slot is left alone (the newer run owns it). - _release_running_agent_state() gained an optional run_generation keyword. When provided, it only clears the slot if the generation is still current. The final cleanup at the tail of _run_agent passes the run's generation so an old unwind can't blow away a newer run's state. - Returns bool so callers can tell when a release was blocked. All the existing call sites that do NOT pass run_generation behave exactly as before — this is a strict additive guard. Refs #11016 |
||
|---|---|---|
| .. | ||
| builtin_hooks | ||
| platforms | ||
| __init__.py | ||
| channel_directory.py | ||
| config.py | ||
| delivery.py | ||
| display_config.py | ||
| hooks.py | ||
| mirror.py | ||
| pairing.py | ||
| restart.py | ||
| run.py | ||
| session.py | ||
| session_context.py | ||
| status.py | ||
| sticker_cache.py | ||
| stream_consumer.py | ||