The More menu's rename item reads session.sessionId from the closure,
but its freshness relied on handleNewChat depending on the whole
session object; narrowing that dep would silently rename a stale
session. Behavior is unchanged today.
Docs carried an OpenCode custom-agent recipe with id "opencode"; without
absorption those customs get renamed to "opencode-2" at load while pins
and saved sessions silently retarget a fresh default preset.
A window created while the feature is off becomes unreachable after a
minimize: the floating button and every floating command are gated by
the setting, leaving only the Session Manager to recover it.
Re-resolving the default agent inside the guard comparison let a
default-agent settings change plus agentCwd churn (e.g. restoring a
session in another directory) fire a rogue createSession that killed
the live session. Resolve the default once, at launch.
Mounting in onOpen spawned the default agent before setState delivered
the persisted id, wasting the heaviest operation (spawn, kill, respawn)
on agent-pinned opens and workspace restores. Defer mounting to the
first setState via an idempotent renderPanel, with a setTimeout(0)
fallback; later setState calls re-render so a changed id flows through
the existing mount-init guard.
A createSession overtaken by a newer call could paint its late failure
(or a stale ready state) over the newer attempt. Guard the post-await
writes with a generation counter, mirroring useAgentMessages.
The sidebar's React root can mount before Obsidian's setState delivers
initialAgentId, so the first run keyed the guard on undefined; the id
arriving a moment later re-ran createSession and killed the first agent
process mid-initialize. Resolving both runs to a concrete id makes the
guard compare what actually launches.
The per-keystroke onChange regenerated the default id and wrote it back
into the field the moment it went empty, so retyping an id required
select-all. Empty is now a transient state: nothing commits while empty,
and blur restores the last valid id if the field is abandoned.
An unknown pinned agent only falls back on button blocks (chat blocks fail
to start), pinned-but-disabled agents are still used, and viewType:
embedded targets the nearest existing block rather than opening a view.