feat(cloud-agent): attribute setup and admission failures by cause - #6057
Merged
Conversation
Cloud Agent session/run telemetry collapsed several distinct failure causes into coarse or unknown buckets, which hid their real cause from the admin health views. - Split previously collapsed workspace reasons into distinct values (clone/checkout timeout, corrupt pack, setup-command timeout, session import timeout/failure) so the classifier keeps the detail. - Preserve the bounded admission failure code across the setup boundary and classify it, so initial_admission_rejected is attributed instead of landing in initial_admission_unknown. Map initial_queue_full to platform/admission_capacity rather than unknown. - Deduplicate the admission failure mapping into one helper shared by the grouped start path and the legacy prepared-admission path. - Separate the health summary into run failure rate (failed runs over run outcomes) and setup failure rate (setup failures over sessions observed) instead of mixing runs and sessions in one rate. No migration: failure_reason/failure_responsibility are unconstrained text columns; only the shared enum values and schema type changed.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryIncremental review of the two follow-up commits (the setup failure-rate proportion fix and assistant/wrapper failure attribution) found no new issues in changed code; the prior Files Reviewed (12 files)
Previous Review Summary (commit 66d2b2b)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 66d2b2b)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (15 files)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
The rate divided sessions created in the window by setup failures counted by failure_at, so a session created just before the window that failed inside it was in the numerator but not the denominator, letting the rate exceed 100%. Count sessions exposed to setup in the window (created in it, or failed in it) so failures stay a subset.
… failures Split the remaining undifferentiated failure buckets by cause and ownership so the admin health view attributes them correctly: - assistant limits: assistant_invalid_request/context_limit/output_limit by provider ownership (byok user, managed platform, unknown unknown), assistant_content_filter user, assistant_structured_output platform - source-control clone/checkout/network/corrupt and session-import failures are platform infrastructure - user_interrupt user; container_shutdown and system_interrupt platform - wrapper_disconnected, wrapper_startup, wrapper_crash, assistant_no_reply - provider_ownership_unknown when an ownership-dependent assistant failure has no known provider ownership Adds the matching code-review terminal reasons, labels, and tests. The old generic reason values stay as deprecated union entries so historical rows keep a label during retention.
# Conflicts: # services/cloud-agent-next/src/session/session-registration.ts
iscekic
approved these changes
Sep 10, 2026
This was referenced Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Cloud Agent session/run telemetry (
cloud_agent_sessions,cloud_agent_session_runs) grouped several distinct failure causes into coarse orunknownbuckets, so the admin health views could not show why sessions struggled:source_control_network; import timeout/failure and unknown setup becameworkspace_unknown; setup-command timeout and failure becamesetup_command.initial_queue_fullclassified asunknown/initial_admission_unknowneven though it is a platform capacity signal, not user error.initial_admission_rejectedis a catch-all: the boundary discarded the underlying admission code, so platform/user/not-found causes were indistinguishable and all landed inunknown.Changes
failure_reasonvalues (clone/checkout timeout, corrupt pack, setup-command timeout, session import timeout/failure).initial_queue_fullnow classifies as platform/admission_capacity;initial_admission_rejectedclassifies from the preserved admission code.startpath and the legacy prepared-admission path.CloudAgentFailureReasonunion.allFailureRatewith separaterunFailureRate(failed runs / run outcomes) andsetupFailureRate(setup failures / sessions observed); add labels for every new reason.Notes
failure_reason/failure_responsibilityare unconstrainedtextcolumns; only enum/type values changed.packages/db/src/schema.tskeeps its own copy of the reason union (it cannot import worker-utils), so the two must stay in sync; a compile-time parity assertion would prevent drift.sandbox_id, and joincli_sessions_v2for origin/worktree grouping.Verification
pnpm --filter @kilocode/worker-utils typecheck+test: 668 pass.services/cloud-agent-nextpnpm run typecheckclean;pnpm run test: 205 files, 5943 pass / 3 skipped.apps/webpnpm --filter web typecheckclean; jesthealth-summary.test.ts+admin-cloud-agent-next-router.test.ts: 34 pass.oxlintclean (worker-utils, cloud-agent-next, web);pnpm format:changedandgit diff --checkclean.Unit/integration only; no live Worker or end-to-end run was performed.