Implementation Plan: Codex Sous-Chef Recipe Context Loss via Auto-Compaction#3947
Merged
Trecek merged 3 commits intoJun 9, 2026
Merged
Conversation
Add CODEX_AUTO_COMPACT_LIMIT (999_999_999) so Codex cannot compact recipe content out of the agent's context during long pipeline runs. Wire it through _is_autoskillit_registered and ensure_codex_mcp_registered (both normal and corrupt paths), plus the re-export chain and the test fixtures that build "valid config" dicts. Add a new PreToolUse guard `recipe_read_guard.py` that denies run_cmd/Bash commands containing recipe/skill/agent path patterns and run_python callables matching `autoskillit.recipe.*` in headless sessions. This is defense-in-depth that cannot be compacted away, unlike the prompt-based prohibitions in `_backend_supplement()`. Register the guard in HOOK_REGISTRY with matcher `Bash|mcp__.*autoskillit.*__(run_cmd|run_python)` and add it to NEW_SUBDIR_BASENAMES. Run `task sync-hooks-hash` to refresh registry.sha256. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…to doctor test fixture
…_guard Mirrors the pattern established in fleet_dispatch_guard.py — emit sys.stderr.write() on the fail-open path so silent OSError failures are observable in session logs without changing the fail-open contract.
e55477a to
4211154
Compare
This was referenced Jun 10, 2026
This was referenced Jul 15, 2026
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
Prevent Codex sous-chef sessions from losing recipe content during long pipeline runs by:
Disabling auto-compaction — Set
model_auto_compact_token_limit = 999999999in the Codexconfig.tomlviaensure_codex_mcp_registered(), using the existing_ensure_top_level_key()pattern already used fortool_output_token_limit.Structural recipe-read guard — Add a new blocking PreToolUse guard hook (
recipe_read_guard.py) that deniesrun_cmd/Bashcalls containing recipe/skill/agent file path patterns andrun_pythoncalls importingautoskillit.recipe.*. This provides defense-in-depth that cannot be compacted away, unlike the prompt-based prohibitions in_backend_supplement().Implementation Plan
Plan file:
/home/talon/projects/autoskillit-runs/impl-20260608-151346-014727/.autoskillit/temp/make-plan/codex_sous_chef_recipe_context_loss_via_auto_compaction_plan_2026-06-08_153500.mdCloses #3938
🤖 Generated with Claude Code via AutoSkillit
Token Usage Summary
* Step used a non-Anthropic provider; caching behavior may differ.
Token Efficiency
Model Usage Breakdown