Review the prerequisites
Suitable for: Backend developers learning Agent applications.
- Incident containment, evidence, and causal diagnosis
- Implement and explain denominator-correct metrics and first-stage diagnosis, preserve red-to-green evidence, then design containment and rollback without erasing business facts. Public checks do not prove authorship, semantic quality or real incident experience.
How does the mechanism work?
Step-by-step explanation
- How to monitor if the quality drops but HTTP 200 is normal?
Incident assessment must check business quality beyond HTTP status.
- What to do with in-progress tasks after rollback?
After containment and rollback, business operations still in flight require handling.
- What information should go into the incident log?
Causal diagnosis requires reliable records and a clear separation of facts from hypotheses.
Foundation · Understand the concepts
Understand the principle · Incident containment, evidence, and causal diagnosis
Objectives of this level: Recompute three series and distinguish task-local evidence from aggregate hypotheses.
Visual guide · From aggregate alarm to a task
Equal aggregate symptoms can have different causes. This fixture protocol finds an observed broken stage; missing observations remain unknown. Select the figure to open it at full size.
What the exercise measures
Prerequisites: read the observability and fault-injection courses; you should already be able to run Python 3.10+, import a module, inspect JSON, and write assertions. This is an authored, redacted offline fixture, not an actual employer incident. No model or remote tool runs. Logical milliseconds and model-step counts are supplied data, not measured latency, provider usage, or bills. The read-only tool calls have no business side effects.
The business contract is fixed: an authorized task must include both base and exception policy evidence and finish as manual_review; a task rejected by current authority must finish as denied. accepted records whether the supplied final status matches that contract. A correct denial is an accepted task. The actual production meaning of success would need a separately reviewed business contract and semantic sampling.
In both cases, v2 has four 403 responses across eight tool calls, and two of four tasks are accepted. After generating the files below, pick a task with accepted: false from each case. Filter its events by task_id, sort by at_ms, and record the first event that breaks the business contract. Check whether the 403 responses belong to the task you are investigating.
Complete reproducible input
Save the following full generator as incident_inputs.py; run python3 incident_inputs.py to create all tasks and events in amber.json and violet.json. Nothing is fetched from a hidden sample store. Read both files before the optional postmortem in the debugging layer. The generation rules are public; this is evidence practice, not an unseen test.
import json
def fixture(case):
if case not in {"amber", "violet"}:
raise ValueError("unknown_case")
tasks, events = [], []
for version in ["v1", "v2"]:
for i in range(4):
task_id = case + "-" + version + "-" + str(i)
start = (0 if version == "v1" else 1000) + i * 100
resource = "order-" + str(i)
active = not (case == "violet" and version == "v2" and i >= 2)
routed = "other-order" if case == "amber" and version == "v2" and i >= 2 else resource
required = ["base", "exception"]
context = ["base"] if case == "violet" and version == "v2" and i < 2 else required
expected = "manual_review" if active else "denied"
actual = "failed" if routed != resource else ("eligible" if context != required and active else expected)
rounds = 2 if version == "v1" else 4
tasks.append({"task_id": task_id, "tenant": "t1" if i < 3 else "t2", "version": version,
"started_ms": start, "finished_ms": start + 90, "rounds": rounds,
"accepted": actual == expected, "resource_id": resource,
"expected_status": expected, "actual_status": actual})
def add(suffix, at, kind, data):
events.append({"event_id": task_id + ":" + suffix, "task_id": task_id,
"version": version, "at_ms": start + at, "kind": kind, "data": data})
for r in range(rounds):
add("model-" + str(r + 1), r * 4, "model_step", {"round": r + 1})
add("candidate", 20, "candidate", {"target_resource": routed})
add("authority", 25, "authority", {"allowed": active, "permission_epoch": 1 if active else 2})
for attempt in range(1, (1 if version == "v1" else 2) + 1):
status = 403 if routed != resource or not active else 200
name = "get_order" if attempt == 1 or routed != resource else "get_policy"
add("call-" + str(attempt), 30 + attempt * 10, "tool_call",
{"call_id": task_id + "-c" + str(attempt), "name": name,
"http_status": status, "attempt": attempt if routed != resource else 1,
"resource_id": routed})
if active and routed == resource:
add("context", 60, "context", {"required_ids": required, "context_ids": context})
add("terminal", 80, "terminal", {"status": actual})
return {"schema_version": 1, "source": "authored_redacted_fixture", "case": case,
"clock": "logical milliseconds; not measured latency", "tasks": tasks, "events": events}
for case in ["amber", "violet"]:
with open(case + ".json", "w") as handle:
json.dump(fixture(case), handle, indent=2, sort_keys=True)
Each case contains four v1 tasks and four v2 tasks. IDs, tenant, version, start/end times, resource, rounds, acceptance, expected and actual terminal status appear on each task. Events contain event/task IDs, version, time, stage, and stage payload. The authority.allowed observation applies to the task's original resource; do not interpret it as permission for any different candidate resource. A tool attempt > 1 denotes a recorded retry; two different first-attempt calls are not two retries.
Recompute the three series before explaining them
For either case, v1 has 4 tasks, 4 known acceptance labels, 4 accepted tasks, 8 rounds, 4 tool calls and 0 calls returning 403. v2 has 4 tasks, 4 known labels, 2 accepted tasks, 16 rounds, 8 tool calls and 4 calls returning 403. Thus the 403 call fraction changes from 0/4 to 4/8, rounds per task from 8/4 to 16/4, and acceptance from 4/4 to 2/4. These three summaries coincide in amber and violet. They cannot identify one cause or prove costs doubled. Count recorded retries and inspect each failed task to find discriminating evidence.
The denominators are tool calls, all selected tasks, and selected tasks with known acceptance respectively. Filtering on task start time uses a half-open interval [start_ms, end_ms) and brings in all events for those tasks. Count events only once by event_id. Never use all spans as the call denominator, select only the successful tasks as the task denominator, or treat a missing acceptance label as a failure.
First submission
Before reading the optional postmortem, submit incident-evidence.md: recompute both versions in both cases, state the three denominators and the retry count, and list a failed task plus an accepted task with a 403 if one exists. Attach their event IDs. Write at least two hypotheses and the task-local observation that would distinguish them; mark unavailable observations as unknown. Record input file hashes and the fixture version incident-lab-v3. You may revise the hypotheses after running your code, preserving the initial submission.
RFC 9110 on 403 describes a refusal, not a unique cause. Do not automatically repeat the same refused request with the same credentials. Resource ownership, current authority and workflow evidence still require separate inspection. In the project's merchant source, inactive principals and resources outside ownership both use HTTP 403. This lesson's records illustrate that ambiguity; they do not run that service.
code example
Same aggregates, different task evidence
Both cases have v2 4/8 tool 403s, 16/4 rounds and 2/4 accepted tasks. Compare candidate resources, current authority and required context for the same task before attributing a cause. Retry counts and the t1 slice distinguish the inputs; no measured cost follows from these counts.
Acceptance task for this level
Before the optional postmortem, submit incident-evidence.md with four version summaries, three denominators, task-local event IDs, two competing hypotheses and discriminating observations; preserve hashes and the initial draft.
Reading this browser’s record…
Hide the answer and check your understanding
All observed HTTP calls are 200, but two tasks lose a required exception and end eligible. Which evidence defeats the claim that all tasks succeeded?
Expand reference derivation
The task-local context omits a required policy ID and the final status conflicts with the fixed manual_review contract. HTTP call success does not establish business acceptance; retain the context/terminal IDs and do not invent provider behavior.
Further explanations and practice
When encountering unfamiliar principles, first read the implementation, continuous questioning and migration cases, and then independently explain the premise and boundaries. Answers and notes are saved to the original account record.
All linked explanations and exercises (1 )
Sources and verification scope
The principles are based on public information; the numbers, cases and tasks are the teaching design of this website. Offline experiments verify the range noted on this page, and the learning effect still needs to be judged through independent tasks and feedback.
- OpenTelemetry:Generative AI semantic conventions
- Google SRE: canary release and comparison
- Google SRE: Roles and Records in Incident Response
- OpenTelemetry: Trace, Span and Asynchronous Causal Linking
- RFC 9110: 403 refusal
- Offline public incident lab source
- Pre-generated public incident inputs and expected outputs
- Project merchant source: identity and ownership boundaries