Key loop-claude's session per slot, so two loops of one project run side by side

This commit is contained in:
2026-11-15 14:09:55 +01:00
parent 510df4b31d
commit cbf007f68c
10 changed files with 111 additions and 11 deletions
+8 -2
View File
@@ -3,6 +3,7 @@ import pathlib
import typing
from transcript_archive.location import archive_root, project_archive
from loop_claude.loop.chunk_slot import held_slot, session_name
from loop_claude.loop.chunk_start import archived_route, chunk_start, fetched_todo, routed
from loop_claude.loop.routing_check import check_routing
from loop_claude.project.checkout import checkout_root
@@ -46,8 +47,13 @@ def run_loop(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launc
if isinstance(loop_run, Stop):
return loop_run
baseline = fingerprint(launcher)
# "A " is the human's cue in the session picker that the session is the loop's.
session = session_named(f"A {project_key(loop_run.root, paths.home)} loop-claude", paths.claude_code_transcripts)
key = project_key(loop_run.root, paths.home)
# A reload's exec keeps the slot's lock open, so the edited script takes the slot it is handed.
slot = held_slot(paths.home, key) if loop_run.slot is None else loop_run.slot
if isinstance(slot, Failure):
return Stop(1, slot.reason)
loop_run = dataclasses.replace(loop_run, slot=slot)
session = session_named(session_name(key, slot), paths.claude_code_transcripts)
loop = Loop(root=loop_run.root, session=session, paths=paths, env=env, launcher=launcher, effects=effects)
while True:
if stop := exec_if_edited(loop, baseline, loop_run):