AI Reliability Intermediate

Reliable LLM Assistant Outputs: A Diagnosis and Fix Playbook

Diagnose stale, blank, or wrong LLM assistant responses across caching, retrieval, prompt assembly, and post-processing, then fix and monitor them.

45 min Octacer Engineering August 19, 2026
An engineer studying a dark wall of many AI assistant conversations where a single tenant's stalled generation glows green.

When the AI assistant returns stale, blank, or wrong output

Objective

Diagnose and fix

This playbook enables a team to diagnose and fix a multi-tenant LLM assistant that intermittently returns stale, blank, or incorrect responses while the underlying model appears healthy.

End state

The target end state is a production assistant pipeline where each tenant's request reliably returns a current, complete, and contextually correct answer, and where the failure mode is visible to operators the moment it occurs.

Why it matters

The business reason matters here: an assistant that silently serves wrong answers erodes trust faster than one that fails loudly. Empty or stale responses also generate support tickets, manual rework, and lost user confidence — often without any corresponding signal from the model provider's status page.

This playbook treats the model as a single component in a larger pipeline. The systems affected are:

  • the chat API layer that receives tenant requests
  • any caching or session-storage layer between the API and the model
  • the retrieval or context-assembly stage
  • the model invocation itself
  • the logging and observability stack

Success criteria

  • The affected tenant's real chat interaction is reproduced using read-only diagnostics.
  • The root cause is traced to a specific stage in the pipeline, not the model.
  • A fix is applied using the least invasive option that resolves the issue.
  • The pipeline produces fresh, complete, correct output for the affected tenant.
  • Future occurrences produce visible alerts rather than silent degradation.

Prerequisites

Access

Read access to production logs for the chat API and model invocation layers
Read access to the caching or session store (or a security-approved export of relevant keys)
Access to the observability platform (logs, metrics, traces) for the affected service
A way to make authenticated test requests as the affected tenant — this may require a test credential, a sandboxed tenant, or a temporary token issued by the platform owner
Permission to view, but not modify, tenant configuration and prompt templates

Data

The tenant ID and timestamp of at least one reported incident
The exact user message that produced the bad response, if available
The response the user actually received
The expected response, if the user or a human reviewer can articulate it

Conditions

Confirmed that the model provider's status page shows no active incident
Confirmed that the model itself returns correct output when invoked directly with the same prompt, outside the assistant pipeline
Network access to the systems under investigation
Any runbooks or documentation describing the assistant's architecture, including the request flow and caching policy

Decisions

Before beginning, confirm who holds authority to:

  • modify caching configuration in production
  • adjust retrieval parameters
  • deploy a code change to the assistant service
  • issue a new token or refresh tenant credentials

Tools and systems

The following tools are involved in this implementation. Their exact identities will vary by environment; the capabilities described are what matter.

  • Chat API service — receives tenant requests, assembles context, invokes the model, returns responses. This is the primary system under investigation.
  • Caching or session store — retains prior responses or conversation context. A common source of stale output. Examples include Redis, Memcached, or a database-backed session store.
  • Retrieval service — fetches tenant-specific context, documents, or knowledge-base content that gets injected into the model prompt. A common source of empty or wrong output.
  • Model provider API — the LLM endpoint. Used as a baseline reference to confirm the model itself is healthy.
  • Observability platform — logs, metrics, and traces that allow the request path to be reconstructed end to end.
  • Tenant configuration store — holds per-tenant settings that can influence the pipeline, including model selection, prompt templates, and feature flags.

Confirm which tools exist in the environment before beginning. If a documented architecture exists, align the diagnosis against it rather than assuming the pipeline shape.

Step 1 — Reproduce the affected tenant's real chat interaction

What this step does

Actions

  1. 1

    Collect details

    Collect the reported incident details: tenant ID, timestamp, user message, actual response, and expected response if known.

  2. 2

    Find logs

    Locate the log entries for that specific request. Search the chat API logs by tenant ID and timestamp. Extract:

  3. 3

    Search traces

    Search the tracing platform for the same request ID. If distributed tracing is enabled, confirm the sequence of service calls and their latencies.

  4. 4

    Check cache

    Query the caching store for any keys associated with this tenant and conversation. Determine whether a cached response exists and whether its timestamp explains the stale output. Use read-only commands:

  5. 5

    Replay request

    Replay the exact request against the API with caching bypassed, if the API supports a no-cache header or query parameter. Compare the result against the original.

  6. 6

    Invoke model

    Invoke the model directly with the same assembled prompt, outside the assistant pipeline. Use the same model, temperature, and other parameters recorded in the logs:

  7. 7

    Document findings

    Document the result of each reproduction attempt in a shared running log. Record what was tested, what was observed, and what it rules in or out.

  • the full request payload
  • the assembled prompt
  • the model response
  • the response returned to the user
  • all cache lookups and their hit/miss status
# Example for a Redis-backed cache — replace with the actual store's query mechanism
redis-cli --scan --pattern "tenant:<TENANT_ID>:conv:*"
  1. Identify whether the user message produced a cache hit, a cache miss, or an expiration-related failure.
# Example direct invocation — substitute the actual API client and parameters
curl -X POST "<MODEL_API_ENDPOINT>" \
  -H "Authorization: Bearer <READ_ONLY_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<MODEL_NAME>",
    "messages": [{"role": "user", "content": "<EXACT_PROMPT_FROM_LOGS>"}],
    "temperature": <TEMPERATURE_FROM_LOGS>
  }'

Important considerations

  • Do not modify tenant configuration, clear cache entries, or change retrieval parameters during this phase. The point is to observe, not alter.
  • Some caches are correct by design: a conversation-summary cache is expected to return prior context. Distinguish between "stale because cache TTL expired incorrectly" and "stale because the pipeline intentionally serves the last known response."
  • The direct model invocation is a baseline check only. If the model fails here too, the problem is upstream of your pipeline and this playbook's later steps are not applicable.
  • Respect tenant data boundaries. If a sandboxed tenant or synthetic credential is available, prefer it over replaying real production traffic.

Done when

Step 2 — Trace the failure to a specific pipeline stage

What this step does

Actions

  1. Map the request flow against the documented architecture. Confirm the actual stages by inspecting configuration and code paths:

Request flow

request ingestion
tenant resolution
cache lookup
retrieval and context assembly
prompt construction
model invocation
response post-processing
response caching and delivery

Cache checks

entries with TTLs longer than the documented maximum
entries that never expire
cache keys that omit the tenant ID, conversation ID, or a version identifier
responses cached before a prompt-template or model-version change

Retrieval checks

Was the retrieval call successful, or did it return zero documents?
Did the retrieval service fail silently and the pipeline continue with an empty context?
Was the document source unavailable and the error swallowed?

Prompt assembly

Was the full tenant context included, or was a truncated or default template used?
Did a feature flag or tenant setting alter which template was selected?
Was system context or prior conversation history omitted?

Post-processing

Did a formatting or extraction step strip the model output?
Was a default or fallback response substituted when the model returned an empty completion?
Did the model return a completion but the pipeline truncate it?

  1. Check the cache layer for TTL violations. Look for:
  1. Inspect the retrieval stage for empty or incomplete results:
  1. Examine the prompt-assembly logic:
  1. Check response post-processing:
  1. Review the metrics for this tenant over the incident window:
  • cache hit rate
  • retrieval error rate
  • empty-response rate
  • p95 and p99 latency
  1. Correlate the incident timestamp with deployment events, configuration changes, and cache invalidation jobs. A deploy or config push immediately before the first report is a strong signal.
  1. Produce a written trace conclusion. State the stage where the output became stale, empty, or wrong, and cite the specific evidence.

Important considerations

  • The most common failure patterns are: cache TTL misconfiguration, retrieval returning empty context with a swallowed error, and post-processing substituting a default response.
  • A single incident may have multiple contributing factors. Fix the primary defect first; revisit secondary factors after the primary fix is verified.
  • Version skew is a frequent hidden cause: a prompt template or model version changed, but the cache key did not incorporate the version, so old responses are served against new configuration.

Done when

Step 3 — Apply the least invasive fix

What this step does

Options, in order of invasiveness

Option A — Correct the cache configuration

Use this when the trace shows stale responses served from cache.

  1. Confirm the current TTL, key structure, and eviction policy by inspecting the configuration.
  2. Adjust the TTL to match the documented freshness requirement for the content type.
  3. Include a version identifier in the cache key — for example, the prompt-template version, model version, or content-source version:
# Current key (version-blind — serves stale content after a template change)
tenant:<TENANT_ID>:conv:<CONV_ID>

# Fixed key (version-aware — invalidates old content when the template changes)
tenant:<TENANT_ID>:conv:<CONV_ID>:template:v2
  1. If the content source updates on a schedule, align cache TTL with that schedule — or add an explicit invalidation job that purges affected keys on content release.
  2. For the affected tenant's active conversations, clear the specific stale keys after the TTL fix is in place. This is the one deliberate cache mutation in this playbook, and it should be scoped narrowly:
# Example scoped purge — replace with the actual store's deletion mechanism
redis-cli --scan --pattern "tenant:<TENANT_ID>:conv:<CONV_ID>*" | xargs redis-cli del
  1. Re-run the reproduction from Step 1. A fresh response should be served and cached with the corrected TTL and key structure.

Option B — Fix error handling in the retrieval stage

Use this when the trace shows empty context because a retrieval error was swallowed.

  1. Locate the retrieval call in the code and identify where the error is caught or ignored.
  2. Add a visible failure path: log the error with the tenant ID and request ID, and either surface a retriable error to the user or retry the retrieval once before falling back.
  3. Ensure the pipeline does not assemble a prompt with empty context unless the model is explicitly designed to handle it. Add a guard that fails the request if retrieval returns zero documents and the failure is not intentional.
  4. Decide whether the behavior should be "fail the request" or "proceed with a clearly labeled warning in the response." The safer default for a production assistant is to fail the request with a retriable error, not to serve a plausible-but-ungrounded answer.

Option C — Fix response post-processing

Use this when the model returned valid output but the pipeline substituted or stripped it.

  1. Find the post-processing step that truncates, formats, or substitutes the model response.
  2. Remove the default-response substitution unless there is a documented product reason for it. If a fallback is required, log every substitution with the reason.
  3. Fix any truncation logic that cuts output at a fixed character count without regard to content boundaries.
  4. Re-run the reproduction and confirm the complete model response reaches the user.

Option D — Code fix for prompt assembly

Use this when the trace shows the wrong template, missing context, or tenant settings not applied.

  1. Correct the template selection logic to respect the tenant's configured template and model selection.
  2. Add the missing context-assembly step (conversation history, system prompt, knowledge-base injection).
  3. Add an assertion or log line that records which template and context source were used for each request, so future diagnosis can verify assembly without code inspection.

Important considerations

Done when

Step 4 — Verify with a fresh reproduction and a regression test

What this step does

  1. 1

    Re-run reproduction

    Re-run the original reproduction from Step 1 with caching enabled. Confirm the corrected response is produced and cached correctly.

  2. 2

    Confirm cache

    Submit the same request a second time to confirm the cached copy is correct, not the stale one.

  3. 3

    Test variation

    Submit a new, slightly different request from the same tenant to confirm the fix is not limited to the exact reproduction message.

  4. 4

    Refresh content

    If the fix was cache-related, update the content source or template version and confirm old cached responses are no longer served.

  5. 5

    Simulate failure

    If the fix was retrieval-related, simulate the retrieval failure condition (disable the source or point at an invalid index in a test environment) and confirm the pipeline now produces a visible error rather than an empty-context answer.

  6. 6

    Regression check

    Run a regression check on a small set of other tenants to confirm the fix did not break unrelated behavior.

Important considerations

Done when

Step 5 — Add monitoring and alerts for silent degradation

What this step does

  1. 1

    Fallback metric

    Add a metric for responses where the pipeline caught an error and substituted a fallback or default. Alert when this count exceeds a tenant-specific or global threshold.

  2. 2

    Empty completion

    Add a metric for empty completions from the model — responses where the model returned successfully but with empty content. Alert on any increase above the established baseline.

  3. 3

    Retrieval failures

    Add a metric for retrieval failures, separated by cause (timeout, empty result, source unavailable). Alert when the rate exceeds the documented acceptable threshold.

  4. 4

    Cache freshness

    Add a freshness check on cached responses: log the age of every cache hit served to a user, and alert when the age exceeds the configured TTL. This catches TTL and key-collision defects before they produce visible stale output.

  5. 5

    Dashboards

    Verify the existing dashboards expose cache hit rate, retrieval error rate, and empty-response rate. If they do not, add the missing panels.

  6. 6

    Runbook entry

    Add a runbook entry documenting this diagnosis path, including the reproduction steps, the common failure patterns, and the fix options ordered by invasiveness.

Important considerations

Done when

Validation

Run the complete end-to-end validation across the pipeline:

Functional behavior

Send a fresh request from the affected tenant and confirm a correct, current response returns.
Send the same request again and confirm the cached response matches.
Send a request from a different tenant and confirm correct isolation — no cross-tenant content leakage.

Data correctness

Compare the response content against the current knowledge base or source documents. Confirm the response reflects the latest source state, not a prior version.

Failure behavior

Trigger the retrieval-failure condition in a test environment and confirm the pipeline now fails visibly with a retriable error instead of serving an ungrounded response.
Confirm the fallback-substitution path, if it exists, logs the reason and increments the alert metric.

Observability

Confirm the freshness alert fires when a cached response exceeds its TTL.
Confirm the empty-completion alert fires when the model returns no content.
Confirm the retrieval-error alert fires when the source is unavailable.

Repeatability

Run the workflow twice with identical requests and confirm identical, correct responses with no duplication or corruption.

Production readiness

Confirm the fix runs without manual intervention — no operator action is required between requests.

Rollback & edge cases

Rollback

  • Cache configuration change: revert the TTL and key structure to the prior values. Clear any new-format keys. Prior stale keys were already purged; confirm the old format is restored before traffic resumes.
  • Retrieval error-handling change: revert the code change and redeploy the previous release. Confirm the previous behavior is restored and document that it will again serve empty-context responses until the defect is addressed.
  • Post-processing change: remove the default-substitution removal by reverting to the previous release. Confirm the fallback behavior is back in place.
  • Prompt-assembly fix: revert the code change and redeploy the prior version.

Edge cases

  • Empty request payload: the pipeline should reject the request with a clear validation error before any cache lookup or model invocation.
  • Cache key collision across tenants: if cache keys do not include the tenant ID, one tenant's response can be served to another. This is a critical confidentiality failure; the fix is to confirm every key includes the tenant ID before considering the implementation complete.
  • Model returns valid output with empty content field: distinguish between "model returned nothing" and "model returned whitespace or a formatting artifact." Both are empty-completion signals but may require different fixes.
  • Retrieval returns results for the wrong tenant: if the retrieval service does not scope queries by tenant, the pipeline can inject another tenant's documents into the prompt. Verify retrieval scoping explicitly.
  • Large response payloads: confirm the post-processing layer does not truncate legitimate long responses at an arbitrary character limit.
  • TTL shorter than request processing time: an under-configured TTL can cause a response to expire before the user receives it. Set the TTL above the p99 request latency.
  • Partial cache invalidation: clearing only some keys for a conversation can produce a response that mixes fresh and stale context. Clear the entire conversation scope when invalidating, not individual turns.
  • Timezone and clock skew: cache TTLs and freshness checks depend on consistent clocks across services. Confirm the caching store and the chat API use synchronized time sources.

Next step

Hand the runbook entry and the monitoring dashboard to the operations team, and schedule a review of the incident two weeks after the fix to confirm the alerts fired as expected and no new failure mode emerged. If the same degradation pattern appears in another tenant, the version-aware cache key and the retrieval error-handling guard should be treated as standard components of the assistant pipeline rather than incident-specific patches — worth reviewing whether they should be applied platform-wide, not only to the affected tenant.

Ready to Implement This Playbook?

Our team can implement these strategies for you, tailored to your specific business needs.

Schedule Consultation