Chapter 19 · Delivery

Incident Ledger

Every defect class this repo has paid for, with the rule it produced, who caught it, and what now stops it coming back. The agents that write code here read a one-line version of each rule; this page keeps the full account, because the account is what tells you why the rule is shaped the way it is.

i
Why this is not in CLAUDE.md

CLAUDE.md is loaded into every agent turn and every CI review, so its size is paid on every call. It keeps a Standing rules list: one line per rule, ending in an arrow that names the test enforcing it, the review rubric, or the entry on this page (→ INC-23). .github/scripts/check-claude-md-budget.mjs runs in the required build-and-test job and fails when the file passes 12,288 bytes, when a named test no longer exists, or when an INC-NN has no entry here. Rules that only matter in one part of the tree live in the path-scoped files under .claude/rules/.

How to read an entry

Each entry keeps its original text unchanged, under a short title and four fields. Ids are stable: a new entry takes the next number, and an entry is never renumbered or deleted, only annotated.

Class
A kebab-case name for the kind of defect, shared by entries that are the same mistake in different code. Review findings use the same vocabulary.
Caught by
Who found it: local (a review or test before push), ci-correctness or ci-security (the CI review gates), second-pass (a later local review round), user, or unknown when the original text does not say.
References
The issues and pull requests the entry cites, checked against GitHub. Several numbers in the original text are issues rather than PRs; the field says which.
Guard
The test or review rule that fails if the mistake is made again. none recorded means no guard was named when the rule was written; behaviour tests may still exist.

Incidents are the reviewer’s eval

Where an entry’s defect can be pinned to real commits, it is also a test case for the correctness reviewer. .github/reviewer-eval/cases/ holds one YAML file per case: the PR, the base commit, the commit where the defect existed, and the file it lives in. .github/workflows/reviewer-eval.yml checks out each of those commits, runs the reviewer with the current rubric, and records whether a finding lands on the known defect. Five known-clean PRs ride along to count false alarms. It runs weekly and on every change to a review rubric or review workflow, and a rubric change that lowers recall fails.

At a glance

IdEntryClassCaught by
INC-01A new abstraction where the reference already has oneduplicate-abstractionunknown
INC-02A tool registered without keyed DImissing-keyed-registrationunknown
INC-03A new command without its pipeline behaviorsmissing-pipeline-registrationunknown
INC-04AI model configuration hardcoded inlinehardcoded-configunknown
INC-05User text that never reaches content screeningunscreened-entry-pointunknown
INC-06A step executor not keyed by StepTypemissing-keyed-registrationunknown
INC-07SandboxOptions used where SandboxExecutionOptions was meantwrong-config-typeunknown
INC-08Entity Version incremented by handdouble-versioningunknown
INC-09A state store Result left uncheckedunchecked-resultunknown
INC-10A step executor raising its own NotifyStepStartedduplicate-notificationunknown
INC-11PluginSource without a declared pluginundeclared-pluginunknown
INC-12Plugin DeniedTools treated as overridablebypassable-denyunknown
INC-13Deleting text with an empty Replacewrong-patch-opunknown
INC-14Raw exception text in skill-training failuresleaked-exception-textunknown
INC-15Projected gate scores persisted across reloadsfloat-round-tripunknown
INC-16The NotConfigured training defaults thrownot-configured-defaultunknown
INC-17A subtractive AIContextProvider on the additive hookadditive-hook-misuseunknown
INC-18Conversation ownership re-implemented at a call siteduplicated-authorization-checkunknown
INC-19Provider failure decided by exception typeexception-type-predicateunknown
INC-20“No knowledge scope” treated as a safe defaultnull-scope-is-globalunknown
INC-21An outcome discriminated by an overloaded fieldoverloaded-discriminator-fieldsecond-pass
INC-22One instance of a duplicated dispatch fixedunfixed-siblingsecond-pass
INC-23A new enum member missing from a mirrored liststale-mirrored-listci-correctness
INC-24A governance check closed before the final stagecheck-before-final-stageci-correctness
INC-25A logger dependency inside the logger factorydi-factory-cyclelocal
INC-26A shared object rewritten from how its type usually behavesconsumer-contract-breakci-correctness
INC-27A control that nothing invokesuninvoked-controlunknown
INC-28A narrowed check, verified in one direction onlynarrowed-check-false-negativelocal
INC-29Per-caller credentials on a shared MCP session cacheshared-cache-keyunknown
INC-30The child-governance arming sequence hand-copiedhand-copied-sequenceunknown
INC-31Ambient state published once around a streamed runambient-state-across-yieldunknown
INC-32Package skew between sibling assembliespackage-skewunknown

Rules without a recorded incident

INC-01 to INC-16 are the short rules the file started with. They record no PR and no catcher.

INC-01 · A new abstraction where the reference already has one

Class
duplicate-abstraction
Caught by
unknown
References
none recorded
Guard
none recorded

Creating new abstractions when ApplicationTemplate already has one: check Application.AI.Common/Interfaces/ first

INC-02 · A tool registered without keyed DI

Class
missing-keyed-registration
Caught by
unknown
References
none recorded
Guard
none recorded

Registering tools without keyed DI: always use AddKeyedSingleton<T>(toolName, ...) pattern

INC-03 · A new command without its pipeline behaviors

Class
missing-pipeline-registration
Caught by
unknown
References
none recorded
Guard
none recorded

Forgetting MediatR pipeline behaviors when adding new commands: register in DependencyInjection.cs

INC-04 · AI model configuration hardcoded inline

Class
hardcoded-config
Caught by
unknown
References
none recorded
Guard
none recorded

Hardcoding AI model config: use AppConfig.AI.AgentFramework section, never inline

INC-05 · User text that never reaches content screening

Class
unscreened-entry-point
Caught by
unknown
References
none recorded
Guard
none recorded

Adding a request that carries user text without screening it: content safety runs in the MediatR pipeline (ContentSafetyBehavior), and only on requests that implement IContentScreenable, not in AgentFactory. A new entry point that dispatches anything other than ExecuteAgentTurnCommand must implement it, or its text is never screened

INC-06 · A step executor not keyed by StepType

Class
missing-keyed-registration
Caught by
unknown
References
none recorded
Guard
none recorded

Creating step executors without registering them as keyed services by StepType

INC-07 · SandboxOptions used where SandboxExecutionOptions was meant

Class
wrong-config-type
Caught by
unknown
References
none recorded
Guard
none recorded

Using SandboxOptions (Domain config) when you need SandboxExecutionOptions (Application container config) — they're different classes

INC-08 · Entity Version incremented by hand

Class
double-versioning
Caught by
unknown
References
none recorded
Guard
none recorded

Manually incrementing entity Version — SqliteVersionInterceptor handles this on save

INC-09 · A state store Result left unchecked

Class
unchecked-result
Caught by
unknown
References
none recorded
Guard
none recorded

Forgetting to check Result.IsSuccess on state store operations

INC-10 · A step executor raising its own NotifyStepStarted

Class
duplicate-notification
Caught by
unknown
References
none recorded
Guard
none recorded

Adding NotifyStepStarted in step executors — PlanExecutor owns notification centrally

INC-11 · PluginSource without a declared plugin

Class
undeclared-plugin
Caught by
unknown
References
none recorded
Guard
none recorded

Using PluginSource on a skill without declaring the plugin in PluginsConfig: the plugin won't load and tools won't resolve

INC-12 · Plugin DeniedTools treated as overridable

Class
bypassable-deny
Caught by
unknown
References
none recorded
Guard
none recorded

Forgetting that DeniedTools on a plugin are bypass-immune: they can't be overridden by auto-approve modes

INC-13 · Deleting text with an empty Replace

Class
wrong-patch-op
Caught by
unknown
References
none recorded
Guard
none recorded

Using Replace with empty Content to remove text in a Patch — PatchApplier rejects it as a failed edit; use Delete op explicitly so the audit trail captures intent

INC-14 · Raw exception text in skill-training failures

Class
leaked-exception-text
Caught by
unknown
References
none recorded
Guard
none recorded

Returning raw exception text in Result.Fail from skill-training handlers — must use stable scrubbed codes (skill_training.*) and log the full exception via structured logging; HTTP-backed proposers can leak SAS tokens in exception messages otherwise

INC-15 · Projected gate scores persisted across reloads

Class
float-round-trip
Caught by
unknown
References
none recorded
Guard
none recorded

Persisting projected gate scores across checkpoint reloads — round-trip float→text→float can flip Accept/Reject by 1 ULP; orchestrator should re-project on each call via IGateEvaluator.SelectGateScore

INC-16 · The NotConfigured training defaults throw

Class
not-configured-default
Caught by
unknown
References
none recorded
Guard
none recorded

Forgetting the NotConfiguredPatchProposer / NotConfiguredRolloutRunner defaults — these throw on first use; a consumer that invokes TrainSkillCommand without registering real impls gets an InvalidOperationException at runtime, not a silent no-op

Incidents

INC-17 · A subtractive AIContextProvider on the additive hook

Class
additive-hook-misuse
Caught by
unknown
References
none recorded
Guard
AIContextProviderMergeContractTests

Implementing a subtractive or rewriting AIContextProvider on ProvideAIContextAsync. That hook is contractually additive: the base merge computes Tools = input.Concat(provided) and Instructions = input + provided. A provider that filters, wraps, or replaces anything there is silently inert — every item it drops is restored from the input, and every item it keeps is published twice. To subtract or rewrite, override InvokingCoreAsync, call base first, then transform the result. A provider that only adds must return just its own contribution, never the input echoed back. This landed four separate times (ToolPermissionFilter, GoverningToolContextProvider — a security control that was dead — plus both recall providers). All four had green unit tests because those tests called the protected hook directly; any test of an AIContextProvider must drive the public InvokingAsync, which is what AIContextProviderMergeContractTests does for every provider in Application.AI.Common.

INC-18 · Conversation ownership re-implemented at a call site

Class
duplicated-authorization-check
Caught by
unknown
References
none recorded
Guard
none for a call-site copy; ConversationStoreContractTests pins the store’s own refusal

Re-implementing the conversation ownership check at a call site. IConversationStore enforces it: every operation naming one conversation takes a callerId and throws ConversationAccessDeniedException for a record owned by anyone else. It did not always, and the comparison record.UserId != callerId ended up hand-written in six places across four files with three different failure shapes. Pass the authenticated caller through and let the store refuse. Two consequences: a blank callerId is an ArgumentException, never a wildcard; and a mocked store enforces nothing, so any test proving an intruder is refused must stub the throw explicitly (see AgUiRunHandlerTests, ConversationOrchestratorTests) — otherwise it passes while asserting nothing.

INC-19 · Provider failure decided by exception type

Class
exception-type-predicate
Caught by
unknown
References
none recorded
Guard
DefaultProviderErrorClassifierTests

Deciding provider-failure behaviour from the .NET exception type. Each provider SDK throws a different type for the same HTTP status — Azure OpenAI/OpenAI throw ClientResultException, Azure AI Inference throws RequestFailedException, the Anthropic SDK used at the time threw HttpRequestException (the current one throws AnthropicApiException). The old Polly ShouldHandle predicates listed types, so they matched only Anthropic — which is not in the shipped fallback chain, leaving retry and the circuit breaker inert for both providers that are. All three decisions (retry, breaker accounting, cross-provider fallback) now go through IProviderErrorClassifier; adding a provider means teaching the classifier its shape, never adding a type to a predicate. Two rules it encodes: a status that says transient (429/5xx) is never overridden by message text, because a false "fatal" both skips retries and halts the chain; and an unrecognised failure is Unknown — not retried, but still counted against provider health. Chain members are also built with the SDK's own retry disabled (GetChatClientWithoutProviderRetryAsync) so Polly is the single retry authority; the non-resilient path keeps SDK retry because nothing else wraps it.

INC-20 · “No knowledge scope” treated as a safe default

Class
null-scope-is-global
Caught by
unknown
References
none recorded
Guard
CallerIdentityResolutionBoundaryTests; KnowledgeScopeOwnershipEndToEndTests

Treating "no knowledge scope" as a safe default — it is not, it means GLOBAL. PlannerScopeFilter.VisibleTo and TenantIsolatedGraphStore read a null owner as a world-readable record, so any path where identity resolution yields nothing silently publishes data. This defect has landed three separate times (host never mounted KnowledgeScopeMiddleware; the scope resolver rejected a token shape ownership accepted; an ambiguous claim resolved to null). The invariant: an authenticated request must either establish a scope or be rejected — never proceed unscoped. Only genuinely unauthenticated callers may run unscoped. Resolve identity solely through ClaimsPrincipalExtensions.GetUserIdOrNull(); never add a second precedence ladder.

INC-21 · An outcome discriminated by an overloaded field

Class
overloaded-discriminator-field
Caught by
second-pass
Guard
correctness-review-rubric (always-check list)

Discriminating an outcome by a shared type's field that carries a different meaning depending on which code path produced it — the fix is a distinct type, not a better field. Landed twice against IacSandboxRunner's pre-dispatch refusal before the shape was retired for good (#421). First cut (#405/#406/#407): ExitCode is null looked like a clean signal for "the sandbox refused to dispatch before it ever ran," but ProcessSandboxExecutor/DockerSandboxExecutor also leave ExitCode null on a timeout, a reserved-env-grant rejection, and an egress-preflight block — every one of which genuinely dispatched and signed a failure attestation; silently mislabeled all three as governance denials, caught only on a second review pass. Correction: Attestation is null, the one field both executors leave unset in exactly the case that matters, centralized behind WasRefusedBeforeDispatch/FailIfRefused. Both fixes picked a better field; neither removed the underlying defect — a caller still had to remember to call the check, and the check itself could still drift to the wrong field again (the plan/validate split in that same PR's own history is exactly this: one dispatch site got the check a full commit after its sibling). #421's fix: IacSandboxRunner.RunAsync now returns Result<SandboxExecutionResult> and represents a refusal as Result.Forbidden(...) — a genuinely distinct outcome instead of a look-alike object with the same shape as a real one. That closes the specific defect this entry is about (a shared field silently meaning two different things), but it is not full compile-time enforcement: Result<T>.Value stays nullable regardless of FailureType, so every call site still does dispatch.Value! after checking the failure branch — a caller who skips that check still gets a null-forgiving operator the compiler accepts and a runtime NullReferenceException, not a compile error. The type distinction removes the "which field do I trust" ambiguity that caused this bug twice; it does not remove the need to remember to check at all. When a shared result type conflates two meanings, look first at whether the producer can return a different type for the different case, not just a more reliable field to check on the same one — and when adding any discriminator over a shared result type, check what every producer of that type actually sets on every path, not just the two cases in front of you.

INC-22 · One instance of a duplicated dispatch fixed

Class
unfixed-sibling
Caught by
second-pass
References
Guard
correctness-review-rubric (always-check list)

Fixing one instance of a duplicated dispatch pattern and stopping there. TerraformGenerator.PlanAsync runs two sequential CLI dispatches (validate, then plan); the governance-refusal guard above landed on validate only — plan needed the identical check (a hot-reloaded operator override can revoke access between the two calls, since terraform plan can run for minutes) and didn't get it until a second review pass noticed the new regression test only covered the first dispatch. When a fix targets one occurrence of a pattern repeated within the same method or across sibling files, grep for every other occurrence before calling the fix done — don't rely on a reviewer to find the sibling.

INC-23 · A new enum member missing from a mirrored list

Class
stale-mirrored-list
Caught by
ci-correctness
References
Guard
DefaultValues_MatchEveryRedactionCategoryEnumMember

Adding a new enum member without updating every hand-maintained list that claims to mirror "all values of the enum." RedactionCategory.VendorApiKey (PR #473) was added and correctly picked up by every RedactionCategories.All-style computed call site (Enum.GetValues<RedactionCategory>()), but ContentCaptureConfig.RedactionCategories and LogsConfig.RedactionCategories are separate hand-typed List<string> defaults — each documented in its own XML comment as "all categories from the enum" — that live in Domain.Common specifically so they don't have to reference Domain.AI (see the doc comments on both properties). Both silently stopped being true: a bare Slack/GitHub/OpenAI-shaped token would export in cleartext through the config-driven telemetry/log-redaction paths even though the new regex existed and worked everywhere else. Caught by CI's correctness-review gate, not by the two /code-review passes that preceded push. When a RedactionCategory (or any enum with a similar "default = every member" mirrored list) gains a member, grep for every hand-maintained string list of category names, not just the computed call sites — and add a test asserting the default list equals Enum.GetNames<TEnum>() so the next addition fails loudly instead of silently (see ContentCaptureConfigValidatorTests.DefaultValues_MatchEveryRedactionCategoryEnumMember).

INC-24 · A governance check closed before the final stage

Class
check-before-final-stage
Caught by
ci-correctness
References
Guard
correctness-review-rubric (always-check list)
Ledger note
The first round of this PR was caught by ci-security; the round this entry is about by ci-correctness.

Closing a governance check against the nearest intermediate filter instead of the value's true final, published state. Landed twice in one PR (#476, ToolChainBuilder's call-once tool registration). A plugin-sourced skill's call-once-per-conversation declaration was registering a tool into the process-global, never-pruned IToolCallOncePolicy before the plugin's AllowedTools/DeniedTools boundary had run — first fix moved registration to just after that boundary (ApplyPluginBoundaryIfPluginSkill), which closed the plugin-bypass CI's security-review gate found but was still one step too early: FinalizeChain's ReservedPlanCapabilityFilter and, for any multi-skill agent, ResolveSurvivingTools' cross-skill first-party-precedence and drift/collision withholding both run after that point too — caught only by a second pass, from CI's correctness-review gate. A tool an untrusted MCP server declared call-once could still poison the policy for a same-named first-party tool that won the precedence fight, inverting the exact security property first-party precedence exists to provide. Correct fix: register only at a genuine whole-agent-set exit (here, BuildToolsAsync/BuildMergedToolsWithSourcesAsync), against the actual fully-filtered, fully-deduplicated surface a caller receives — never at an intermediate stage, however far downstream it looks, in a multi-stage resolution/filtering pipeline. When a fix moves a check "past" one filter, trace the value all the way to where it is actually handed to the caller before calling the fix done — a pipeline with N stages needs the check after stage N, not after whichever stage happens to be nearest the original bug.

INC-25 · A logger dependency inside the logger factory

Class
di-factory-cycle
Caught by
local
References
Guard
ValidateOnBuildSweepTests

Giving a wrapper class a real ILogger<T> dependency when it's constructed from inside the ILoggerFactory replacement factory that builds it. #457's local-log-redaction wiring gave ContentFilterLocalLogRedactor (resolved by IServiceCollectionExtensions.WrapWithLocalLogRedaction's ILoggerFactory replacement delegate) a normal ILogger<ContentFilterLocalLogRedactor> constructor parameter — which itself requires resolving ILoggerFactory, the very service still being constructed. .NET's container doesn't detect this shape of cycle (it's hidden behind a factory delegate, not a constructor graph it can walk), so instead of throwing it silently re-enters the factory forever: every host hangs at first ILogger<T> resolution. This was live for most of a working session before an independent review caught it — every WebApplicationFactory-based integration test hang in that window was misdiagnosed as machine flakiness rather than suspected as new code (see the "measure the control" standing rule — the actual control, a redactor variant with no ILogger<T> dependency, resolved in 62ms every time). Fix: NullLogger<T>.Instance as a field default, no ILogger<T> constructor parameter at all — the only thing that actually breaks the cycle, since anything that resolves through DI reaches back into the same factory. Prevention, not just the fix: the moment any change touches a core cross-cutting registration (ILoggerFactory, IHttpClientFactory, or anything the whole app depends on), run Presentation.Common.Tests/Composition/ValidateOnBuildSweepTests immediately — it builds the real container with ValidateOnBuild = true, which eagerly constructs every registered service and would have caught this in under a second instead of over an hour of misattributed test hangs.

INC-26 · A shared object rewritten from how its type usually behaves

Class
consumer-contract-break
Caught by
ci-correctness
Guard
correctness-review-rubric (always-check list)

Redacting/rewriting a shared object by reasoning about how its type "usually" behaves, instead of reading how this codebase's actual consumers use it. Landed twice in the same method in one PR (#499, RedactingLogger.BeginScope, both caught by CI's correctness-review, not by two prior local passes). First cut: collapsed any unrecognized scope object to a redacted string via ToString() — broke ExecutionScopeProvider.GetCurrentScope's scope is ExecutionScope type check, since a redacted string is no longer that type. Second cut: reconstructed a structured (IEnumerable<KeyValuePair<string, object?>>) scope as a plain List<KeyValuePair<string, object?>> — broke ColorfulConsoleFormatter.WriteScopeInformation, which renders a scope by calling ToString() on whatever was pushed; a compiler-generated templated BeginScope("...{Arg}...", args) call's state overrides ToString() to render the interpolated text, which the reconstructed List<T> cannot reproduce, so every templated scope's console output silently became useless boilerplate. Both fixes were reasoned from general knowledge of how .NET logging scopes are typically consumed; both were wrong for this codebase's actual formatters, discovered only after pushing. The eventual fix redacts only the one shape with zero type-identity risk (a bare string) and leaves everything else untouched, with the residual gap tracked rather than "fixed" a third time the same way. That gap was later closed by a genuinely different design (#500): a templated scope is rebuilt by the same framework factory that built it (LoggerExtensions.BeginScope(format, args), with string arguments redacted), so its runtime type, its ToString() rendering and its enumerated keys all survive, and a test asserts the type is unchanged. Before changing the behavior of any object that flows through multiple consumers you don't fully control — a logging scope, a shared wrapper, a redaction pass-through — grep every real consumer in the codebase and read what each one actually does with it, before writing the fix. Do this once, thoroughly; don't let CI find it for you twice.

INC-27 · A control that nothing invokes

Class
uninvoked-control
Caught by
unknown
Guard
SecurityControlHasACallerTests
Ledger note
The narrative names the guard EveryConfigValidator_IsBoundIntoTheOptionsPipeline; that test has since been renamed EveryValidator_HasAProvenInvocationMechanism (SecurityControlHasACallerTests.ValidatorWiring.cs).

Shipping a control that nothing invokes — and writing documentation that says it is enforcing. This has now landed six times, and the sixth (ToolCallReplayConfigValidator, PR #516) is the cleanest specimen: written, unit-tested, and named in three XML doc comments as the startup enforcement for two bounds — one of them the size ceiling above which structural secret redaction stops being trustworthy — and bound into no options pipeline, so not one of its rules had ever executed in any host. Its own doc comment said "auto-discovered via AddValidatorsFromAssembly — no manual registration required", which is true of the DI registration and irrelevant to whether anything resolves it: nothing validates a config POCO unless an AddOptions chain asks it to. Every available signal said the control was fine, because each measured something other than "does this run in a host": its own tests passed (they construct it directly), ValidateOnBuildSweepTests passed (an unbound validator breaks no service graph), and the interface-consumer scan in SecurityControlHasACallerTests passed (a validator implements no guarded contract). The prior five instances are recorded in that file's remarks — ToolPermissionFilter, GoverningToolContextProvider, both recall providers, and IAgentIdentityValidator, whose fail-closed RBAC had fifteen passing tests and no production caller until #311. The rule: after writing any control, ask which single line, if deleted, restores the unguarded behaviour — then confirm a test fails when it is gone. If none does, the control is untested however many tests surround it. Prefer a guard written over the whole class of control rather than the one that broke: SecurityControlHasACallerTests.EveryConfigValidator_IsBoundIntoTheOptionsPipeline was added for this instance and immediately reported five more — which turned out to be a false alarm (#514): the five planner step-config validators run via a consumer resolving IValidator<T> (PlanValidator.ValidateStepConfigurations), a second invocation mechanism the guard did not know about. They are now an explicit five-entry exemption list, kept honest by a staleness check anchored on the dispatch-arm shape in PlanValidator (matches exactly the five arms; mutation-tested by deleting the one arm whose type is mentioned elsewhere in the file). A first version of that check matched the bare type name and was blind for one of five; it was withdrawn on the claim that it "could not fail" — which was false, and removing it dropped real detection for the other four. Remaining limits are tracked in #528; the filename blind spot is live (#529, four Drift validators run nowhere). That guard produced five false alarms in total before reaching its current shape, two of them in the dangerous direction (silently exempting a real unbound validator) by trying to infer the exemption from a namespace rule and then a co-occurrence scan. The lesson: when the mechanism cannot be detected, state it and check the statement — do not approximate it with something that correlates. Two earlier cautions from writing that guard: match on the shape that needs wiring (AbstractValidator<>), not on a filename convention — matching *ConfigValidator.cs swept in two IHostedService validators that self-register and are live, and a guard that cries wolf is the fastest way to get a guard ignored; and scan every DependencyInjection*.cs, not just the composition root, or anything wired in a subsystem partial reads as unbound.

INC-28 · A narrowed check, verified in one direction only

Class
narrowed-check-false-negative
Caught by
local
References
Guard
correctness-review-rubric (always-check list)
Ledger note
The narrative’s “independent security review” was the local security-reviewer agent: the defective commits of PR #555 have no CI check runs.

Narrowing a structural false-positive fix by adding a require-something condition — check both directions, not just the one the issue named. ToolResultText.TryGetContentArray (#488) matched any JSON object with a top-level content array, so a keyed-DI tool's own domain schema could coincidentally be misidentified as an MCP result and get silently reparsed. Three rounds, each caught by independent security review, none by the two prior local passes: round 1 required at least one of isError/structuredContent/_meta to be present — plausible, since those are the properties McpFailureNormalizingAIFunction's own isError check already relied on, but wrong: McpJsonUtilities.DefaultOptions sets JsonIgnoreCondition.WhenWritingNull, and a spec-conformant success result omits all three whenever McpClientTool.InvokeCoreAsync's AIContent-conversion fallback fires for any reason, not only structured content or metadata — confirmed against the real, pinned SDK, a resource_link block always triggers it with zero markers on the wire. That missed a real, adversary-triggerable MCP shape entirely, silently skipping sanitize/redact/bound for it — worse than the false positive #488 was filed against, and reachable by any MCP server appending one resource_link block to a response. Round 2 required every element of the content array to look like a real block (an object with a string type discriminator, the protocol's actual structural invariant) — closed round 1's gap, but TransformSerializedContentBlocks/ExtractContentArrayText already tolerated a non-conforming element by skipping it one block at a time; requiring the whole array to be uniform meant one deliberately malformed element (trivial for the same hostile server to include) rejected the entire array, silently withholding sanitize/redact/bound from every other block in it too — including a genuine injection-bearing text block sitting right next to the malformed one. Round 3, the fix that shipped: require at least one qualifying block, not every element — strictly tighter than the original any-array check (a first-party array of bare strings, numbers, or all-typeless objects still never matches) without either prior failure mode. The pattern across all three: narrowing a check that's too permissive in one direction is easy to verify by testing the false-positive case it was filed against; verifying it didn't become too strict in the other direction — silently rejecting real data — needs its own explicit test, ideally built by tracing the actual wire format of a real producer (here, a throwaway console app against the pinned ModelContextProtocol.Core package settled two of the three rounds empirically, not by reasoning from the SDK's public docs or the issue's own stated premise). A test proving the false positive is fixed says nothing about whether a false negative was introduced fixing it.

INC-29 · Per-caller credentials on a shared MCP session cache

Class
shared-cache-key
Caught by
unknown
References
Guard
SharedCaches_AreKeyedByServerNameOnly
Ledger note
A latent risk recorded by an audit, not a defect that shipped.

Adding per-caller credentials to a shared MCP session cache without widening its cache key. McpConnectionManager caches every host-configured and bundle-remote MCP client (_clients, _entraClients, _bundleEgressClients) keyed by bare server name — every caller/conversation/agent in the process shares one session per server. That is safe today only because no credential attached to a cached session is ever per-caller: static McpServerAuthConfig headers and Entra tokens are both scoped to the harness's own workload identity, never a request's caller (#748 audit). It is safe by accident of what we don't do yet, not by a check that would catch the alternative — the day someone adds on-behalf-of or delegated-user MCP auth, reusing these caches as-is silently hands caller B whatever session caller A already opened, the exact class of bug Microsoft's Agent Framework fixed upstream for its own provider-backed MCP sessions (PR #8425, "Scope provider-backed MCP sessions per invocation"). If per-caller MCP credentials are ever introduced, the cache key must include caller identity, not just server name — McpConnectionManagerTransportTests.SharedCaches_AreKeyedByServerNameOnly pins the current key type (a reflection check, since named tuple element names like _runScopedClients' (ServerName, RunId) are compiler metadata invisible to Type equality — this can only detect a type change, e.g. string widening to a tuple) so that specific shape of change can't happen as an accidental side effect of an unrelated refactor. It does not catch a caller identity folded into an otherwise-unchanged string key, or caller scoping added via an ambient accessor mirroring this same file's own BundleRunIdAccessor pattern (an AsyncLocal read inside RequiresRunScope) — both are real, undetected ways this invariant could still be silently broken, and need a human reading this entry, not a test catching it.

INC-30 · The child-governance arming sequence hand-copied

Class
hand-copied-sequence
Caught by
unknown
Guard
GovernanceArmerTests; GovernanceTraceIsFoldedByTheChildScopeHandleOnlyTests

Hand-copying the child-governance-scope arming sequence at a new surface. Opening a child DI scope, calling IAgentExecutionContext.Initialize, re-stamping workload identity and resetting the admission pipeline was written out separately in DirectToolInvoker, SubPlanStepExecutor and the capability supervisor's delegation, and the copies drifted: sub-plans dropped the parent's workload identity and accepted an empty conversation id, and delegation authorised nested calls against the wrong agent until #757. They now all go through GovernanceArmer with a GovernanceArmingPolicy preset (DirectInvocation, SubPlan, Delegation) that names each choice (conversation id, call-once scope, turn number); Magentic participants (#769) are the fourth surface, through ParticipantGovernance/ParticipantGovernanceTurn with the Delegation preset; a further surface picks or adds a preset instead of writing another copy. A surface that opens a child scope (delegation, participants) uses GovernanceArmer.OpenChild, which returns a GovernedChildScope that owns the scope and, on dispose, folds the child's trace into the turn's before releasing it (#805) — a hand-written fold is how a child's denials vanish from the turn's Governance trace (#771), and GovernanceTraceIsFoldedByTheChildScopeHandleOnlyTests forbids a second caller of IGovernanceTraceRecorder.Absorb. Arm/ArmWithAdmission alone do not own the scope or publish any ambient accessor, for the sub-plan and direct-invocation surfaces that manage their own. Surfaces that own their request scope (the MediatR behaviours, turn handlers, PlanRunExecutor) are the only ones outside it. Pinned by GovernanceArmerTests; the four surfaces keep their own characterization tests (ParticipantGovernanceTests and MagenticAgentTurnRunnerTests for the Magentic one), because the preset a surface picks is what the helper cannot test for it.

INC-31 · Ambient state published once around a streamed run

Class
ambient-state-across-yield
Caught by
unknown
Guard
AttributionIsPublishedByTheExecutionContextOnlyTests

Publishing ambient state once around a streamed run. Ambient (AsyncLocal) state set inside an async iterator does not survive a yield: the consumer resumes the iterator under its own context. A pipeline, envelope or attribution published once at the top of a stream governs only its first step, and every later tool call runs under whatever is ambient outside it. Publish it around every step (ParticipantGovernanceTurn sets and releases the admission pipeline around each MoveNextAsync; its streaming test fails if it is published once). Attribution is the one value you cannot re-publish by hand — AttributionIsPublishedByTheExecutionContextOnlyTests forbids a second BeginTurn outside AgentExecutionContext, because a nested publication releases out of order (#737). Re-assert it through IAgentExecutionContext.ReassertAttribution() instead, acquired and released inside the step like the pipeline (ParticipantGovernanceTurn.BeginStep); measured against the real SDK in StreamedParticipantAttributionTests (#803). Arming a child context inside the iterator also publishes a turn-long attribution scope; give it back at once with IAgentExecutionContext.ReleaseTurnAttribution(), because in a shared baggage holder a scope held across the yield leaves the participant's identity on the supervisor's spans for the rest of the request. A nested run must also publish its own agent id with its pipeline (ToolAdmissionAccessor.Begin(pipeline, agentId), read back as CurrentAgentId), or the self-delegation check and authorization read the enclosing request scope's agent (#809).

INC-32 · Package skew between sibling assemblies

Class
package-skew
Caught by
unknown
References
Guard
PackageSkewTests; MafHostingPackagesCanaryTests
Ledger note
Found each time by a hand-written smoke test or a crash.

Package skew: one assembly compiled against an older sibling than the one that loads. It surfaces as a MissingMethodException on first call, possibly in production, and neither the compiler nor ValidateOnBuildSweepTests can see it. It landed repeatedly: the Agent Framework 1.24 upgrade (Azure.AI.OpenAI 2.9.0-beta.1 against OpenAI 2.14, since removed by moving the AzureOpenAI client type onto the OpenAI SDK's /openai/v1/ route; FoundryHost on ModelContextProtocol 2.x under 1.4.1-compiled code), Microsoft.EntityFrameworkCore.InMemory 8 under EF Core 10, and Microsoft.EntityFrameworkCore.Design 8.0.11 shipped beside it, both pulled in by AspNetCore.HealthChecks.UI. Each was found only by a hand-written smoke test or a crash. PackageSkewTests in every host test project now asks the whole question: PackageSkewGuard loads the host's own build output the way the host binds it (HostClosure, framework wins over a lower app-local copy) and resolves every cross-assembly member reference (MemberReferenceResolver). A new break fails with no one having thought of it; fix it by pinning the transitive package in Presentation.Common.csproj (the CPM version), or accept it in KnownHostSkews with a reason — an entry that stops matching fails too, so a fixed skew has to leave the list. It sees missing members and types that will not load, not behaviour changes, and a reference on a generic instantiation is matched by name and parameter count rather than full signature; keep the runtime surface tests (AzureOpenAiV1ClientTests for Azure OpenAI, FoundryDirectResponsesClientTests and AzureOpenAiSurfaceCompatibilityTests for the two Foundry paths) for wire shape. It also cannot tell a call to a method that exists but is itself broken inside its package from a healthy one; when one has to be tolerated, keep it off production paths with a source-scan test, as was done for AzureOpenAIClient.GetResponsesClient() until #799 removed Azure.AI.OpenAI altogether. An allowlist entry for a package that is not shipped sets Kind: MissingAssembly so it stops excusing the references the day the package ships. A host with its own extra skew adds its own list, not an entry in Shared. A Microsoft.Agents.AI bump also runs MafHostingPackagesCanaryTests (project Infrastructure.AI.MafHostingCanary.Tests), which fails if the preview A2A or AG-UI hosting surface changed; when it does, re-read documentation/architecture/a2a-message-contract.md and ag-ui-hosting-evaluation.md before accepting the bump.

Adding an entry

  1. Append the entry here with the next id, its four fields and the full account.
  2. Add one line to Standing rules in CLAUDE.md, ending in → <GuardTest> or → INC-NN, or to the matching .claude/rules/ file when the rule only matters in one part of the tree.
  3. If the defect can be pinned to commits, add a case under .github/reviewer-eval/cases/.