Rectify: Session Type Boundary Contract Immunity#3359
Merged
Trecek merged 4 commits intoMay 31, 2026
Merged
Conversation
- Fix _write_order_entry() to use SessionType.ORCHESTRATOR.value instead of
SESSION_TYPE_ORDER ("order") for AUTOSKILLIT_SESSION_TYPE env var
- Fix _cook.py cook() to use SessionType.SKILL.value instead of
SESSION_TYPE_COOK ("cook") for AUTOSKILLIT_SESSION_TYPE env var
- Add FleetSessionEnv.__post_init__ to validate session_type is a valid
SessionType member at construction time (mirrors CaptureEntrySpec pattern)
- Add domain validation in build_agent_env() for AUTOSKILLIT_SESSION_TYPE
before the required-keys check, closing the write-side boundary universally
- Harden session_type() to raise ValueError on invalid values instead of
silently falling back to SKILL via DeprecationWarning
- Wrap session_type() calls in _guards.py with try/except ValueError so MCP
requests never propagate an unhandled exception from an invalid session type
- Update tests: remove tautological "order"/"cook" assertions, add boundary
contract tests, replace DeprecationWarning test with ValueError test, remove
unused suppress_deprecation parameter from test_session_type_resolver
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…bels Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Consistent with parallel validation sites in _type_session_env.py and _type_helpers.py that already suppress the original traceback context. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Bind the ValueError as `e` and pass str(e) to headless_error_result so the invalid value and valid-members list reach the caller, instead of a generic "invalid AUTOSKILLIT_SESSION_TYPE" message. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5819105 to
856e9bf
Compare
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
CLI session launch functions (
_write_order_entry()and_cook.py:cook()) setAUTOSKILLIT_SESSION_TYPEto display labels ("order","cook") instead of validSessionTypeenum values ("orchestrator","skill"). The server'ssession_type()resolver silently falls back toSessionType.SKILLvia aDeprecationWarning, masking the invalid value. This causes order sessions (L2 orchestrators) to be misidentified as L1 skill sessions by all downstream infrastructure: visibility dispatch, lifespan boot, guard functions, and hook exemptions.The architectural weakness is the absence of a write-boundary contract — the env var value is validated at the read point (server) but never at the write point (CLI). The fix decouples the two naming systems (CLI display labels vs.
SessionTypeenum values) by introducing a typed boundary spec and a validation assertion at the env-assembly point.Closes #3338
Implementation Plan
Plan file:
/home/talon/projects/autoskillit-runs/remediation-20260530-161415-545091/.autoskillit/temp/rectify/rectify_session_type_boundary_contract_2026-05-30_170000.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