Implementation Plan: Separate reset_dispatch State Reset from Artifact Destruction#4115
Merged
Trecek merged 6 commits intoJun 26, 2026
Conversation
The issue URL identifies what's being worked on (the issue), not the specific dispatch attempt. Promoting it to an identity field ensures it survives retry state resets, enabling label cleanup and dispatch lookup after a reset. This makes T1 and T2 pass.
Decouple internal state reset from external artifact destruction. By default, reset_dispatch now swaps labels and resets state while preserving the worktree, branches, and PRs. Pass destroy_artifacts=True to invoke the existing destruction path (worktree removal, branch deletion, PR closure). The runner is now only required when destroy_artifacts=True, since the state-only path doesn't need subprocess access. The response envelope now includes destroy_artifacts: bool. Makes T5, T6, T7, T8 pass.
…ENDING guard to claim helper find_dispatch_for_issue: - Add Pass 3 that searches for stale PENDING dispatches matching the issue URL. A PENDING dispatch matches when it has attempt_history (was previously dispatched), no active dispatched_session_id (no fresh claim), no labels_cleaned flag, and either ended_at=0.0 (process crashed without recording end time) or ended_at is older than 60s (the quiet period). RUNNING and TERMINAL_UNCLEANED passes continue to take priority. _try_claim_with_liveness: - Add a PENDING-status branch that returns claimed=False with a 'pending retry' reason. This prevents a returned PENDING dispatch from falling through to the dead-dispatch cleanup path and unblocking a claim that should be blocked. Makes T9-T15 and T16 pass.
…tch PENDING search, claim PENDING block - T1-T2 (test_retry_failed_dispatch.py): issue_url is an identity field preserved through retry resets. - T5-T8 (test_tools_fleet_reset.py): reset_dispatch state-only default, destroy_artifacts=True preserves full destruction, state-only still cleans labels using dispatch.issue_url, force=True is orthogonal to destroy_artifacts. - T9-T15 (test_find_dispatch_for_issue.py): PENDING stale match, too-fresh skip, empty history skip, active session skip, RUNNING/TERMINAL beats PENDING, ended_at=0.0 treated as stale. - T16 (test_claim_liveness.py): PENDING dispatch blocks claim with 'pending retry' reason; cleanup_orphaned_labels is not called.
…ue for full-destruction assertions
…kipped Change time.time() - 10 to time.time() - 5, giving 55 seconds of CI slack before xdist scheduling delays could push the age past the 60-second quiet period threshold and flip the test verdict. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Refactor
reset_dispatchto decouple internal state reset from external artifact destruction by adding adestroy_artifactsparameter (defaultFalse). Promoteissue_urlto an identity field so it survives retry resets. Extendfind_dispatch_for_issueto search PENDING dispatches with a staleness guard to prevent double-dispatch races. These changes makeforce=trueorthogonal to artifact preservation —forcebypasses the resume gate,destroy_artifactscontrols whether worktrees/branches/PRs are removed. Campaign-level artifact sweep is deferred to a follow-up task.Implementation Plan
Plan file:
/home/talon/projects/autoskillit-runs/impl-20260626-092004-754802/.autoskillit/temp/make-plan/reset_dispatch_preserve_state_plan_2026-06-26_093000.mdCloses #4114
🤖 Generated with Claude Code via AutoSkillit
Token Usage Summary
* Step used a non-Anthropic provider; caching behavior may differ.
Token Efficiency
Model Usage Breakdown