Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

[bug] SessionEnd marks a session's other open ISA rows complete

Open IvanLeontev-stack opened this issue 1 week ago • 1 comments

What happened

8.761.0: SessionEnd marks a session's other ISA rows complete while those ISAs still have open criteria

Summary

LifeOS 8.761.0 (tag v8.761.0, fb9aef46). Every location below was read in that tag. Paths are from the repository root. Where a step says "sandbox", the code was run from a copy of LifeOS/install/ with HOME set to a temporary directory and no network.

Related issues are linked where they exist. None of these is a duplicate as far as I can find.


SessionEnd marks a session's other ISA rows complete while those ISAs still have open criteria

Where: LifeOS/install/hooks/SessionCleanup.hook.ts:176

const rowPhase = active && slug === active.slug ? sessionPhase : 'complete';

What happens. findActiveSessionByUUID (hooks/lib/isa-utils.ts:694-706) picks one row per session, the most recent one. The loop then sets every other row owned by the same session UUID to complete. The comment calls those rows "native/starting placeholders", but syncToWorkJson already collapses placeholders (isa-utils.ts:778). So the other rows can be real ISA rows, and isa-utils.ts:791-793 says several ISAs under one UUID is supported.

The ISA file is not touched, so its mtime does not change, and LIFEOS/TOOLS/WorkReconcile.ts:99 skips re-reading it. The row stays complete while the ISA reads climbing. Once the row is more than a day old, the cleanup in the next syncToWorkJson call (isa-utils.ts:1052, phase === 'complete' && age > ONE_DAY) deletes it.

Steps (sandbox):

  1. Write MEMORY/WORK/item-a/ISA.md and MEMORY/WORK/item-b/ISA.md, each with its own slug:, phase: climbing, progress: 1/3 and one of three criteria checked.
  2. Call syncToWorkJson(parseFrontmatter(c), path, c, U) for item-a and then for item-b, with the same session id U. The most recently updated row is the active one.
  3. Run bun LIFEOS/TOOLS/WorkReconcile.ts --force. This stores the ISA mtimes, the same thing the PostToolUse sweep does during a session.
  4. Pipe {"session_id":"U"} to bun hooks/SessionCleanup.hook.ts.
  5. Run bun LIFEOS/TOOLS/WorkReconcile.ts --force again, then read the rows with readRegistry().

Expected: both rows stay climbing, because both ISAs have open criteria. Actual: item-a: phase=complete, item-b: phase=climbing. WorkReconcile reconciles no rows. item-a/ISA.md still says phase: climbing.

Minimal fix: an ISA-backed row other than the active one keeps its phase when its ISA has open criteria. Rows with no isa close as before. I tested this in the sandbox: with the change, both rows stay climbing.

-import { join } from 'path';
+import { isAbsolute, join } from 'path';
@@
-          const rowPhase = active && slug === active.slug ? sessionPhase : 'complete';
+          const isActiveRow = !!active && slug === active.slug;
+          let rowPhase: 'complete' | null = isActiveRow ? sessionPhase : 'complete';
+          if (!isActiveRow && typeof session.isa === 'string' && session.isa) {
+            const isaFile = isAbsolute(session.isa) ? session.isa : join(getLifeosDir(), session.isa);
+            if (existsSync(isaFile)) {
+              const { checked, total } = countCriteria(readFileSync(isaFile, 'utf-8'));
+              if (total - checked > 0) rowPhase = null;
+            }
+          }

Related: #1977/#1978 fixed the active row. #2632 (fixed in source, not in 8.761.0) keeps rows whose ISA lives outside MEMORY/WORK. Its description says rows with an ISA inside MEMORY/WORK "close as before", so this case is still open after it.

Details

  • Kind: bug
  • LifeOS version: 8.761.0

Filed with the LifeOS /feedback command. The reporter approved this exact text before it was sent; paths, secrets and personal details were stripped locally.

IvanLeontev-stack avatar Nov 26 '26 09:11 IvanLeontev-stack

[!NOTE] 🤖 Kai (AI assistant) responding on behalf of Daniel Miessler

Thanks for this report, and for tracing it to the exact line. You were right: at session end the hook closed every other ISA row of the session without looking at the ISA behind it.

This is fixed in the next release. A non-active row now stays open when its ISA under MEMORY/WORK still has open criteria, counted the same way the active row is. If that ISA can't be read for any reason, the row closes as it did before, so nothing else about session end changes.

One limit to know about: if an ISA's slug was renamed mid-session, the old row and the new row both stay on the board until the 7-day expiry.

Closing this. Please reopen if you still see it after upgrading.

danielmiessler avatar Dec 01 '26 21:12 danielmiessler