Rectify Codex Code-Mode delivery-bound immunity with bounded summary#4302
Merged
Trecek merged 5 commits intoJul 20, 2026
Merged
Conversation
…apabilities.effective_delivery_token_limit Resolves #4300. Code-mode models (gpt-5.6-sol) bypass the tool_output_token_limit ceiling via model-declared max_output_tokens, so the server-side response backstop must apply each backend's worst-case operative bound at response time rather than rely on the static exemption ceiling. Changes: - Add effective_delivery_token_limit field to BackendCapabilities (46_500 for Claude Code, 10_000 for Codex). - Add resolve_effective_delivery_bound() canonical accessor in execution/backends/_delivery_bounds.py. - Add effective_delivery_token_limit parameter to enforce_response_budget() that gates both the exempted-within-ceiling and non-exempted under-budget early-return paths. Spill-and-project produces a bounded projection with reason="delivery_bound" via the existing _autoskillit_response_spill envelope. - Wire delivery-bound extraction through both call sites: track_response_size decorator and shape_execution_response. - Update ADR-0005: per-repo ceiling guidance now documents that the server-side backstop enforces the bound for code-mode, not the advisory digest. Move code-mode bypass from Accepted Gaps to Resolved. Tests: - Backend-aware delivery bound resolution across BACKEND_REGISTRY. - Exempted payload above Codex code-mode bound spills, not passed through. - Bundled recipe payload fits or spills per backend. - Non-exempted oversized payload within response_max_bytes but above delivery bound routes to spill-and-project. - CODEX_INTAKE_DISCIPLINE_DIGEST numeric max_output_tokens rule must match the Codex effective delivery bound (regression guard). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…reat zero as no-op - Move src/autoskillit/execution/backends/_delivery_bounds.py to src/autoskillit/core/_delivery_bounds.py — the function operates on BackendCapabilities (IL-0), and server-layer consumers cannot import from execution/backends per REQ-IMP-007 / REQ-ARCH-001. - Re-export through autoskillit.core.__init__.pyi. - Treat effective_delivery_token_limit <= 0 as "not configured" so pre-existing BackendCapabilities instances with the field default do not trigger the spill path (test mocks rely on this). - Mirror the new "delivery_bound" reason in the hook-formatter _RESPONSE_SPILL_REASONS frozenset. - Register _delivery_bounds in MODULE_CASCADE_CORE; bump core/ file budget to 25; add the field to the locked-name test set; add a docstring citation for the conformance coverage test. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ms set Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ing, projection cap Replace the generic projection in _spill_for_delivery_bound with a bounded inline summary that preserves the operational fields (success, kitchen, version, ingredients_table, orchestration_rules, stop_step_semantics, errors, suggestions) verbatim when they fit, truncates content to fit the bound, drops diagram when content alone exceeds the bound, and uniformly projects oversized preserved values before reaching the minimal rung. Delete the broken truncation fallback (dead store + malformed _finalize_envelope call that flattened metadata and raised _ProjectionNonconvergentError). Add a reason kwarg to _plain_spill_envelope so delivery-bound plain-text spills are labeled "delivery_bound". Restore the exemption-ceiling-first ordering in enforce_response_budget: ceiling check dominates, delivery-bound spill applies only within the ceiling, exemption event is the pass-through. Cap the non-exempted projection target at min(response_max_bytes, effective_delivery_token_limit * 4) so the rendered projection is structurally guaranteed to fit the transport bound. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…g, projection cap Tighten test_exempted_payload_spills_when_over_delivery_bound to assert delivery_bound_spill=True, success=True preserved, and reason strictly "delivery_bound" (not the 3-member set). Add six new tests in tests/server/test_response_backstop.py: - test_delivery_bound_summary_preserves_operational_fields (T1) - test_delivery_bound_summary_small_bound_no_exception (T2 REQ-026 guard) - test_delivery_bound_summary_drops_diagram_when_needed (T3) - test_over_ceiling_payload_fails_even_when_over_delivery_bound (T4 ordering) - test_non_exempted_projection_capped_at_delivery_bound (T5 REQ-023) - test_delivery_bound_summary_projects_oversized_preserved_fields (T9 rung-4) Rebuild _full_open_kitchen_payload in tests/contracts/test_delivery_bound_fitness.py on real bundled recipes via load_and_validate + build_open_kitchen_recipe_payload (the production routing-field injector) mirroring tests/recipe/test_bundled_recipes_all_truthy.py overrides; isolate via monkeypatch.chdir(tmp_path). Tighten the fit-or-spill assertion to require delivery_bound_spill=True and reason "delivery_bound". Resize the non-exempted overflow payload in Test 1.4 to 60 keys of 5,000 chars (~300 KB) so it exceeds every backend's bound and response_max_bytes; add the self-check that the payload exceeds the bound and that the spill envelope is produced. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Trecek
deleted the
codex-code-mode-truncates-open-kitchen-to-10k-despite-54-5k/4300
branch
July 20, 2026 19:27
This was referenced Jul 20, 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
The
open_kitchenMCP response exceeded Codex code-mode's 10,000-token transport bound because response-budget enforcement used a static exemption ceiling without accounting for backend delivery limits. This change makes delivery-bound handling backend-aware, emits bounded inline spill summaries with nested metadata, caps projections to the effective transport bound, restores exemption ordering, and adds real-payload fitness and regression coverage.Requirements
Conflict Resolution Decisions
Implementation Plan
Plan files:
/home/talon/projects/autoskillit-runs/remediation-20260720-080955-202344/.autoskillit/temp/rectify/rectify_codex_code_mode_delivery_bound_2026-07-20_081500.md/home/talon/projects/autoskillit-runs/remediation-20260720-080955-202344/.autoskillit/temp/make-plan/codex_code_mode_delivery_bound_remediation_plan_2026-07-20_095535.mdCloses #4300
🤖 Generated with Claude Code via AutoSkillit
Token Usage Summary
* Step used a non-Anthropic provider; caching behavior may differ.
Token Efficiency
Model Usage Breakdown