mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-27 17:58:07 +00:00
Redirect/steer, regenerate, restore-checkpoint, edit-message, and change-cwd read `activeSessionId || activeSessionIdRef.current`, which prefers the closure-captured prop whenever it is non-null and only falls back to the ref once the prop is null. That precedence is backwards. The actions bag is a stable ref that wiring.tsx mutates in place (Object.assign), and the pane surfaces are memoized on that stable ref, so a surface does not re-render when the active session changes and keeps whichever closure was current when it last rendered. `activeSessionIdRef` is the authority: it is mirrored during render in use-session-state-cache, and submit.ts / use-session-actions pin it imperatively mid-flight without touching the source prop. The prop is stale by design. `cancelRun` in the same file already reads the ref exclusively and documents exactly this hazard. User-visible effect after switching chats: a typed correction was delivered into the previously focused conversation's live turn (the "session suddenly working on another chat's task" report), and rewinds truncated the wrong session's transcript — real data loss, since a truncating resubmit deletes history after the target ordinal. Nothing crosses over in stored state, which is why a DB/transcript audit of the affected session comes back clean. Also fixes the same defect in `changeSessionCwd`, where a stale target re-anchored another conversation's workspace, pointing that agent's terminal/file tools at the wrong project. The now-unused `activeSessionId` option is dropped from useCwdActions rather than left as a footgun for the next caller. Not changed, verified not affected: model-edit-submenu reads the runtime id via `useStore` (live subscription, re-renders on change), and use-composer-actions guards on `attachedSessionId === activeSessionId`, so a stale value there only skips a detach instead of writing cross-session. Tests: 4 regression cases pin each action to the current session when the prop and the ref disagree. Verified to fail against the pre-fix code (all four reported the stale `rt-abc123` instead of the current session), including a scripted revert of all four sites. Co-authored-by: Drew Donaldson <49219012+Automata-intelligentsia@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| bootstrap-installer | ||
| desktop | ||
| shared | ||