mirror of
https://github.com/instructkr/claw-code.git
synced 2026-06-06 14:37:08 +08:00
fix: address CI test failure and add empty-session error message
- Fix latest_session_alias_resolves_most_recent_managed_session test:
the test created sessions with 0 messages, which are now filtered out
by the message_count > 0 check in latest_session_excluding(). Updated
the test to call push_user_text() before saving so sessions have
at least one message and are findable by /resume latest.
- Add distinct error message when all sessions are empty (0 messages).
Previously, the same "no managed sessions found" message was returned
whether there were zero sessions or all sessions had 0 messages. Now:
- No sessions at all → "no managed sessions found in {path}. Start
claw to create a session..."
- Sessions exist but all empty → "all sessions are empty (0 messages)
in {path}. This usually means a fresh claw session is running but
no messages have been sent yet. Wait for a response in your other
session, then try --resume latest again."
- Add test for the all-sessions-empty error path.
Addresses reviewer feedback on #3216.
This commit is contained in:
@@ -15377,16 +15377,26 @@ UU conflicted.rs",
|
||||
std::env::set_current_dir(&workspace).expect("switch cwd");
|
||||
|
||||
let older = create_managed_session_handle("session-older").expect("older handle");
|
||||
Session::new()
|
||||
.with_persistence_path(older.path.clone())
|
||||
.save_to_path(&older.path)
|
||||
.expect("older session should save");
|
||||
{
|
||||
let mut session = Session::new().with_persistence_path(older.path.clone());
|
||||
session
|
||||
.push_user_text("older session message")
|
||||
.expect("older message should save");
|
||||
session
|
||||
.save_to_path(&older.path)
|
||||
.expect("older session should save");
|
||||
}
|
||||
std::thread::sleep(Duration::from_millis(20));
|
||||
let newer = create_managed_session_handle("session-newer").expect("newer handle");
|
||||
Session::new()
|
||||
.with_persistence_path(newer.path.clone())
|
||||
.save_to_path(&newer.path)
|
||||
.expect("newer session should save");
|
||||
{
|
||||
let mut session = Session::new().with_persistence_path(newer.path.clone());
|
||||
session
|
||||
.push_user_text("newer session message")
|
||||
.expect("newer message should save");
|
||||
session
|
||||
.save_to_path(&newer.path)
|
||||
.expect("newer session should save");
|
||||
}
|
||||
|
||||
let resolved = resolve_session_reference("latest").expect("latest session should resolve");
|
||||
assert_eq!(
|
||||
|
||||
Reference in New Issue
Block a user