Merged
Conversation
…ion, idle timeout check - Add STOPPED as a distinct terminal state (not FAILED) when stopping a session (#6) - cmd_stop saves pre_stop_state before marking STOPPED - Add cmd_restart to re-launch stopped tasks from their pre-stop phase - Orchestrator treats STOPPED as terminal alongside COMPLETE/FAILED - Detect existing autopilot branch in cmd_start (#7) - If current branch matches autopilot/*, reuse it instead of creating new - Use implement_on_existing_branch_prompt that tells agent to stay on branch - Persist existing_branch flag in task for orchestrator to pick up - Check codespace idle timeout before setting (#4) - GET current timeout first, skip PATCH if already >= desired value - Add get_idle_timeout() helper - Schema v4: add pre_stop_state and existing_branch columns with migration - 93 tests passing
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.
Summary
This PR addresses three session lifecycle and robustness issues:
1. STOPPED state (Closes #6)
FAILED, making it indistinguishable from actual failures.STOPPEDas a distinct terminal state.cmd_stopnow saves the task's current state inpre_stop_statebefore marking itSTOPPED.autopilot restart <task_id>re-launches a stopped task from its pre-stop phase, mapping waiting/verification states back to their action states.2. Existing autopilot branch detection (Closes #7)
autopilot start --prompt "..."on an existingautopilot/<task-id>branch created an entirely new branch instead of working on the current one.cmd_startnow checks the current git branch. If it matchesautopilot/*, it reuses that branch and uses a tailored prompt (implement_on_existing_branch_prompt) that instructs the agent to stay on the current branch rather than creating a new one.3. Check codespace idle timeout before setting (Closes #4)
set_idle_timeout()always issued a PATCH request, even when the codespace timeout was already >= the desired value.get_idle_timeout()to read the current value first. Skip the PATCH if the timeout is already sufficient.Schema Changes
pre_stop_state TEXT,existing_branch INTEGER NOT NULL DEFAULT 0Tests