pub fn newest_worker_session(
config_dir: &Path,
run_dir: &Path,
label: &str,
project: &str,
tag_cache: Option<&SessionTagCache>,
) -> Result<Option<(String, bool)>, TranscriptError>Expand description
The newest transcript in run_dir’s directory that carries label’s
worker tag AND was tagged by project: its session id and whether its
row predates the project field (true means the adopting project must
stamp it). None when the directory holds no match.
The tag is what says whose session a transcript is, not the
directory: everything that ran with that cwd writes there, the
worker’s own subagents included, so the newest file in the directory
is often not the worker’s. The project (the tag row’s project
field) is the second half: the composed worktree directory is shared
across a repository’s projects, so a label alone would let another
project resume this session. A tag row written before the field
existed carries no project and stays eligible, flagged so the caller
can bound the window to one adoption.