mirror of
https://github.com/instructkr/claw-code.git
synced 2026-04-13 03:24:49 +08:00
Prevent cross-worktree session bleed during managed session resume/load
ROADMAP #41 was still leaving a phantom-completion class open: managed sessions could be resumed from the wrong workspace, and the CLI/runtime paths were split between partially isolated storage and older helper flows. This squashes the verified team work into one deliverable that routes managed session operations through the per-worktree SessionStore, rejects workspace mismatches explicitly, extends lane-event taxonomy for workspace mismatch reporting, and updates the affected CLI regression fixtures/docs so the new contract is enforced without losing same- workspace legacy coverage. Constraint: Keep same-workspace legacy flat sessions readable while blocking cross-worktree misuse Constraint: No new dependencies; stay within the ROADMAP #41 changed-file scope Rejected: Leave team auto-checkpoint history as final branch state | noisy/non-lore history for a single roadmap fix Confidence: high Scope-risk: moderate Reversibility: clean Directive: Preserve workspace_root validation on future resume/load helpers; do not reintroduce path-only fallback without equivalent mismatch checks Tested: cargo test -p runtime session_control -- --nocapture; cargo test -p rusty-claude-cli resume -- --nocapture; cargo test -p rusty-claude-cli --test cli_flags_and_config_defaults; cargo test -p rusty-claude-cli --test output_format_contract; cargo test -p rusty-claude-cli --test resume_slash_commands; cargo test --workspace --exclude compat-harness; cargo check --workspace --all-targets; git diff --check Not-tested: cargo clippy --workspace --all-targets -- -D warnings (pre-existing failures in unchanged rust/crates/rusty-claude-cli/build.rs) Related: ROADMAP #41
This commit is contained in:
@@ -3734,6 +3734,8 @@ fn classify_lane_failure(error: &str) -> LaneFailureClass {
|
||||
|| normalized.contains("tool runtime")
|
||||
{
|
||||
LaneFailureClass::ToolRuntime
|
||||
} else if normalized.contains("workspace") && normalized.contains("mismatch") {
|
||||
LaneFailureClass::WorkspaceMismatch
|
||||
} else if normalized.contains("plugin") {
|
||||
LaneFailureClass::PluginStartup
|
||||
} else if normalized.contains("mcp") && normalized.contains("handshake") {
|
||||
@@ -7253,6 +7255,10 @@ mod tests {
|
||||
"tool failed: denied tool execution from hook",
|
||||
LaneFailureClass::ToolRuntime,
|
||||
),
|
||||
(
|
||||
"workspace mismatch while resuming the managed session",
|
||||
LaneFailureClass::WorkspaceMismatch,
|
||||
),
|
||||
("thread creation failed", LaneFailureClass::Infra),
|
||||
];
|
||||
|
||||
@@ -7279,6 +7285,10 @@ mod tests {
|
||||
LaneEventName::BranchStaleAgainstMain,
|
||||
"branch.stale_against_main",
|
||||
),
|
||||
(
|
||||
LaneEventName::BranchWorkspaceMismatch,
|
||||
"branch.workspace_mismatch",
|
||||
),
|
||||
];
|
||||
|
||||
for (event, expected) in cases {
|
||||
|
||||
Reference in New Issue
Block a user