Skip to content

Comments

intake(lote-A): import upstream PR #1844#4

Open
nsalvacao wants to merge 6 commits intobaseline/develop-sync-2026-02-17from
intake/lote-A-pr-1844
Open

intake(lote-A): import upstream PR #1844#4
nsalvacao wants to merge 6 commits intobaseline/develop-sync-2026-02-17from
intake/lote-A-pr-1844

Conversation

@nsalvacao
Copy link
Owner

@nsalvacao nsalvacao commented Feb 17, 2026

Upstream intake PR for isolated review.

Checklist:

  • Automated checks green
  • Bot review comments triaged
  • Manual review complete
  • Safe for baseline merge

AndyMik90 and others added 6 commits February 15, 2026 17:39
When spec creation crashes, the task gets stuck in "planning" state
forever because the backend never emits PLANNING_FAILED to the frontend
XState machine. Clicking Resume then also crashes because the resume
logic transitions to "coding" state, but there are no subtasks yet.

Root causes and fixes:

1. Backend orchestrator (orchestrator.py):
   - Wrap run() in try/except to emit PLANNING_FAILED on unhandled exceptions
   - Add _emit_planning_failed() calls at every early return path
   - Fix spec_dir tracking after rename_spec_dir_from_requirements()

2. XState machine (task-machine.ts):
   - Add PLANNING_STARTED transitions from error and human_review states
   - This allows tasks that crashed during planning to resume back to planning

3. Execution handlers (execution-handlers.ts):
   - Detect error state with 0 subtasks and send PLANNING_STARTED (not USER_RESUMED)
   - Check actual implementation_plan.json for subtasks instead of task.subtasks.length
   - Handles both with-actor and without-actor (app restart) code paths

Closes AndyMik90#1562

Co-Authored-By: Claude Opus 4.6 <[email protected]>
…name, empty except (AndyMik90#1562)

- Move planHasSubtasks calculation (reads implementation_plan.json) before
  XState handling so the crash-during-planning check uses the reliable
  file-based check instead of task.subtasks.length
- Change rename_spec_dir_from_requirements to return the new Path directly
  instead of a bool, eliminating brittle directory scanning in orchestrator
- Add descriptive comment to empty except clause to satisfy code scanning

Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Update phase_executor.spec_dir and spec_validator after directory rename
  so subsequent phases don't use stale paths (critical bug flagged by
  sentry, coderabbitai, and Auto Claude review)
- Fix TASK_UPDATE_STATUS handler to use file-based plan check instead of
  unreliable task.subtasks.length (same AndyMik90#1562 bug fixed in TASK_START)
- Replace manual subtask counting with existing checkSubtasksCompletion helper
- Use safeReadFileSync instead of existsSync+readFileSync (TOCTOU fix)
- Add self.validator update to backward-compat _rename_spec_dir_from_requirements

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

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