T5-P4-A6-WP1 Enforce the contract — capability-gate context exhaustion detection#4099
Open
Trecek wants to merge 3 commits into
Open
T5-P4-A6-WP1 Enforce the contract — capability-gate context exhaustion detection#4099Trecek wants to merge 3 commits into
Trecek wants to merge 3 commits into
Conversation
…t_exhaustion_detection capability classify_infra_exit now requires a BackendCapabilities argument and wraps the two CONTEXT_EXHAUSTED checks (session._is_context_exhausted() and _CODEX_CONTEXT_EXHAUSTION_PATTERN search) in capabilities.supports_context_exhaustion_detection. Backends that do not implement context-exhaustion detection fall through to downstream classification. The production call site in _headless_result._build_skill_result passes backend.capabilities (already in scope). Removes supports_context_exhaustion_detection from _FORWARD_DECLARED in test_capability_consumption.py — the field now has a production consumer in _exit_classification.py, so the exemption is no longer needed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…y-gate coverage Updates 37 callers of classify_infra_exit across three test files to pass capabilities=CLAUDE_CODE_CAPABILITIES (preserves existing behavior since the Claude Code capabilities have supports_context_exhaustion_detection=True): - test_exit_classification.py: 27 calls - test_adapt_agent_result.py: 2 calls - test_api_error_signal_invariants.py: 8 calls Adds TestContextExhaustionCapabilityGate with two tests: - test_capability_false_suppresses_context_exhausted (False branch coverage) - test_capability_true_allows_context_exhausted (True branch coverage) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ill_result against xdist timing races The test used CHANNEL_B_NO_STDOUT_SCRIPT (2.0s gap) and lacked natural_exit_grace_seconds, making it susceptible to a Phase 1 detection race on WSL2 under 4-worker xdist load: if Phase 1 asyncio scheduling is delayed >2.0s, Phase 2 initializes scan_pos after the marker is already in the file and Channel B never fires, producing TIMED_OUT instead of COMPLETED. Fixes: - Inline a 3.0s-gap script (matching the WSL2-jitter margin documented in CHANNEL_B_THEN_A_CONFIRM_SCRIPT) so Phase 1 always discovers the file before the marker arrives - Add natural_exit_grace_seconds=0.1 to avoid asyncio-waitpid thread contention (script hangs with time.sleep(3600)) - Increase timeout to 300 and _phase1_timeout to 400 (consistent with proven-stable drain tests in TestChannelBDrainWait) - Increase pytest.mark.timeout to 360 (matches peer drain tests)
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
Add a
capabilitiesparameter toclassify_infra_exitso context-exhaustion classification is gated bysupports_context_exhaustion_detection. Remove the stale_FORWARD_DECLAREDexemption and add branch-level coverage for both the True and False paths. The prerequisite work (P2-A1-WP3) did not land a capability-gated branch, so this plan includes adding the gate itself.Implementation Plan
Plan file:
/home/talon/projects/autoskillit-runs/impl-20260612-175100-661664/.autoskillit/temp/make-plan/t5_p4_a6_wp1_enforce_capability_gate_plan_2026-06-12_175700.md🤖 Generated with Claude Code via AutoSkillit
Closes #4023
Token Usage Summary
* Step used a non-Anthropic provider; caching behavior may differ.
Token Efficiency
Model Usage Breakdown