Implementation Plan: T5-P6-A9-WP1 Close the fail-open path where init_session() returns a reclaimed /dev/shm path#4129
Merged
Trecek merged 6 commits intoJun 27, 2026
Conversation
…_stale logging Add validate_session_exists() to SessionSkillManager Protocol and DefaultSessionSkillManager as a reusable check for live session dirs. Also emit a structured 'cleanup_stale_removed' log event in cleanup_stale() before shutil.rmtree so stale-dir removals are observable.
… /dev/shm path Insert is_dir() guards on both injection points in run_skill where a ValidatedAddDir over an ephemeral /dev/shm root is consumed: - After init_session() (line ~922) — covers the fresh-session branch - After restore_skill_snapshot() (line ~886) — covers the replay branch When the directory does not exist (reclaimed by OS or removed by cleanup_stale), return SkillResult.crashed() with subtype=crashed instead of flowing the dead path into the executor.
Add four tests for DefaultSessionSkillManager.validate_session_exists() (true for live, false after cleanup, false for unknown) and the new cleanup_stale_removed log event. Add two tests for run_skill: a stale-path (nonexistent /dev/shm dir) must crash-close with subtype=crashed and never reach the executor; a valid on-disk path must proceed to the executor.
- Use tmp_path (real directory) in test_run_skill_calls_session_skill_manager_init_session and test_run_skill_activates_deps_for_tier3_target so the new is_dir() guard passes instead of crash-closing before the executor - Bump tools_execution.py line limit from 1150→1200 in _LINE_LIMIT_EXEMPTIONS with rationale for the two stale-path guard blocks (+26 net lines)
The run_skill guard that fires when init_session() returns a path not found on disk was using Path(session_root.path).is_dir() directly instead of the SessionSkillManager.validate_session_exists() method introduced in ec82d7f for exactly this purpose. Align the guard with the Protocol contract. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…n_exists The guard now calls validate_session_exists() instead of Path.is_dir(), so the MagicMock must explicitly return False for the stale-path scenario instead of relying on the filesystem check. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Close the fail-open path in
run_skillwhereinit_session()returns aValidatedAddDirpointing to a/dev/shmpath that no longer exists (reclaimed by the OS or cleaned up bycleanup_stale()). Add anis_dir()guard afterinit_session()and beforeskill_add_dirs.append(session_root)that crash-closes immediately — logging a structured warning and returningSkillResult.crashed().to_json()— so the dead path never reaches the executor.Additionally: add a parallel guard on the replay-snapshot branch (defense-in-depth), add
validate_session_exists()toDefaultSessionSkillManagerand its Protocol, and add structured logging tocleanup_stale().Implementation Plan
Plan file:
/home/talon/projects/autoskillit-runs/impl-20260627-120424-389616/.autoskillit/temp/make-plan/T5-P6-A9-WP1_plan_2026-06-27_121500.mdCloses #4058
🤖 Generated with Claude Code via AutoSkillit
Token Usage Summary
* Step used a non-Anthropic provider; caching behavior may differ.
Token Efficiency
Model Usage Breakdown