Implementation Plan: T5-P4-A3-WP3 Ensure every guard hook in a launched session can dispatch on AUTOSKILLIT_AGENT_BACKEND#4095
Merged
Trecek merged 3 commits intoJun 12, 2026
Conversation
…e builders Guard hooks launched in interactive and resume sessions can now dispatch on backend identity via the CmdSpec.env flat var, eliminating the implicit os.environ read that created a cross-layer contract. - claude.py build_interactive_cmd and build_resume_cmd: inject both AGENT_BACKEND_ENV_VAR and AGENT_BACKEND_DYNACONF_ENV_VAR into the merged extras dict before caller env_extras (callers can still override) - codex.py build_interactive_cmd: add AGENT_BACKEND_ENV_VAR to the merged_extras dict alongside the existing dynaconf var - codex.py build_resume_cmd: set include_agent_backend_flat=True on the _codex_exec_extras call so the flat var is injected - _type_constants_env.py: add AGENT_BACKEND_ENV_VAR to CODEX_INTERACTIVE_REQUIRED_ENV so CodexEnvPolicy.build_env() raises if a future regression drops the injection - test_subpackage_isolation.py: bump codex.py line-limit exemption from 1062 to 1066 to accommodate the new injections Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…unch builders Two new parametrized arch tests enforce the invariant that AUTOSKILLIT_AGENT_BACKEND appears in CmdSpec.env for every backend across all four guard-launch builders (build_skill_session_cmd, build_food_truck_cmd, build_interactive_cmd, build_resume_cmd), and that the flat and dynaconf forms carry matching values in the interactive and resume builders. Both tests rely on the existing _clean_env autouse fixture which strips AUTOSKILLIT_AGENT_BACKEND and AUTOSKILLIT_AGENT_BACKEND__BACKEND from os.environ to ensure the flat var is sourced from each builder's extras dict, not ambient env. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds `from autoskillit.core.types._type_backend import CmdSpec` and `assert isinstance(spec, CmdSpec)` in `test_agent_backend_flat_env_var_in_all_guard_launch_builders` so a wrong-type return from `_call_builder` produces a clear assertion failure rather than an opaque AttributeError. 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
Inject
AGENT_BACKEND_ENV_VAR(flat form:AUTOSKILLIT_AGENT_BACKEND) intoCmdSpec.envforbuild_interactive_cmdandbuild_resume_cmdin both the Claude Code and Codex backends. Currently, onlybuild_skill_session_cmdandbuild_food_truck_cmdset this variable. Guard hooks launched in interactive and resume sessions cannot dispatch on backend identity without readingos.environ, which creates an implicit cross-layer contract. This plan closes that gap, updates theCODEX_INTERACTIVE_REQUIRED_ENVvalidation gate to include the newly injected var, and adds two parametrized arch tests to enforce the invariant across all four builder methods for every registered backend.Requirements
Conflict Resolution Decisions
The following files had merge conflicts that were automatically resolved.
Closes #4019
Implementation Plan
Plan file:
/home/talon/projects/autoskillit-runs/impl-20260612-113600-305738/.autoskillit/temp/make-plan/t5-p4-a3-wp3-ensure-every-guard-hook-in-a-launched-session-c_plan_2026-06-12_114500.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