fix(sf): record sessionId+sessionFile in auto.lock at acquire time

acquireSessionLock now accepts an optional sessionInfo arg (sessionId,
sessionFile) and writes both into the initial lockData JSON. The
caller in auto-start.ts:382 reads them from ctx.sessionManager.
updateSessionLock already writes these fields per-dispatch; this
closes the gap at acquire time.

Lets observers correlate the live auto.lock with the .sf/sessions/
event log (e.g. flow-auditor agents, dashboard, doctor).

Resolves: sf-moocx6lv-9grpvt (active-auto-session-pointer-missing).

Tests: 32/32 in session-lock + auto-start.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mikael Hugo 2026-05-02 16:27:05 +02:00
parent 8814e0b8ce
commit fbee428196

View file

@ -379,7 +379,10 @@ export async function bootstrapAutoSession(
buildResolver,
} = deps;
const lockResult = acquireSessionLock(base);
const lockResult = acquireSessionLock(base, {
sessionId: ctx.sessionManager?.getSessionId?.(),
sessionFile: ctx.sessionManager?.getSessionFile?.(),
});
if (!lockResult.acquired) {
const reason = (lockResult as { acquired: false; reason: string }).reason;
ctx.ui.notify(reason, "error");