Skip to content

Categorize all spawn failures into actionable failure types#594

Merged
chernistry merged 1 commit into
mainfrom
bernstein/task-5c123ee1a0cf
Apr 8, 2026
Merged

Categorize all spawn failures into actionable failure types#594
chernistry merged 1 commit into
mainfrom
bernstein/task-5c123ee1a0cf

Conversation

@chernistry

Copy link
Copy Markdown
Collaborator

Categorize all spawn failures into actionable failure types

Categorize all spawn failures into actionable failure types

Description

SpawnError and RateLimitError are the only spawn exception types. Add AdapterNotInstalledError, ModelNotAvailableError, PromptTooLongError, WorktreeCreationError, PermissionDeniedError, and ResourceExhaustedError. The spawner uses the category to decide retry strategy (retry vs escalate vs fail-fast).

Role: backend
Model: sonnet


Generated by Bernstein — task 5c123ee1a0cf

…01, AGENT-002)

- spawner.py: import classify_spawn_error/RetryStrategy; break inner retry
  loop immediately for NO_RETRY and RETRY_AFTER_FIX errors (adapter not
  installed, permission denied) instead of trying alternate providers
- worktree.py: call validate_worktree_isolation() after create(); cleanup
  and raise WorktreeError if .sdd symlink, mutable-state symlink, or
  hardlink violations are detected

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

AI Review (Gemini)

Gemini review could not be generated (HTTP 503).

@github-actions github-actions Bot added the size/s label Apr 8, 2026
@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

AI Review (GitHub Models)

Summary

This pull request categorizes spawn failures into actionable types, enhancing the error-handling logic in the AgentSpawner class. It adds detailed logging for different failure conditions and implements validation of worktree isolation during setup in the WorktreeManager.

Risk Assessment

Medium
While the changes introduce robust error handling and logging, modifying error classification and control flow can introduce complexity. There is a risk of inadvertently masking underlying issues if categorization isn't comprehensive or leads to premature termination of attempts, especially if the error classification doesn't account for all potential exceptions.

Actionable Recommendations

  • Test Coverage: Ensure that adequate unit tests cover all new error classifications and the behavior of the retry_strategy. Validate that various edge cases are addressed.
  • Documentation: Update the related documentation to reflect the new error handling mechanisms and any custom exceptions or return types introduced.
  • Review Classification Logic: Audit the classify_spawn_error function for comprehensiveness to avoid un

@github-actions

github-actions Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

CI Summary

Check Result
Repo hygiene ✅ success
Lint ❌ failure
Type check ⏭️ skipped
Tests ⏭️ skipped
Spelling ✅ success
Dead code ✅ success
Workflow lint ✅ success
Dist size ✅ success
SonarCloud ⏭️ skipped

Coverage and detailed reports are available via Codecov and the Checks tab.

@kilo-code-bot

kilo-code-bot Bot commented Apr 8, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • src/bernstein/core/spawner.py - Enhanced spawn failure handling with categorized errors and fail-fast logic for non-retryable failures
  • src/bernstein/core/worktree.py - Added worktree isolation validation after creation

Reviewed by grok-code-fast-1 · 132,835 tokens

@sonarqubecloud

sonarqubecloud Bot commented Apr 8, 2026

Copy link
Copy Markdown

@chernistry chernistry merged commit 94102da into main Apr 8, 2026
11 checks passed
@chernistry chernistry deleted the bernstein/task-5c123ee1a0cf branch April 8, 2026 14:03
chernistry added a commit that referenced this pull request Apr 30, 2026
…01, AGENT-002) (#594)

- spawner.py: import classify_spawn_error/RetryStrategy; break inner retry
  loop immediately for NO_RETRY and RETRY_AFTER_FIX errors (adapter not
  installed, permission denied) instead of trying alternate providers
- worktree.py: call validate_worktree_isolation() after create(); cleanup
  and raise WorktreeError if .sdd symlink, mutable-state symlink, or
  hardlink violations are detected

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant