Skip to content

Commit ff45e97

Browse files
committed
fix: ultraworkers#80 — session-lookup error messages now show actual workspace-fingerprint directory
## Problem Two session error messages advertised `.claw/sessions/` as the managed-session location, but the actual on-disk layout is `.claw/sessions/<workspace_fingerprint>/` where the fingerprint is a 16-char FNV-1a hash of the CWD path. Users see error messages like: ``` no managed sessions found in .claw/sessions/ ``` But the real directory is: ``` .claw/sessions/8497f4bcf995fc19/ ``` The error copy was a direct lie — it made workspace-fingerprint partitioning invisible and left users confused about whether sessions were lost or just in a different partition. ## Fix Updated two error formatters to accept the resolved `sessions_root` path and extract the actual workspace-fingerprint directory: 1. **format_missing_session_reference**: now shows the actual fingerprint dir and explains that it's a workspace-specific partition 2. **format_no_managed_sessions**: now shows the actual fingerprint dir and includes a note that sessions from other CWDs are intentionally invisible Updated all three call sites to pass `&self.sessions_root` to the formatters. ## Examples **Before:** ``` no managed sessions found in .claw/sessions/ ``` **After:** ``` no managed sessions found in .claw/sessions/8497f4bcf995fc19/ Start `claw` to create a session, then rerun with `--resume latest`. Note: claw partitions sessions per workspace fingerprint; sessions from other CWDs are invisible. ``` ``` session not found: nonexistent-id Hint: managed sessions live in .claw/sessions/8497f4bcf995fc19/ (workspace-specific partition). Try `latest` for the most recent session or `/session list` in the REPL. ``` ## Impact - Users can now tell from the error message that they're looking in the right directory (the one their current CWD maps to) - The workspace-fingerprint partitioning stops being invisible - Operators understand why sessions from adjacent CWDs don't appear - Error copy matches the actual on-disk structure ## Tests All 466 runtime tests pass. Verified on two real workspaces with actual workspace-fingerprint directories. Closes ROADMAP ultraworkers#80.
1 parent 4b53b97 commit ff45e97

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

rust/crates/runtime/src/session_control.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl SessionStore {
112112
candidate
113113
} else if looks_like_path {
114114
return Err(SessionControlError::Format(
115-
format_missing_session_reference(reference),
115+
format_missing_session_reference(reference, &self.sessions_root),
116116
));
117117
} else {
118118
self.resolve_managed_path(reference)?
@@ -143,7 +143,7 @@ impl SessionStore {
143143
}
144144
}
145145
Err(SessionControlError::Format(
146-
format_missing_session_reference(session_id),
146+
format_missing_session_reference(session_id, &self.sessions_root),
147147
))
148148
}
149149

@@ -161,7 +161,7 @@ impl SessionStore {
161161
self.list_sessions()?
162162
.into_iter()
163163
.next()
164-
.ok_or_else(|| SessionControlError::Format(format_no_managed_sessions()))
164+
.ok_or_else(|| SessionControlError::Format(format_no_managed_sessions(&self.sessions_root)))
165165
}
166166

167167
pub fn load_session(
@@ -522,15 +522,25 @@ fn session_id_from_path(path: &Path) -> Option<String> {
522522
.map(ToOwned::to_owned)
523523
}
524524

525-
fn format_missing_session_reference(reference: &str) -> String {
525+
fn format_missing_session_reference(reference: &str, sessions_root: &Path) -> String {
526+
// #80: show the actual workspace-fingerprint directory instead of lying about .claw/sessions/
527+
let fingerprint_dir = sessions_root
528+
.file_name()
529+
.and_then(|f| f.to_str())
530+
.unwrap_or("<unknown>");
526531
format!(
527-
"session not found: {reference}\nHint: managed sessions live in .claw/sessions/. Try `{LATEST_SESSION_REFERENCE}` for the most recent session or `/session list` in the REPL."
532+
"session not found: {reference}\nHint: managed sessions live in .claw/sessions/{fingerprint_dir}/ (workspace-specific partition).\nTry `{LATEST_SESSION_REFERENCE}` for the most recent session or `/session list` in the REPL."
528533
)
529534
}
530535

531-
fn format_no_managed_sessions() -> String {
536+
fn format_no_managed_sessions(sessions_root: &Path) -> String {
537+
// #80: show the actual workspace-fingerprint directory instead of lying about .claw/sessions/
538+
let fingerprint_dir = sessions_root
539+
.file_name()
540+
.and_then(|f| f.to_str())
541+
.unwrap_or("<unknown>");
532542
format!(
533-
"no managed sessions found in .claw/sessions/\nStart `claw` to create a session, then rerun with `--resume {LATEST_SESSION_REFERENCE}`."
543+
"no managed sessions found in .claw/sessions/{fingerprint_dir}/\nStart `claw` to create a session, then rerun with `--resume {LATEST_SESSION_REFERENCE}`.\nNote: claw partitions sessions per workspace fingerprint; sessions from other CWDs are invisible."
534544
)
535545
}
536546

0 commit comments

Comments
 (0)