fix(agent): honor prompt_caching.cache_ttl=off on MoA and fallback stub paths - #76622
Merged
kshitijk4poor merged 5 commits intoAug 2, 2026
Merged
Conversation
Blank SimpleNamespace stubs used by MoA decoration and plan_cache_sections_for_destination never set _cache_disabled, so anthropic_prompt_cache_policy re-injected cache_control markers after operators turned caching off. Stamp the disable onto those stubs from an explicit flag or the live config, and pass the agent flag from the MoA aggregator path. Fixes NousResearch#76085
Avoid F401 from ruff/pyflakes on the NousResearch#76085 regression file.
Prepared-aggregator facades built via __new__ lack _agent. Accessing self._agent raised inside the planner try and bool-coercion of a missing snapshot forced False, suppressing config fallback for cache_ttl=off. Pass a tri-state value and add a no-agent/config-off regression.
Absorb the useful deltas from the parallel NousResearch#76121 approach: a single blank_cache_policy_stub factory so _cache_disabled cannot be left off hand-rolled SimpleNamespaces, and pin the live agent disable onto MoA advisor fan-out and one-shot aggregate_moa_context decoration so those paths track conversation state rather than a fresh config re-read. Keeps the earlier tri-state prepared-aggregator no-agent fix. Adds factory and synthesis/advisor regressions. Coordinates with NousResearch#76121 / NousResearch#76085. Co-authored-by: JoaoMarcos44 <87440198+JoaoMarcos44@users.noreply.github.com>
…d stub paths Follow-ups from review of NousResearch#76113: - Extract cache_ttl_means_disabled() as the single disable-synonym predicate; agent_init and prompt_caching_disabled_from_config both use it so the two detection sites can no longer drift (drift would recreate the NousResearch#76085 bug class). - Mirror _run_reference's not-None injection guard in aggregate_moa_context (stamping None was a harmless no-op copy). - Replace a vacuous trailing test assertion with the intended input-non-mutation check; drop a stray blank line. - Add a predicate-parity regression test (unknown TTL values keep caching enabled, matching historical agent_init semantics).
kshitijk4poor
force-pushed
the
salvage/76113-cache-ttl-off-stubs
branch
from
August 2, 2026 06:01
7d2b1fe to
ff6e4b5
Compare
kshitijk4poor
enabled auto-merge (rebase)
August 2, 2026 06:01
12 tasks
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
prompt_caching.cache_ttl: offnow applies globally: MoA advisor/aggregator decoration and auxiliary fallback replans previously resolved cache policy against a blank stub without_cache_disabled, so they kept injectingcache_controlmarkers after the operator disabled caching (#76085, contract from #33555).Salvage of #76113 by @686f6c61 — all four commits cherry-picked with authorship preserved (includes the
Co-authored-by: @JoaoMarcos44trailer from the #76121 consolidation). One follow-up commit on top applies review findings.Changes
blank_cache_policy_stub()single sanctioned stub factory carrying_cache_disabled; config-detection helper; tri-state threading through MoA advisor fan-out, one-shot synthesis, and the prepared aggregator; 12 regression tests.cache_ttl_means_disabled()shared predicate —agent_initand the stub-path helper now use one disable-synonym source so the two detection sites cannot drift; consistent not-None injection guard inaggregate_moa_context; replaced a vacuous test assertion with the intended input-non-mutation check; predicate-parity regression test.Validation
_cache_disabledleak intocall_llmwire kwargsFixes #76085.
Based on #76113 by @686f6c61 (with @JoaoMarcos44 credited via trailer). Requires #76618 (attribution mapping) to merge first.