Repository navigation
fix(#592): reconcile in_progress state when PR is merged on GitHub - #602
Merged
Merged
Conversation
reconcileStateAtStartup previously only escalated `ready_for_merge` entries to `merged`. When a PR was merged outside the current sequant session (separate process, `gh pr merge`, web UI, --force push), the local state.json could keep `status: "in_progress"` indefinitely. The pre-flight guard at run-orchestrator.ts:472-498 then let the issue through, exec spawned for ~3 minutes producing no diff, and the generic MCP fallback retry burned another spawn. Relax the loop guard to also process `in_progress`. Existing PR-status + git-fallback logic and the `resolvedAt` stamp need no other changes. The pre-flight skip message at run-orchestrator.ts:484 then handles the skip with its current voice — `--force` continues to bypass. Add state-cleanup.test.ts covering the in_progress → merged escalation with mocked GitHubProvider, plus the offline (PR status null) fallthrough. Update one state-utils.test.ts case whose old assertion documented the pre-#592 behavior, and add a spawnSync mock to it (real git was collapsing #44 onto an actual `(#44)` merge commit in this repo).
7 tasks
Two gap-fix follow-ups from adversarial QA second look:
1. Add test exercising the in_progress → merged escalation via the
git-fallback branch (no pr.number recorded, isIssueMergedIntoMain
matches a merge commit). Required adding vi.mock("child_process")
so spawnSync is controllable per-test; default mock returns status:1
so existing tests (which expected real git to fail in tempDir)
continue to work without per-test wiring.
2. Update docs/internal/what-weve-built.md so the auto-reconciliation
bullet under the #305 entry forward-references the #592 extension
(still escalates ready_for_merge AND now in_progress).
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
reconcileStateAtStartup(src/lib/workflow/state-cleanup.ts) to also escalatein_progressentries tomergedwhen their PR isMERGEDon GitHub or their branch is already in main.sequant run <N>would re-execute issues that were merged outside the current sequant session (separate process,gh pr merge, web UI, force-push) — exec would spawn for ~3 minutes producing no diff, and the generic MCP fallback retry would burn another spawn.run-orchestrator.ts:472-498(and its message at:484) is unchanged — it seesmergedafter reconcile and skips with the existing voice.--forcecontinues to bypass.Closes #592.
Why this approach
Per the issue body's explicit recommendation: extend
reconcileStateAtStartup(one OR clause added to the loop guard) rather than add a second pre-flight check. Existing PR-status check + git fallback +resolvedAtstamp need no changes.Test plan
src/lib/workflow/state-cleanup.test.ts(5 tests) — covers AC-1/AC-3/AC-7 (in_progress→merged escalation with mockedGitHubProvider), AC-6 (offline fallthrough), regression forready_for_merge, unrelated-status no-op, and missing-state-filesrc/lib/workflow/state-utils.test.ts(should not advance issues in non-actionable statuses) — old assertion documented pre-fix(run): pre-flight guard misses in_progress issues already merged on GitHub (gap in #305/#423) #592 behavior; addedspawnSyncmock to handle a latent collision (test issue feat(#39): Add MCP browser testing patterns reference #44 with the real(#44)merge commit in this repo)npm run buildcleannpm run lintclean## [Unreleased]→### FixedAC verification
in_progressissuesrun-orchestrator.ts:484merged,resolvedAtstamped--forcecontinues to bypassin_progressissue, cached for runPlatformProvider