Skip to content

Cache Anthropic capabilities and defer compaction lookup - #184

Open
Anteriousis wants to merge 1 commit into
10-X-eng:mainfrom
Anteriousis:fix/anthropic-capability-cache
Open

Cache Anthropic capabilities and defer compaction lookup#184
Anteriousis wants to merge 1 commit into
10-X-eng:mainfrom
Anteriousis:fix/anthropic-capability-cache

Conversation

@Anteriousis

Copy link
Copy Markdown
Contributor

Reuse Anthropic model output capabilities across user turns through a parent-process cache (64 entries, five-minute TTL), scoped to model, endpoint and authentication identity. Child processes receive validated cached values and report successful lookups back to the parent. Credentials are hashed in cache identity and excluded from capability events.

A distinct compaction model is now resolved only when compaction is needed. Short successful turns avoid that lookup entirely; warm turns also avoid the primary lookup. Model-reported maximum output and older-SDK fallback behavior remain intact. Failed lookups and older-SDK fallback values are not cached.

Verification

  • Regression tests failed before implementation and pass afterward.
  • Exact test/build commands and results are listed below.

With local test dependencies on PYTHONPATH, $python denotes the bundled Python executable:

& $python -m pytest -q src/Mod/VibeCAD/vibecad_tests/test_provider_subprocess.py -k 'capabilities_survive or defers_unused' --tb=short
# Red: 7 failed, 52 deselected.
& $python -m pytest -q src/Mod/VibeCAD/vibecad_tests/test_provider_subprocess.py src/Mod/VibeCAD/vibecad_tests/test_gemini_provider.py --tb=short
# Green: 77 passed, 1 skipped (platform-specific).
& $python -m py_compile src/Mod/VibeCAD/VibeCADProvider.py
git diff --check

Tests exercise new provider instances, endpoint/model/auth changes, TTL expiry without sliding refresh, bounded size, failed/invalid metadata, lazy compaction and existing maximum-output/older-SDK behavior. Provider and CAD boundaries are mocked; no paid API calls or full FreeCAD GUI/C++ build were run.

Capabilities may remain stale for up to five minutes. Concurrent cold turns may each retrieve metadata; no cross-process shared disk cache or request coalescing is introduced.

Compatibility

  • Existing public functions/APIs remain present and compatible.
  • No preference keys, tool names or schema fields renamed/removed.
  • Output limits and existing generation defaults are preserved.
  • No deprecations or breaking public API changes.

Issues

Closes #178.

Before and After Images

Not applicable; no GUI changes.

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.

Cache Anthropic model capabilities across turns and defer unused compaction lookups

1 participant