fix: reset checkpoint state on resume for fresh retry budgets#229
Merged
fix: reset checkpoint state on resume for fresh retry budgets#229
Conversation
- Add prepareForResume() to clear terminalExhaustion, failed/blocked tasks, and stale Phase 4 flow checkpoint entries on reload - Reset __flowCheckpoint and __phase4FlowCheckpoint status from 'failed' to 'running' so the Cadre runner re-enters correctly - Filter Phase 4 completedExecutionIds to only retain substeps for fully-completed tasks; failed/in-flight tasks re-enter from scratch - Reset flow checkpoint error field in resetFromPhase() - Accumulate outputTokens from assistant.message events in Copilot JSONL parser as fallback when usage summary is missing - Improve Lore MCP tool documentation in agent prompt partial with explicit tool names and stronger guidance to prefer Lore over view - Tune zstd fixture config: maxParallelAgents 12→8, resume false
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
When resuming a migration that previously failed (e.g. due to terminal exhaustion in Phase 4), the checkpoint retains stale failure markers that cause the resumed run to immediately re-fail or skip tasks instead of giving them fresh retry budgets.
This PR adds a
prepareForResume()method that cleans up transient failure state on checkpoint reload, and fixes several related issues.Changes
Checkpoint resume preparation (
src/core/checkpoint.ts)prepareForResume()— new private method called on every checkpoint reload (resume) that:terminalExhaustionso the parity-gate loop re-enters instead of immediately raisingTerminalExhaustionErrorfailedTasksretry counters so code-migrator and parity-failure-resolver get fresh attemptsblockedTasksso previously-blocked tasks re-enter the scheduling pool__phase4FlowCheckpoint.completedExecutionIdsto only retain substeps for fully-completed tasks — failed/in-flight tasks re-enter from scratch (fresh code-migrator run, not just parity retry)__flowCheckpointand__phase4FlowCheckpointstatus from'failed'→'running'so the Cadre flow runner re-enters correctlyresetFromPhase()fixstatusfrom'failed'to'running'and clearerrorfield so--from-phaseworks correctly with the Cadre runnerCopilot token usage fallback (
src/core/agent-launcher.ts)outputTokensfromassistant.messageevents as a fallback when the usage summary block is missing from Copilot JSONL outputAgent prompt improvements (
agents/templates/_partials/lore-index-first-principle.md)view/bashfor reading source and target codeTest fixture config
maxParallelAgents: 12 → 8resume: true → falseTesting
terminalExhaustionpersistence test to verify raw JSON instead of re-loading throughCheckpointManager(which now clears it on reload)resetFromPhaseflow checkpoint status reset