fix(crane): ignore stale completion for active migrations#101
Merged
Conversation
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.
fix(crane): ignore stale completion for active migrations
TL;DR
This fixes Crane re-treating an active migration as completed just because repo-memory still says
Completed: true. If an issue still hascrane-migration, the scheduler now selects it and marks the stale state explicitly; the agent prompt then requires fresh verification before completion can be claimed again.Problem (WHY)
Completed: trueas authoritative before checking that the issue was still an activecrane-migration.best_metric/Completed: truecannot finish a migration without a current accepted verification result.Approach (WHAT)
is_completed_state()and make completion skip issue-aware.stale_completed_stateso the agent can see active issues with stale completed memory.Implementation (HOW)
.github/workflows/scripts/crane_scheduler.pystill skips completed migrations by default, but passesissue_active=Truefor issue-based migrations discovered through thecrane-migrationlabel. Those migrations are added tostale_completed_stateinstead of being skipped..github/workflows/crane.mddocuments thatstale_completed_statemeans the active issue label wins over stale repo-memory. The prompt now tells agents to clear stale completion markers before the halting check and to only complete from the current accepted iteration's score.tests/unit/test_crane_scheduler.pycovers inactive completion skip, active issue override, paused migrations still skipping, and string completed-state recognition.tests/unit/test_crane_workflow_prompt.pylocks the prompt wording that prevents finishing from stored state alone.CHANGELOG.mdrecords the fix under Unreleased for #101.Diagram
This shows how an active migration issue now overrides stale completed memory until fresh verification runs.
flowchart LR A["Issue has crane-migration"] --> B["Repo-memory says Completed=true"] B --> C["Scheduler emits stale_completed_state"] C --> D["Agent runs current verification"] D --> E{"Fresh accepted score reaches target?"} E -->|Yes| F["Mark completed"] E -->|No| G["Keep migration active"]Trade-offs
crane-migrationlabel; completed file-based migrations still skip.gh aw compile; it did not produce acrane.lock.ymldiff for these prompt/script changes.Benefits
Validation
Scenario Evidence
tests/unit/test_crane_scheduler.py::test_completed_state_skips_inactive_migrationcrane-migrationissue overrides stale completed statetests/unit/test_crane_scheduler.py::test_active_issue_overrides_stale_completed_statetests/unit/test_crane_scheduler.py::test_active_issue_does_not_override_pausetests/unit/test_crane_workflow_prompt.py::test_crane_prompt_blocks_stale_completed_state_from_finishingHow to test
crane-migrationto an issue whose repo-memory state saysCompleted: true./tmp/gh-aw/crane.jsonincludes the migration instale_completed_state.crane-migrationunless the current accepted iteration reaches the target.