Skip to content

fix(agents): skip provider discovery when cache pruning is disabled - #117396

Merged
steipete merged 1 commit into
mainfrom
codex/cache-ttl-disabled-provider-discovery
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/cache-ttl-disabled-provider-discovery

Conversation

@steipete

@steipete steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The embedded-agent refactor in #117313 reversed the existing cache-TTL guard order. Every embedded agent attempt now resolves provider eligibility before checking whether cache-TTL pruning is enabled. Provider eligibility enters plugin/runtime discovery without the caller configuration, so default or explicitly disabled pruning can still cold-load installed plugin metadata, including when plugins are disabled. Real openclaw tui --local PTY scenarios consequently rose to approximately 83-85 seconds each and intermittently exhausted the CI silence watchdog.

Why This Change Was Made

Restore the original producer-owned, configuration-first short circuit in installEmbeddedAttemptContextGuards: inspect contextPruning.mode first and invoke provider eligibility only for explicit cache-ttl. This matches the existing sibling cache-marker guard and preserves eligible/ineligible provider behavior, timestamps, prompt transforms, and cleanup. The production change is exactly 7 additions and 7 deletions: zero net production lines, no new configuration, no provider special cases, and no reporter/timeout workaround.

User Impact

Default local TUI and embedded-agent launches no longer perform unnecessary cold plugin discovery. Real remote PTY subprocess measurements using the actual embedded runtime, with only the external model HTTP endpoint mocked:

  • Normal local model response: 83 seconds before -> 11.76 seconds after, 7.06x faster.
  • Same-turn local session steering: 83 seconds before -> 5.46 seconds after, 15.20x faster.
  • Real local validation-loop abort diagnostics: 83 seconds before -> 5.31 seconds after, 15.62x faster.

Explicitly configured cache-TTL pruning continues to discover provider capabilities and project expired history exactly as before.

Evidence

  • Testbox proved the exact reviewed Git tree and both changed-file SHA-256 hashes, then independently verified conflict-free merging with the newer GitHub main head while preserving both reviewed source blobs.
  • Four complete focused owner/sibling suites passed: 29 tests across embedded attempt context guards, provider cache-TTL eligibility, expired tool-result projection, and cache-TTL session markers.
  • Three actual tui --local PTY subprocess and embedded-runtime scenarios passed: exactly 3 selected, 3 passed, 0 failed, 0 selected skips; wall-clock case times 11.76s, 5.46s, and 5.31s. Same-turn steering produced two real provider requests and rendered the completion. Thirteen unrelated gateway/unit cases were explicitly name-filtered, not reported as skips.
  • New owner regressions prove provider discovery and timestamp reads never occur for absent configuration, absent pruning, missing mode, or explicit off; separate regressions preserve enabled/ineligible and enabled/eligible providers.
  • Canonical two-file formatting and complete remote pnpm check:changed --base origin/main -- <two changed files> passed: core and test tsgo, targeted lint, SDK/API, provider/plugin boundaries, dead-code, database, webhook/pairing, and zero runtime-cycle guards.
  • Fresh full-branch autoreview and TruffleHog passed with no accepted findings; correctness confidence 0.99.
  • Production delta: +7/-7, net zero; focused regression tests: +67.
  • Original single Testbox proof exited 0 after 6m04s; its lease was independently verified stopped.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Aug 1, 2026
@steipete
steipete marked this pull request as ready for review August 1, 2026 12:09
@steipete
steipete merged commit 9a29304 into main Aug 1, 2026
247 of 252 checks passed
@steipete
steipete deleted the codex/cache-ttl-disabled-provider-discovery branch August 1, 2026 12:45
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant