feat(backends): introduce CompositeSessionLocator dispatch point#4101
Merged
Trecek merged 7 commits intoJun 13, 2026
Merged
Conversation
… point Replace the dual codex_log_path/ClaudeSessionLocator branching in flush_session_log with backend-parameter-driven dispatch through a new CompositeSessionLocator that iterates BACKEND_REGISTRY. - New _composite_locator.py: CompositeSessionLocator with locate_session, project_log_dir, project_log_dir_for, session_log_path, locator_for - session_log.py: remove codex_log_path parameter, replace dual branch with locator_for(backend) dispatch, populate codex_log via _codex_log_str - _headless_execute.py: drop _codex_log pre-computation block and codex_log_path= kwarg from flush_session_log call - backends/__init__.py: export CompositeSessionLocator - backends/AGENTS.md: document _composite_locator.py - New test_composite_session_locator.py covers the new dispatch point - test_backend_registry.py: include CompositeSessionLocator in expected set - test_session_log_fields.py: switch TestCodexLogFields to backend= + session_locator= dispatch - test_backend_dispatch.py: assert codex_log_path absent; verify backend= kwarg
…ation - Remove explicit SessionLocator base class inheritance to fix Python 3.11 slots+Protocol FrozenInstanceError bug (test_frozen passes now) - Add execution/backends: 11 exemption to subpackage isolation test - Replace backend == "claude-code" string comparison with channel_b_capable bool parameter in flush_session_log; pass capability from _headless_execute - Add channel_b_capable=False to codex-path test calls in test_session_log_fields Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…1 compat Python 3.11 has a bug with @DataClass(frozen=True, slots=True) on empty dataclasses — setting undefined attributes raises TypeError instead of FrozenInstanceError. The same pattern is used by test_claude_session_locator.py. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ug log If any backend's SessionLocator.locate_session raises, iteration continues to the next backend instead of aborting the scan. Failures are emitted at debug level with the backend name and full traceback.
Monkeypatches BACKEND_REGISTRY with a backend whose locate_session raises RuntimeError followed by one that returns a hit. Asserts the composite locator returns the hit, proving exception handling allows iteration to continue.
…port The deferred import used the private module path `backends._composite_locator` directly, bypassing the re-export boundary in `backends/__init__.py`. Since `CompositeSessionLocator` is already in `__all__` there, use the public surface.
Add `_locators` field (default `()`) so callers can inject pre-built SessionLocator instances, avoiding per-call backend re-instantiation on the hot path. When `_locators` is non-empty, iterate those directly; otherwise fall back to the existing BACKEND_REGISTRY instantiation path.
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
Introduce a
CompositeSessionLocatorinexecution/backends/_composite_locator.pythat provides a single dispatch point for session log resolution across backends, replacing the dualcodex_log_path/ClaudeSessionLocatorbranching inflush_session_log. The composite iteratesBACKEND_REGISTRYto locate sessions, supports per-backend dispatch vialocator_for(backend), and (remediation) wraps each backend's call intry/except Exceptionwith structured debug logging so a failing backend cannot abort the scan.Individual Group Plans
Group 1: T5-P4-A6-WP2 Provide a single SessionLocator dispatch point
Create a
CompositeSessionLocatorinexecution/backends/_composite_locator.pythat iteratesBACKEND_REGISTRYto locate session logs, then replace the dualcodex_log_path/ClaudeSessionLocatorbranching inflush_session_logwith backend-parameter-driven dispatch through this composite. Remove thecodex_log_pathparameter fromflush_session_logand the pre-computation block from_headless_execute.py. Update tests to use explicitbackend=dispatch instead ofcodex_log_path=.Group 2: T5-P4-A6-WP2 Remediation — Per-backend exception handling in CompositeSessionLocator.locate_session
Add per-backend
try/except Exceptionwith structured debug logging insideCompositeSessionLocator.locate_sessionso that if one backend's locator raises, the scan continues to the next backend rather than aborting. Add a test verifying this resilient-iteration behavior.Closes #4024
Implementation Plan
Plan files:
/home/talon/projects/autoskillit-runs/impl-20260612-201007-221351/.autoskillit/temp/make-plan/t5_p4_a6_wp2_composite_session_locator_plan_2026-06-12_201500.md/home/talon/projects/autoskillit-runs/impl-20260612-201007-221351/.autoskillit/temp/make-plan/t5_p4_a6_wp2_remediation_composite_locator_plan_2026-06-12_202600.md🤖 Generated with Claude Code via AutoSkillit
Token Usage Summary
* Step used a non-Anthropic provider; caching behavior may differ.
Token Efficiency
Model Usage Breakdown