Skip to content

fix(cloud-agent-next): classify attach git failures as workspace setup - #6646

Merged
eshurakov merged 4 commits into
mainfrom
fix/ca-attach-git-subtype
Sep 23, 2026
Merged

eshurakov merged 4 commits into
mainfrom
fix/ca-attach-git-subtype

Conversation

@eshurakov

Copy link
Copy Markdown
Contributor

Summary

An attach rejection caused by a git clone/checkout failure was classified as
wrapper_start_failed / runtime_startup, even though the runtime had started and
only workspace setup failed. This mislabels a platform/user workspace problem as a
runtime startup problem.

  • The wrapper now carries a git workspace failure subtype on the attach rejection
    (git_clone_timeout, git_rate_limited, git_authentication_failed, ...).
  • The subtype flows through the control protocol, ControlRequestError, the
    session-operation result, the attach proof, and the session message queue.
  • classifyControlPlaneFailure maps a workspace subtype to
    workspace_setup_failed, and the queue report's responsibility/reason come from
    the existing subtype mapping.
  • The live attach proof is authoritative. The retired proof is used only as a
    fallback when no live subtype remains, so a current subtype-less rejection never
    inherits an older attempt's git subtype.

The field is optional and additive: an unrecognized subtype from a newer wrapper
degrades to absent instead of failing the response parse.

Verification

No manual tests were run. This change is covered by automated tests only:

  • vitest run src/sandbox-session/session-message-queue.test.ts src/telemetry/control-plane-failure-fence.test.ts — 360 passed.
  • bun test src/control/apply-attach.test.ts — 64 passed.
  • pnpm -C services/cloud-agent-next run typecheck — pass.
  • pnpm -C services/cloud-agent-next run lint — 0 errors/warnings.
  • pnpm -C services/cloud-agent-next run format:check — clean.

Unrelated pre-existing flaky failure observed in wrapper/src/control/worktree-runtime.test.ts
("terminates a startup timeout ...", ENOENT on the child pid file, timing based); it
does not touch this change.

Visual Changes

N/A

Reviewer Notes

  • Classification only applies to coordinator-originated attach_exhausted failures.
  • Expected report values in the fence test are authored from the subtype→reason
    mapping, not from the classifier, so the test can fail on a regression.

Optimize failure handling for the user's experience: do not fail on transient
conditions, fail fast with a specific reason when progress is impossible, never
hang silently, and resume promptly when input arrives.
Carry the git workspace failure subtype from the wrapper attach rejection through the control protocol and the session message proofs, then classify it as workspace_setup_failed instead of wrapper_start_failed/runtime_startup.

The live attach proof is authoritative; the retired proof is only a fallback when no live subtype remains, so a current subtype-less rejection never inherits an older attempt's git subtype.
@kilo-code-bot

kilo-code-bot Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The incremental change gates attach-proof rejection marking to the attach phase and adds a regression test, resolving the prior warning; no new issues found in the changed code.

Files Reviewed (2 files)
  • services/cloud-agent-next/src/sandbox-session/SandboxSession.ts
  • services/cloud-agent-next/src/sandbox-session/session-message-queue.test.ts
Previous Review Summary (commit e901aa1)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit e901aa1)

Status: 1 Issue Found | Recommendation: Address before merge

Executive Summary

One over-broad guard in recordDeliveryFailure lets a prompt-phase rejection stamp rejectionReceived on a successfully-completed attach proof, which can suppress the attach failure counter on a later attempt.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
services/cloud-agent-next/src/sandbox-session/SandboxSession.ts 4454 Marking condition widened from countAttachRejection to rejection, so prompt-phase rejections mark the completed attach proof
Files Reviewed (12 files)
  • AGENTS.md
  • services/cloud-agent-next/src/sandbox-session/SandboxSession.ts - 1 issue
  • services/cloud-agent-next/src/sandbox-session/control-dispatch.ts
  • services/cloud-agent-next/src/sandbox-session/session-message-queue.test.ts
  • services/cloud-agent-next/src/sandbox-session/session-message-queue.ts
  • services/cloud-agent-next/src/sandbox-session/session-operation.ts
  • services/cloud-agent-next/src/sandbox-state/model/session.ts
  • services/cloud-agent-next/src/shared/sandbox-control-protocol.ts
  • services/cloud-agent-next/src/telemetry/control-plane-failure-fence.test.ts
  • services/cloud-agent-next/src/telemetry/control-plane-failure.ts
  • services/cloud-agent-next/wrapper/src/control/apply-attach.test.ts
  • services/cloud-agent-next/wrapper/src/control/apply-attach.ts

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

A confirmed prompt rejection no longer stamps rejectionReceived on a
successfully completed attach proof. That stamp made a later attach attempt
for the same message skip incrementDeliveryFailure and retry until the
deadline instead of exhausting at ATTACH_FAILURE_LIMIT.
…type

# Conflicts:
#	services/cloud-agent-next/src/sandbox-session/session-message-queue.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants