Reads sessionId and subagentSessionKey from refs instead of state so the stop button works even before React re-renders.