azurenoops / azurenoops/spin_agent

[BUG] [KnowledgeBase/MCP] - RMF guidance intent fails with 'Cache entry must specify a value for Size when SizeLimit is set' — KB agent broken

Open
#632 0 comments 0 reactions 1 assignee Claimed by @jrspinella View on GitHub
agent:oracle area:rmf bug priority:high
Dominant language
C#
Stars
3
Forks
1
Avg merge
11h 20m
Merged PRs (30d)
70

Description

## Bug Description
The KnowledgeBase Agent returns a fatal server-side error for RMF guidance intents, preventing all knowledge lookups related to the NIST RMF framework, FedRAMP, and general compliance guidance.

**Error:** `Cache entry must specify a value for Size when SizeLimit is set.`

This is a .NET MemoryCache configuration bug: the application's `IMemoryCache` has a `SizeLimit` set but the code that populates KB cache entries does not set a `Size` value, causing an unhandled exception on every KB retrieval call.

## Steps to Reproduce
```bash
curl -s -X POST -H 'Content-Type: application/json' \
-d '{"message":"What is the NIST RMF?"}' \
https://ca-ato-copilot-mcp-v2.blackwater-9393aa1a.centralus.azurecontainerapps.io/mcp/chat
```

Expected: A response explaining the NIST Risk Management Framework.
Actual: `{"success":false,"response":"I encountered an error while looking up information: Cache entry must specify a value for Size when SizeLimit is set."}`

## Expected Behavior
KnowledgeBase Agent returns an informative answer explaining the NIST RMF, its 7 steps, and their relevance to the current context.

## Actual Behavior
- `success: false`
- `intentType: knowledgebase`
- `agentUsed: KnowledgeBase Agent`
- Response: `I encountered an error while looking up information: Cache entry must specify a value for Size when SizeLimit is set.`
- `toolsExecuted: []` — no tools ran

## Affected Intents
Any intent routed to the KnowledgeBase Agent that triggers a cache read:
- "What is the NIST RMF?"
- "Explain RMF step 1"
- Likely: "What is FedRAMP?", "What is CMMC?", any general guidance prompt

Note: Control-family lookups via `kb_explain_nist_control` work (e.g. "Explain AC-2" routes differently), but top-level RMF explanation fails.

## Console Errors
N/A (server-side .NET exception)

## Root Cause (Likely)
`IMemoryCache.CreateEntry()` call in KB service sets `SlidingExpiration` or `AbsoluteExpiration` but does NOT set `entry.Size = X`. When `MemoryCacheOptions.SizeLimit` is configured, every entry must declare its size. Fix: add `entry.Size = 1` (or appropriate size) to the cache entry creation in the KnowledgeBase agent.

## Browser/Environment
- MCP API: https://ca-ato-copilot-mcp-v2.blackwater-9393aa1a.centralus.azurecontainerapps.io
- Confirmed reproducible via direct API call (not browser-dependent)
- Date: 2026-07-09T12:45:00Z
- Sweep: Automated 4-hour QA sweep

## Playwright Test Code
```typescript
test('[KnowledgeBase] RMF explanation returns error when SizeLimit not set on cache', async () => {
const resp = await request.post('/mcp/chat', {
data: { message: 'What is the NIST RMF?' }
});
const body = await resp.json();
expect(body.success).toBe(true);
expect(body.response).not.toContain('Cache entry must specify a value');
expect(body.intentType).toBe('knowledgebase');
expect(body.toolsExecuted.length).toBeGreaterThan(0);
});
```

*Filed by Oracle — Automated 4-hour QA Sweep 2026-07-09T12:45:00Z*

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.