feat(cloud-agent-next): add provider failure bucket to outcomes - #6466
Conversation
…come aggregate Add a `provider` failure responsibility alongside platform/user/unknown and carry the failure reason into the emitted `cloud_agent_outcome_aggregate` `failureStageCodes` entries, so external model-provider failures can be excluded from the platform-defect share. The classifier output is unchanged: no producer emits `provider` yet. Every bucketing, SQL, reporting and admin-web site is widened to handle the new value so a future `provider` responsibility cannot silently land in `unknown`. Adds `providerFailed`, `distinctProviderAffectedSessions` and the `unknownSettledShare` guardrail; `AGGREGATE_CONTRACT_VERSION` stays 1 (additive).
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Executive SummaryThe follow-up commit fixes the Observed-health card copy so it enumerates the provider bucket, and records the provider-bucket model-selection caveat in the emitted Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (2 files)
Fix these issues in Kilo Cloud Previous Review Summaries (2 snapshots, latest commit e976b9d)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit e976b9d)Status: 2 Issues Found | Recommendation: Address before merge Executive SummaryThe follow-up commit switches the model-path attribution policy to Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (4 files)
Fix these issues in Kilo Cloud Previous review (commit 9e59810)Status: 2 Issues Found | Recommendation: Address before merge Executive SummaryThe Overview
Issue Details (click to expand)SUGGESTION
Verification Notes
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
The model-serving path is one `provider` responsibility: our gateway and the upstream provider are indistinguishable from the cloud agent's point of view, so provider outages, rate limits, timeouts, model availability and assistant context or output limits no longer inflate the platform-defect share. `platform` stays for failures whose handling the cloud agent platform itself controls. Provider authentication keeps its ownership split (managed -> platform, byok -> user); invalid_request, content_filter, structured_output, assistant_no_reply and insufficient_credits are unchanged. Model availability no longer depends on who selected the model, which removes the managed-auto-routing branch and the now-unused `managedModelSelection` fact.
…surfaces The Observed-health card description still enumerated only user action, platform action and further investigation, although the provider outcome now has its own card. The emitted aggregate's limitations did not record that the provider bucket also absorbs an unrecognized model selection, which is a user-caused failure the model path reports as `model_missing`. `AGGREGATE_CONTRACT_VERSION` stays 1. PR #6267 made the same change to `failureStageCodes`' shape - a required field plus a new grouping dimension - and kept the version, and this record only gains a field.
Summary
Three commits:
Widen the taxonomy (classifier unchanged). Adds a
providerfailure responsibility alongsideplatform/user/unknown, and carries the failure reason into the emittedcloud_agent_outcome_aggregatefailureStageCodesentries. Every bucketing, SQL, reporting and admin-web site handles the new value so a futureproviderresponsibility cannot silently land inunknown. AddsproviderFailed,distinctProviderAffectedSessionsand theunknownSettledShareguardrail.Apply the attribution policy. The model-serving path is one
providerbucket: our gateway and the upstream provider are indistinguishable from the cloud agent's point of view, so provider outages, rate limits, timeouts, model availability and assistant context/output limits no longer inflate the platform-defect share.platformremains for failures whose handling the cloud agent platform itself controls.Review follow-up. The Observed-health card description now enumerates the buckets it renders, including provider; the emitted
limitationslist records that theproviderbucket also absorbs an unrecognized model selection.Responsibility changes in
classifyAssistantFailure:rate_limitedmodel_unavailable,model_missingprovider_unavailabletimeoutcontext_limit,output_limitprovider_authenticationinvalid_requestUnchanged:
content_filter(user),structured_output(platform),assistant_no_reply(platform),assistant_unknown(unknown),insufficient_credits(user), and every sandbox/workspace/git/wrapper/delivery/DO reason (platform).Model availability no longer depends on who selected the model, which removes the managed-auto-routing branch and the now-unused
managedModelSelectionfact.managed_model_configurationstays reachable through admissionMODEL_VALIDATION_UNAVAILABLE.Contract version
AGGREGATE_CONTRACT_VERSIONstays1.950b1010b1(#6267) made the same change to this record two days earlier — a required field on everyfailureStageCodesentry plus a new grouping dimension (git show 950b1010b1 -- services/cloud-agent-next/src/telemetry/outcome-aggregate.ts) — and kept the version at1. This change follows that precedent: the record is a superset (no field removed, renamed or retyped),reasonis present on every entry, and no consumer in this repository readsfailureStageCodes.Verification
No manual tests. This is a classifier/SQL/UI surface change with no producer of the new bucket in a live path to exercise end to end; covered by unit tests:
packages/worker-utils/src/cloud-agent-failure.test.ts— golden tables and the exhaustive ownership matrix updated to the provider policy.services/cloud-agent-next/src/telemetry/queue-reports.test.ts— emitted report responsibility/reason per code.services/cloud-agent-next/src/telemetry/outcome-aggregate.test.ts,report-store.test.ts,report-consumer.test.ts,queue-reports.test.tsapps/web/src/routers/admin-cloud-agent-next-router.test.ts,CloudAgentNextTelemetry/health-summary.test.tsChecks run:
services/cloud-agent-nextunit suite: 6793 passed, 3 skipped.pnpm run typecheck(tsgo + wrapper typecheck) clean;oxlint0 warnings/0 errors;oxfmt --list-differentclean.apps/weblint and format clean on the changed file.Blocked, not passed:
apps/webjest suites andapps/webtypecheck cannot run in this worktree.@simplewebauthn/serveris declared atapps/web/package.json:103but absent fromnode_modules(typecheck fails onsrc/lib/auth/passkey.ts:14), and jest setup fails incleanupDbForTestbecause no local Postgres is running. Both are pre-existing environment gaps unrelated to this change, so the card-copy change is covered by lint/format only.Visual Changes
N/A
Reviewer Notes
401→provider_authentication) keeps its existing ownership split, so a managed-key failure still readsplatform. It is not moved intoprovider.providerwith reasonprovider_ownership_unknownmeans the model path failed and we do not know whose credential was used.providerbucket absorbs an unrecognized model selection when the model path reports it asmodel_missing, which can be user-caused. This is recorded in the emitted record rather than left implicit:limitationsnow carriesprovider_includes_user_model_selection_errors.