Skip to content

feat(backends): introduce CompositeSessionLocator dispatch point#4101

Merged
Trecek merged 7 commits into
developfrom
t5-p4-a6-wp2-provide-a-single-sessionlocator-dispatch-point/4024
Jun 13, 2026
Merged

feat(backends): introduce CompositeSessionLocator dispatch point#4101
Trecek merged 7 commits into
developfrom
t5-p4-a6-wp2-provide-a-single-sessionlocator-dispatch-point/4024

Conversation

@Trecek

@Trecek Trecek commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Introduce a CompositeSessionLocator in execution/backends/_composite_locator.py that provides a single dispatch point for session log resolution across backends, replacing the dual codex_log_path/ClaudeSessionLocator branching in flush_session_log. The composite iterates BACKEND_REGISTRY to locate sessions, supports per-backend dispatch via locator_for(backend), and (remediation) wraps each backend's call in try/except Exception with 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 CompositeSessionLocator in execution/backends/_composite_locator.py that iterates BACKEND_REGISTRY to locate session logs, then replace the dual codex_log_path/ClaudeSessionLocator branching in flush_session_log with backend-parameter-driven dispatch through this composite. Remove the codex_log_path parameter from flush_session_log and the pre-computation block from _headless_execute.py. Update tests to use explicit backend= dispatch instead of codex_log_path=.

Group 2: T5-P4-A6-WP2 Remediation — Per-backend exception handling in CompositeSessionLocator.locate_session

Add per-backend try/except Exception with structured debug logging inside CompositeSessionLocator.locate_session so 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 Model count uncached output cache_read peak_ctx turns cache_write time
plan* opus[1m] 2 6.5k 58.5k 3.1M 136.9k 101 177.1k 24m 29s
verify* sonnet 2 934 26.5k 701.1k 80.8k 47 88.2k 9m 46s
implement* MiniMax-M3 2 4.5M 19.1k 0 0 136 0 12m 53s
fix* sonnet 1 382 38.2k 4.5M 126.2k 127 105.2k 18m 0s
audit_impl* sonnet 2 1.4k 30.4k 722.7k 61.9k 46 90.8k 15m 16s
retry_worktree* sonnet 1 68 1.8k 278.1k 42.8k 16 21.9k 2m 23s
prepare_pr* MiniMax-M3 1 258.4k 3.4k 0 0 17 0 1m 12s
compose_pr* MiniMax-M3 1 287.9k 2.2k 0 0 16 0 1m 0s
review_pr* sonnet 1 108 42.0k 871.6k 103.5k 38 83.5k 9m 56s
resolve_review* sonnet 1 702 29.9k 2.2M 104.7k 77 84.4k 13m 57s
Total 5.1M 252.0k 12.3M 136.9k 651.2k 1h 48m

* Step used a non-Anthropic provider; caching behavior may differ.

Token Efficiency

Step LoC Changed cache_read/LoC cache_write/LoC output/LoC
plan 0
verify 0
implement 288 0.0 0.0 66.4
fix 18 247544.2 5846.3 2124.1
audit_impl 0
retry_worktree 0
prepare_pr 0
compose_pr 0
review_pr 0
resolve_review 19 114696.6 4441.1 1573.8
Total 325 37874.3 2003.7 775.4

Model Usage Breakdown

Model steps uncached output cache_read cache_write time
opus[1m] 1 6.5k 58.5k 3.1M 177.1k 24m 29s
sonnet 6 3.6k 168.8k 9.2M 474.1k 1h 9m
MiniMax-M3 3 5.1M 24.7k 0 0 15m 7s

claude and others added 7 commits June 12, 2026 20:47
… 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.
@Trecek Trecek added this pull request to the merge queue Jun 13, 2026
Merged via the queue into develop with commit 6f93702 Jun 13, 2026
3 checks passed
@Trecek Trecek deleted the t5-p4-a6-wp2-provide-a-single-sessionlocator-dispatch-point/4024 branch June 13, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants