Skip to content

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 into
developfrom
t5-p4-a3-wp3-ensure-every-guard-hook-in-a-launched-session-c/4019
Jun 12, 2026
Merged

Implementation Plan: T5-P4-A3-WP3 Ensure every guard hook in a launched session can dispatch on AUTOSKILLIT_AGENT_BACKEND#4095
Trecek merged 3 commits into
developfrom
t5-p4-a3-wp3-ensure-every-guard-hook-in-a-launched-session-c/4019

Conversation

@Trecek

@Trecek Trecek commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Inject AGENT_BACKEND_ENV_VAR (flat form: AUTOSKILLIT_AGENT_BACKEND) into CmdSpec.env for build_interactive_cmd and build_resume_cmd in both the Claude Code and Codex backends. Currently, only build_skill_session_cmd and build_food_truck_cmd set this variable. Guard hooks launched in interactive and resume sessions cannot dispatch on backend identity without reading os.environ, which creates an implicit cross-layer contract. This plan closes that gap, updates the CODEX_INTERACTIVE_REQUIRED_ENV validation 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 Model count uncached output cache_read peak_ctx turns cache_write time
plan* opus[1m] 1 78 20.2k 1.9M 103.5k 58 82.3k 13m 49s
verify* sonnet 1 1.2k 19.1k 485.6k 73.4k 27 52.5k 9m 55s
implement* MiniMax-M3 1 2.1M 9.3k 0 0 63 0 11m 55s
audit_impl* sonnet 1 44 10.8k 167.0k 42.1k 14 33.1k 4m 2s
prepare_pr* MiniMax-M3 1 198.3k 3.9k 0 0 14 0 1m 20s
compose_pr* MiniMax-M3 1 213.0k 1.4k 0 0 12 0 42s
review_pr* sonnet 1 148 32.2k 968.9k 79.9k 48 59.6k 7m 7s
resolve_review* sonnet 1 221 17.0k 1.7M 80.6k 64 60.1k 7m 41s
Total 2.6M 114.0k 5.2M 103.5k 287.6k 56m 33s

* 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 84 0.0 0.0 111.2
audit_impl 0
prepare_pr 0
compose_pr 0
review_pr 0
resolve_review 2 856138.5 30066.0 8502.0
Total 86 60666.4 3344.6 1325.5

Model Usage Breakdown

Model steps uncached output cache_read cache_write time
opus[1m] 1 78 20.2k 1.9M 82.3k 13m 49s
sonnet 4 1.6k 79.1k 3.3M 205.3k 28m 46s
MiniMax-M3 3 2.6M 14.6k 0 0 13m 58s

Trecek and others added 3 commits June 12, 2026 12:10
…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>
@Trecek Trecek added this pull request to the merge queue Jun 12, 2026
Merged via the queue into develop with commit 6c398d5 Jun 12, 2026
3 checks passed
@Trecek Trecek deleted the t5-p4-a3-wp3-ensure-every-guard-hook-in-a-launched-session-c/4019 branch June 12, 2026 19:50
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.

1 participant