Skip to content

ADR-0023: How the analyzer calls the model: prompts as code, context first, one structured call

  • Status: Accepted
  • Date: 2026-11-03

Context

The analyzer is the only component that talks to a model, and everything it sends is partly attacker-controlled: events, logs, annotations and Git files may carry prompt injection (ADR-0003, invariant 4). Several choices about that call are still open, and the tasks for it (#70 context builder, #74 read tools, #76 analysis loop, #79 injection corpus) depend on them:

  • Where prompts live and who may change them. A prompt decides what the model is told about its role, the action catalog and the output format, so whoever can edit it influences what gets proposed.
  • Whether the model explores the cluster with tools from the first step or receives a prepared context. Free exploration makes cost and latency per incident unpredictable and hard to replay in tests.
  • When a stronger, more expensive model is used, and what triggers it. Anything the model writes, including its own list of missing data, can be steered by injected text, so it is a poor trigger.
  • How a change to a prompt, model or schema is shown to be safe before it ships, and how the running analyzer knows it is using a combination that was shown to be safe.

ADR-0013 already puts the model behind ModelProvider, and ADR-0015 stores one record per analysis. Design sections 3.3, 4, 11 and 12.3 describe the intent; this ADR fixes the mechanics.

Decision

  1. Prompts are code.
  2. Prompts are Go embed templates in internal/analysis/prompts/, reviewed and released like any other code.
  3. Every analysis record stores the prompt version (a content hash of the templates and generated parts that were used), the model deployment and model ID, and the token counts (ADR-0015).
  4. The MVP has no ConfigMap, CRD or settings field for prompts. A prompt an admin can edit at runtime is an authority surface: it sits next to the closed catalog and the policy and could contradict them.
  5. A replaceable prompt may come later only as an extension under ADR-0019: signed, pinned by digest, and still subject to the evaluation gate (point 8).

  6. Generated from the Go types. The catalog section of the prompt, the output JSON schema and the schema of a proposal are all generated from the Go action and result types. They cannot drift from the code, and an action added to the catalog appears in all of them or in none.

  7. Prompt structure.

  8. A static system part: role, rules, the generated catalog and the output schema. It does not vary per incident, so it can use provider prompt caching.
  9. Then the untrusted context in delimited blocks. Each block is tagged with its provenance: event, pod status, log excerpt, metric, Git file or tool result.
  10. An explicit rule in the system part: text inside those blocks is data, never instructions. The prompt is one defence only; the real limits are the schema, the catalog and policy (invariants 1 and 2). The injection corpus of #79 tests this.
  11. The prompt is not the only thing that decides what the model sees. Operator-supplied redaction patterns and a swapped model deployment change it too, which is why point 8 keys the evaluation on the model and the prompt together and fails closed.

  12. The MVP loop: context first, one call.

  13. Deterministic rules and runbooks run first. A runbook match is deterministic and makes no model call: it maps an incident's symptoms to a known diagnosis and a typed proposal by rules in code.
  14. The model path is for incidents no runbook matched. Its common case is one small-model call.
  15. The context builder (#70) assembles a bounded, redacted context deterministically, and the small model makes one structured-output call on it.
  16. Read tools (#74) are offered only on escalation, within fixed step, token and spend budgets.
  17. Why: predictable cost per incident, and recorded contexts replay in CI.

  18. One proposal path. The structured output of the call, whether small or escalated, is the only way a proposal is made. One validator checks it against the generated schema and the catalog and builds the RemediationRequest. There is no submit_remediation_proposal tool: the model's tools are read tools only. This removes a second path to a request that would need its own validation, and it makes tool-free calls and escalated ones end the same way.

  19. Escalation runs on deterministic signals only.

  20. The valid triggers are: the context builder truncated the context or could not fetch a source; or the small model's output failed schema validation after one retry.
  21. A non-empty "missing data" in the result is not a trigger. It becomes a hand-off to a person that says what is missing, because it is model output and injected text can steer it. The model's self-reported confidence is never a trigger or a signal of eligibility.
  22. Escalation uses the stronger model with read tools, bounded by steps, tokens and the daily spend limit. It is capped at one per incident fingerprint per cooldown window.
  23. An escalation makes at most maxToolSteps + 1 model turns. An invalid escalated result gets no retry; it is handed off. With the triage call and its one retry, an analysis makes at most 3 + maxToolSteps model calls in total; a retry after a throttled or transient failure (ErrRetryable) counts toward that bound.
  24. Every tool result passes through internal/redact before the model sees it, like the context does (invariant 4).
  25. When a budget runs out the result is a hand-off, not a proposal.

  26. A policy denial is a hand-off. Policy runs in the executor after the request exists. If it denies a request, the analyzer never re-proposes, and the denial reason is never shown to the model. Policy outcome is therefore not an escalation trigger, and the analyzer needs no new permission to read it.

  27. ModelProvider and the evaluation gate.

  28. Today's interface is built: Complete(ctx, CompletionRequest) (Completion, error). A request carries messages, tool definitions, an optional ResponseSchema and MaxOutputTokens. A completion carries Content string, tool calls, Usage, UsageUnknown and a Model field. Throttling and transient failures (408, 429, 5xx, timeouts) are ErrRetryable errors; an unknown deployment is ErrNotFound, final.
  29. Planned changes, made with the analysis loop: a deployment field on the request (so the record can name it); a typed error for timeouts, beside ErrRetryable (design 11.1). Foundry adapters for the OpenAI and Anthropic families, because the lab region offers both (ADR-0016): the OpenAI-format one is built (internal/providers/model/foundry, #75) and already returns malformed output as ErrMalformedOutput with the reply's usage; the Anthropic one is planned.
  30. What CI covers. A change to a prompt, model or schema must pass the scenario evaluation before merge. In CI the evaluation runs against a fake model and covers plumbing, schemas and refusal paths only. It does not test the prompt's defences or the quality of any model.
  31. What gates quality. A recorded real-model evaluation, keyed by model ID and version plus the prompt hash, stored in this repository (for example test/eval/results/). Its inputs are recorded contexts from the six fleet scenarios, kept here (for example test/eval/contexts/). The expectations are the fleet's scenarios/*/expected.yaml in pkalin/shadewright-fleet, and each result pins the fleet commit it read them from. The real model runs on demand.
  32. Fail closed at run time. The analyzer embeds the list of evaluated (model, prompt hash) pairs that passed. It refuses automatic analysis when the model behind the configured deployment (and Completion.Model in a reply) has no passing record for the current prompt hash, and reports the reason in status and metrics. It then hands off instead of calling or trusting the model.

  33. Spend accounting.

  34. A failed or timed-out call is charged at its upper bound: the input estimate plus MaxOutputTokens, except a call the adapter marks as not processed (amendment 2026-11-15).
  35. The daily count of analyses is kept in the operator namespace, in an object the analyzer owns: the ConfigMap shadewright-analysis-budget (the UTC day and the analyses started on it), shipped empty with the analyzer and checked by typed parsing in Go (#43, design 3.2). The analyzer may get and update that one ConfigMap, named in resourceNames, and may not create it, so deleting it stops analysis instead of resetting the count. Every write uses the resourceVersion read.
  36. The daily spend limit is a count of tokens (input and output) per model deployment and UTC day, maxTokensPerDay in RemediationSettings, not an amount of money, so no price list lives in the settings (#68, design 12.3). Where that spend is counted is open (#208).
  37. A counter that is missing, cannot be read or written, or holds a value that cannot be trusted (a future day, a count out of bounds) means refuse, not allow.

Consequences

  • A prompt change is a pull request with a diff, a reviewer, a test run and a new evaluation record. Operator redaction patterns and a swapped deployment also change what the model sees; the evaluation list catches the deployment case by refusing an unevaluated model, and redaction changes are reviewed as configuration.
  • The catalog, the schemas and the prompt cannot disagree, at the price of a small generator and its tests.
  • The cost of a runbook match is zero, and the common model case is one call. Escalation is the only open-ended path, with its own budgets and a cap per fingerprint.
  • A model that goes untested cannot run by accident: upgrading a deployment's model without a new evaluation record stops automatic analysis until one is added. That is intended, and it needs a recorded evaluation per model, which costs real-model runs and repository space.
  • The fake model in CI cannot judge quality or injection resistance. Quality depends on the recorded evaluation being run when it should be.
  • A fixed context may omit something the model would have fetched. Truncation and fetch failures escalate; "missing data" produces a hand-off that tells the person what to look at.
  • Hand-off on a denial means the analyzer does not try again with a different proposal; a person decides what to do next.
  • Admins cannot tune prompts for their cluster without a new release or, later, a signed extension. That is intended.
  • Prompt caching depends on the provider and the deployment type; the structure allows it but does not require it.
  • The analyzer gains one write beyond Incidents and requests: update on its budget ConfigMap. Invariant 6 in AGENTS.md names it. Whoever may write that ConfigMap (the analyzer, admins) can reset the count, and whoever may create ConfigMaps in the operator namespace can recreate it after a deletion (threat model, section 6).

Alternatives considered

  • Prompts in a CRD or ConfigMap: easy to tune, but anyone with edit rights on that object would influence what the model proposes, outside code review and the evaluation gate. Rejected for the MVP.
  • A full agentic tool loop from the start: flexible, but cost and latency per incident vary widely, the prompt sees attacker-controlled tool results at every step, and runs are hard to replay. Kept only as the escalation path.
  • MCP as the tool layer in the MVP: design 4 keeps MCP optional. It adds a protocol and a trust boundary without replacing RBAC, and the tools are few and fixed. Revisit with the extensions stage.
  • The model's confidence, or its list of missing data, as an escalation or eligibility signal: both are model output that injected text can steer, and confidence is not calibrated. Escalation uses deterministic signals, and eligibility uses policy (invariant 1).
  • Feeding the policy denial back to the model for a second proposal: it would show the model the policy's shape and let it search for a proposal that passes. Rejected; a denial ends in a hand-off.
  • A submit_remediation_proposal tool beside the structured output: two paths to a request, each needing validation. Rejected for one path.
  • A money cap in settings: rejected, it needs a price list in the settings that goes stale. The cap is in tokens per deployment (decision 9).

Amendments

  • 2026-11-04: ADR-0003 links here and no longer lists submit_remediation_proposal among the model's tools. Nothing in this ADR changed (#244).
  • 2026-11-04: Decision 8 now says the Foundry adapters are planned; only the interface and a fake exist. Nothing else changed (#245).
  • 2026-11-04: Decides the unit that decision 9 left open: the daily spend limit is a count of tokens per model deployment and UTC day, set in RemediationSettings; where the spend is counted is still open (#208). Decision 6 now states the call bound it implied (at most maxToolSteps + 1 escalated turns, no retry of an invalid escalated result, so at most 3 + maxToolSteps calls per analysis). Nothing is enforced by this, and nothing else changed (#68).
  • 2026-11-05: Decision 8's planned changes are partly built: the Foundry adapter for OpenAI-format models is bound to one deployment in its configuration, returns malformed output as ErrMalformedOutput with the reply's usage, and reports usage per call. A deployment field on the request, a typed timeout error and the Anthropic adapter are still planned. Nothing else changed (#75).
  • 2026-11-05: Decision 6 now says that a retry after ErrRetryable counts toward the bound of 3 + maxToolSteps model calls, as the analysis loop enforces it. Nothing else changed (#76).
  • 2026-11-07: ADR-0026 shows the model the bounds of the policy that decides its proposal, once and before it answers, in the context. Decision 7 stands: a denial is never fed back and still ends in a hand-off, and the bounds are not a probe (#493).
  • 2026-11-14: With the Anthropic API adapter (#728, ADR-0037) two details of decisions 8 and 9 changed. A message and a completion may carry opaque provider blocks (a model's thinking blocks), which the loop copies back unread and never logs, stores or interprets. And the upper bound of a failed or timed-out call is the input estimate, those blocks included, plus the most output the adapter can be billed for the limit it sends: MaxOutputTokens for Foundry, MaxOutputTokens plus the thinking allowance for the Anthropic adapter.
  • 2026-11-15: Corrects an over-count in decision 9. A call whose every attempt the host refused before processing it was charged its upper bound, although the vendor documents that it bills nothing for it; such a call is now charged 0 tokens. Only an adapter whose host documents that refusal as not billed marks it. The Foundry adapter marks a call answered with 429 on every attempt, before each attempt's deadline, and only when the endpoint's host ends in .openai.azure.com, .cognitiveservices.azure.com or .services.ai.azure.com. The source is Microsoft's Azure OpenAI FAQ, which covers Azure OpenAI models; for other Foundry Models on those hosts it is unverified, and a call to any other host keeps its upper bound. The Anthropic adapter does not mark it. The correction lowers the reported charge and what counts against the analysis's token bounds; it grants no call, permission or model input that was not allowed before, and a throttled call still uses its analysis's unit of the daily count of analyses (#725, design 12.3).
  • 2026-11-17: ADR-0042 (Accepted) amends decision 9 for one provider (see its Consequences). It adds the third provider, OpenAICompatible, with Chat Completions and Responses, exact declared bases, a nonempty allowed model list and an optional key per endpoint. For that provider only, usage is charged at least the loop's input estimate, at most the input estimate plus output bound with a rounded-up 10% margin. Reported usage above that ceiling is refused and charged the ceiling; missing or unusable usage and failed sent calls also cost the ceiling. Calls not sent cost zero. Foundry and Anthropic accounting is unchanged.

  • 2026-11-21 (#952, #1005): decided, not built. Decisions 3 and 4 say the context builder gives the model a bounded, redacted context from blocks tagged with their provenance; they do not list the fields. The sections are in design 3.3, and the object status section has shown only one resource field of a container, its memory limit. Blind runs outside the lab showed what that costs: a readiness probe on a port nothing listens on, a Pending pod whose request was not shown, and a memory leak that read like a small limit. The maintainer decided on 2026-11-21 that the object status section also shows the fields below. Each case is read from a named field of the pod status, never from an event (the builder reads no events), and shows fields of the matched container of the pod and of the template container of the same name, and no others (the one exception is the Pending row, which shows every container of the pod it names, and none from the template):

Case, and the status field it is read from The section also shows Fails
A regular container or a sidecar (a restartable init container) that is running and not ready: status.containerStatuses[].state.running (for a sidecar status.initContainerStatuses[]) set and ready: false that container's probes, without free text: kind (readiness, liveness, startup), handler type (httpGet, tcpSocket, grpc; exec as the word only), port, scheme, the HTTP path, period, timeout and thresholds; and its declared ports (number, protocol, name); never shown: httpGet.httpHeaders (names and values), httpGet.host, grpc.service and the command of an exec probe (a test puts a marker string in each and finds it nowhere in the context); the query string of the HTTP path is dropped; at most 3 matched container names are shown, then one fixed line (below) open on a redaction miss in the HTTP path or a port name, which a tenant writes (residual risk, bounded: below); the other fields are closed because they are not shown
A pod Pending with an unschedulable condition: status.phase is Pending and status.conditions[] holds PodScheduled false with reason Unschedulable one line per container of that pod (regular, init and sidecar, each marked as such) with its requests next to its limits, and the pod's spec.overhead and pod-level spec.resources when they are set (the pod is the match here). No total is computed: the scheduler's own sum is not rebuilt, and the model reads the lines next to the scheduler's message none: numbers
An OOMKilled container: status.containerStatuses[].state.terminated.reason or lastState.terminated.reason is OOMKilled the age at the kill, from the startedAt and finishedAt of that terminated state, and, on the Incident's summary lines and not in this section, the ages of earlier instances (#1005, below) none: numbers
Command and args, and the command of an exec probe not shown. Decided separately on #1078: its own ADR, off by default, after #1075 closed
A sibling, a sidecar or an init container that did not match, or the template container of another name nothing closed
Node allocatable not shown closed
  • What the status cannot tell. A container whose last termination came from a failed liveness or startup probe is not a case: the pod status records the exit (reason, exit code, signal) but not what caused it, and the probe failure is only in an event, which the builder does not read. So a container that is restarting after failed liveness probes shows its probes only while it is running and not ready. A container that is waiting (for example in CrashLoopBackOff) matches no case. A running container that has not passed its startup probe is not ready, so it is covered by the first row, and a sidecar that is running and not ready matches like a regular container. Known limit, not built here: a container restarted by a failing liveness or startup probe that is ready in between (for example one with only a liveness probe, which waits in CrashLoopBackOff between kills) matches no case, so a liveness probe on a port nothing listens on, with no readiness probe, shows no probe. #1005 does not cover it.
  • The Pending row. One line per container: the regular containers, the init containers and the sidecars, each marked, with requests next to limits, then the pod's spec.overhead and its pod-level spec.resources when set. No total is computed and no formula is written here: the scheduler's request is the scheduler's, and the lines let the model read it next to the message in the pod's condition. The row shows no template requests.
  • No new read or grant, and why this amendment may decide it. ADR-0021 says an amendment never widens "what is allowed, granted or refused" on its own authority. What the model may see is a case of "allowed", so this needs an argument, not a pass. The fields come from objects the builder already gets: the pod template of the Deployment or StatefulSet it reads by name with its UID (internal/incidentcontext/resolve.go), the pods of the target it lists through Pods (resolve.go, status.go podLines), and the Incident it is given (status.go summaryBlock). The builder already shows other fields of those objects (templateLines, containerLine, state), and get_resource, on escalation, already returns the whole pod spec of a Pod, Deployment, StatefulSet or ReplicaSet, probes and ports included (podSpec in internal/tools/kube.go copies the spec and hides only the literal environment values), redacted and within 16 KiB, under accepted decision 4 of this ADR (read tools on escalation). So these fields are not new to the model; what changes is that the first call shows the few that the case needs. No RBAC rule, flag, tool or API call is added (invariant 6). And no field shown is a free-text field made to hold credentials: numbers, enums, a port number or name, and the HTTP path of a probe. The fields that are made to hold them, command and args, and the command of an exec probe, are not decided here. #1078 takes them with their own ADR.
  • Same redaction and bounds. Each value goes through Builder.value, which redacts it and leaves it out whole, never cut, above maxValueBytes (1 KiB). The section text is redacted again as a whole and cut to its bound in whole lines, keeping the head (Builder.finish, DefaultStatusBytes, 8 KiB). The fields are untrusted cluster data (invariant 4): a tenant writes a probe path and a port name, so they can hold text aimed at the model, and are tagged and quotable like the other values of the section. A longer section means the cut can reach the pods with less trouble: the section keeps the target first, then the pods with the most trouble, and a pod Pending with PodScheduled false for reason Unschedulable counts as trouble, so it sorts before the healthy pods (today troubleOf scores only container statuses, so such a pod, which has none, sorts by name among the healthy ones and can fall outside MaxPods or the cut). Three rules keep the new lines from pushing out the evidence of the case itself: probe lines come after the pod's own condition and container state lines, not before; the pod's probes are shown only when they differ from its template's, so the pod lines of replicas of one revision do not repeat them; and the bounds are per container, at most 16 declared ports then one fixed line written by code ((N more ports)), and an HTTP path of at most 256 bytes (left out whole above it, never cut), and at most 3 matched container names, then one fixed line written by code with the number left out. The size is computed from the field sizes of one probe line, readiness httpGet port 65535 scheme HTTPS path <path> period 3600s limit 3600s success 100 failure 100: 100 bytes of fixed text, 256 of path and 1 newline, 357 bytes. Three probes make 3 x 357 = 1071 bytes, with a 39-byte container heading 1110 bytes, a little over 1 KiB; the 16 port lines (port 65535/SCTP name abcdefghijklmno, 41 bytes each with the newline, 656) and the 23-byte line (99999 more ports) add 679, so one container's lines are at most 1110 + 679 = 1789 bytes, of the 8 KiB. That is a ceiling for one container of one object; the pod and its template, for 3 names, would reach about 6 x 1.8 KiB, which is why the number of containers is capped and why the pod's probes are left out when they equal the template's. The test below measures it with real lines. A redaction miss on a path (a secret in a path segment) is the residual risk of this amendment: it is a short value the tenant chose to put in a probe, and it is bounded.
  • A tenant can trigger a case. Anyone who can run a pod in a watched namespace can make a container not ready, a pod unschedulable or a container OOMKilled. That shows the fields of that pod, in that namespace, and of its own template: nothing of another pod or namespace, and nothing the tenant could not already read from its own objects.
  • Node allocatable is not shown. The analyzer may list Nodes only to detect the platform (design 2.2.2, internal/analyzer/detection; invariant 6). Using that list as model input is a different use of the read, with its own size and redaction questions (node labels, addresses and names are cluster-wide data the incident does not name). It needs its own decision. A Pending pod therefore gets its requests and the scheduler's message in the pod's condition, not the node's free memory.
  • Instance lifetimes, what is read today. The pod status keeps one terminated instance per container, so its start and finish times give the lifetime of the last instance only; that is shown today as two timestamps, and the amendment adds the computed duration. The Incident's status.occurrences keep the finish time of each earlier kill (began of a termination: record, at most 32) but no start time, and the context builder does not show them today. The Killing and BackOff events that #1005 names are read by the collector, not by the context builder. So the collector also records the start time of each terminated instance in its occurrence record (an optional started, from the same terminated state of the pod status its finish time comes from; decision of 2026-11-21 on #1005), and the Incident's summary lines show the age at the kill of at most the last 5 instances that have both times (not the object status section, which shows only the instance the pod status holds). started is written only on a termination record and never after its finish time: the collector leaves it out otherwise, and the schema refuses a record where it is after began. An instance without a usable start time (none, or one after its finish) is counted, not guessed: no age is computed from the time between two kills, which includes the restart back-off. A termination record names no container (its id is a hash of the pod UID, the container and the termination). The fingerprint of an OOMKilled Incident holds one owner workload and, through the note, one container name, and no pod. So the earlier ages are those of one container name across every pod of the workload and across template revisions (a limit raised by hand included), interleaved by finish time: a mixed series, which can look like a leak or hide one. The summary labels it that way in a fixed line, and recording a short pod hash with started to group the ages per pod is left to #1005. The age of the matched container's last instance comes from its own pod status. The earlier ages are lines of the Incident's summary, under its own provenance (what the analyzer counted), written by code and not quotable, like the absorbed tally; the computed age in the status section is not quotable either, as its timestamps are not today. Where the write lives: the collector carries started on the Observation, and the Incident controller stores it in status.occurrences with the finish time (internal/incidents); none of it exists yet.
  • Evaluation. ADR-0025 decision 3 puts the context builder's version and limits in the evaluation manifest, so a change to it needs a new real-model run. The recorded scenarios are run before the change and again after it, on the same models and prompt hash, and the results are compared per scenario before the builder's branch merges. The builder's branch has to show the run, as ADR-0025 requires. Its tests have one case per row of the table, one in which a sibling container shows nothing, and cases that carry text aimed at the model in a probe path and a port name and are checked against the redactor and the bounds, plus cases for the points above: a template with hundreds of ports keeps the most troubled pod's state line; 40 healthy replicas and one Unschedulable pod whose name sorts last keep that pod; 256-byte paths on several not-ready containers at the 8 KiB bound keep every shown pod's condition and container state lines, and a pod with more than 3 not-ready containers shows 3 and the fixed line; httpHeaders, host, grpc.service and an exec command are never shown; two replicas whose earlier ages interleave are labelled as mixed.
  • Nothing else changes: the model still has no tool that reads more, escalation is still decided by code, and a policy denial is still a hand-off.
  • 2026-11-22 (#969): the object status section also shows that a pod is being deleted and when its grace period ends, and states it when the current exit of a container of that pod finished after the deletion began. The maintainer decided this on 2026-11-22. Like the fields of 2026-11-21, it is read from the pod and shown in the object status section (design 3.3):
Case, and the field it is read from The section also shows Fails
A pod being deleted: metadata.deletionTimestamp set on the pod's line, being deleted, grace period ends <deletionTimestamp>. No request time is computed or shown: a later delete whose shorter grace period would already have ended sets the deletionTimestamp to the time of that delete, with a period of 0 or 1 (the kubelet's final delete), so the timestamp minus metadata.deletionGracePeriodSeconds is then the start of the last grace period, not the time of the request none: a timestamp written by code
The current exit of a container of that pod: status.containerStatuses[].state.terminated (or initContainerStatuses), with a non-zero exit code, a reason other than OOMKilled, and finishedAt at or after the start of the last grace period (deletionTimestamp minus deletionGracePeriodSeconds, 0 when the pod has none) the fixed note exited after the deletion began: the fact, with no conclusion about the cause. Such an exit does not rank the pod as troubled, and its log is not picked as trouble open, and named: a real crash during the grace period (a segfault while the process flushes its data) reads the same, carries the same note and does not rank the pod
A pod kept by a finalizer after a later delete whose shorter grace period had already ended (the kubelet's final delete, with a period of 0) nothing more than the pod's line: the deletionTimestamp moved past the exits that finished before that delete, so they are not marked open toward the behaviour before this amendment, and named: those exits are shown as failures and rank the pod as troubled
  • Why. A rollout, a scale down or a node drain stops the containers of the old pods, for example with exit code 137 after the grace period or 143 for a runtime that exits on SIGTERM. Without the deletion, the model read those exits next to a real crash as failures of their own (#969), and the old pod ranked among the troubled ones.
  • No new read or grant, and why this amendment may decide it. The pod is the one the builder already lists through Pods and describes in podLines (internal/incidentcontext/status.go); no RBAC rule, flag, tool or API call is added (invariant 6). get_resource on escalation (decision 4) returns a copy of the pod's metadata (meta in internal/tools/kube.go) that holds deletionTimestamp but not deletionGracePeriodSeconds, which the section now reads to decide the note. ADR-0021 says an amendment never widens what is allowed on its own authority, so this needs an argument: the grace period is a number in an object the builder has already read, used by code to compare two timestamps, and never shown as a value of its own. The model sees a fixed note written by code and a timestamp it could already get, and nothing of another object.
  • Two clocks. The start of the grace period comes from the API server's clock and finishedAt from the kubelet's; the builder compares them with each other, never with its own clock. A kubelet clock that runs behind can show an exit of the shutdown as a failure, one that runs ahead can mark a failure of the last seconds before the deletion by the same skew.
  • Not shown. The pod's finalizers, who or what deleted the pod, the time of the request, and its events (the builder reads none). A container still running past the grace period is shown as running, with nothing marked. An OOM kill, a last termination (an earlier instance) and a completed container (exit code 0) are never marked. For a container with a marked exit and a last termination inside the window, the log excerpt reads that earlier instance first.
  • Evaluation. ADR-0025 decision 3 puts the context builder's version and limits in the evaluation manifest, so this change needs a real-model run. It is the lab run of the release candidate before v0.6.0: the recorded scenarios are run on the same models and prompt hash as the run before, and the results are compared per scenario. The prompt golden (test/eval/testdata/prompt.golden) pins the changed prompt of the replaced-pod scenario until then.
  • 2026-11-22 (#852, decisions of 2026-11-17 and 2026-11-22): records the rules for control characters in model output (a code point of Unicode category Cc other than newline and tab), for every provider. A tool call whose name, ID or any decoded argument string or key holds one is not run: its result is a fixed refusal that says so, and the call is stored and recorded without its controls. A result with one in a field that is an enum, a pattern or an identifier (action type, container, values, evidence source) is invalid output; only the fields declared free text next to the result type (the summary, the uncertainty, descriptions, missing data, quotes, the expected effect) are read without them. The free text that is stored is redacted as the reply held it and cleaned of controls after its markers are in place. Quotes are compared without controls: the evidence check removes the controls from each quotable part of the context before it looks for the quote, so a quote of a log line coloured with terminal escapes is found. Named limit: a quote that differs from the data only by controls passes. Nothing else changes; the loop is internal/analysis/loop.go (decodeReply, boundCall, evidenced).