CCDV-F Prep unofficial
← All skills

Eval, Testing, and Debugging

Failure-Mode Diagnosis

Exam objective: Analyzing a trace excerpt or reproduction to identify the failure mode, such as hallucination, refusal, under-acting, context loss, format drift, or inconsistent output; isolating whether it originates in the integration layer or in model output; and selecting a recovery that addresses the cause rather than the symptom.

What the exam tests

You get a trace, log or reproduction and must do three things in order: name the failure mode, decide whether it starts in your integration or in the model's output, and pick a recovery that removes the cause. A fix that only hides the symptom (blind retries, a louder prompt, a forgiving parser) is usually the distractor.

Key rules

  • Read the envelope first. A 4xx or 5xx means the request failed to process. A successful response carries stop_reason, which says why generation stopped.
  • Truncation is not drift. max_tokens or model_context_window_exceeded means incomplete output. A cut-off tool call or structured output needs more room (thinking also counts toward max_tokens) or less spent on thinking.
  • Refusal is an HTTP 200 with stop_reason: "refusal". Monitor it separately, discard partial output, and retry on a fallback model. Exception: reasoning_extraction means your prompt or schema asks for internal reasoning, so change it.
  • Empty end_turn after tool results often comes from your harness adding text after tool_result. Fix the structure; use a new "Please continue" user message only as a last resort.
  • pause_turn is a server-tool loop limit: append the assistant content unchanged and resend with the same tools.
  • Request-shape errors are yours. Every tool_use needs a tool_result, placed first in the next user message. Thinking blocks must be replayed unmodified; on some models an edited system, tools or earlier turn also invalidates their signatures.
  • Hallucination: allow "I don't know", extract quotes first, require a quote per claim and retract unsupported ones, restrict to the provided documents. These reduce but do not eliminate it.
  • Inconsistent or drifting format: use structured outputs for guaranteed schema conformance (refusals and truncation are the exceptions). Otherwise specify the format, give examples, ground with retrieval, or chain smaller prompts. Prefill is not supported on Claude 4.6 and later models.
  • Under-acting: if the request says "suggest", Claude may only suggest. Ask for the change explicitly or set a default-to-action system prompt.
  • Tool misuse: wrong tool points to ambiguous descriptions (say when to use each); invented parameters point to missing strict: true.
  • Context loss: inspect the payload actually sent. Your trimming or summarizing may have removed the fact. Long contexts also degrade recall (context rot), so curate, compact or clear.
  • Claude Code ignores configuration: check what loaded with /context, /hooks, /mcp and /status; isolate with claude --safe-mode.

A minimal triage branch:

if response.stop_reason == "refusal":
    handle_refusal(response.stop_details)
elif response.stop_reason in ("max_tokens", "model_context_window_exceeded"):
    handle_truncation(response)
elif response.stop_reason == "pause_turn":
    resend_with_assistant_turn(response)

Traps

  • Retrying an identical request when the failure is deterministic: a bad history, an invalid thinking signature, or usually a refusal on the same model.
  • Strengthening the prompt for a problem the model never saw, such as a trimmed constraint or an unloaded CLAUDE.md.
  • Repairing truncated JSON in the parser and keeping partial data.
  • Putting your own instructions inside tool_result. Claude may treat them as untrusted and ask for confirmation. Send them in a user turn after the result, or a mid-conversation system message where supported (with a server tool still waiting, send only the results).
  • Counting only HTTP errors, which never shows refusals.
  • Assuming a bigger context window fixes forgotten facts that were never sent.

Decide quickly

SituationChoiceWhy
JSON ends mid-object, max_tokensRetry with a higher limitOutput is incomplete
200, empty content, refusalFallback modelSame model usually refuses again
reasoning_extractionChange the prompt or schemaThe request itself is the trigger
Claims absent from the sourceQuote-first grounding and verificationTies claims to text
Exact schema requiredStructured outputsEnforced, not requested
400 about missing tool_resultFix history constructionIntegration defect
Suggests instead of editingExplicit action instructionWording drives behavior
Early constraint ignoredInspect the sent messagesLocates the loss
Rule ignored in Claude Code/context before rewordingLoading versus adherence

Sources