Skip to content

feat(#423): reconcile sequant status with GitHub on every read - #428

Merged
admarble merged 3 commits into
mainfrom
feature/423-sequant-status-reconcile-on-read-with-github-as-so
Mar 25, 2026
Merged

admarble merged 3 commits into
mainfrom
feature/423-sequant-status-reconcile-on-read-with-github-as-so

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • Add reconciliation engine that fetches live issue/PR state from GitHub via a single batch GraphQL query on every sequant status invocation
  • Auto-heal unambiguous drift (merged PRs → merged, closed issues → abandoned, missing worktrees → cleared)
  • Flag ambiguous drift to users (e.g., deleted worktree but issue still open with no PR)
  • Show next-action hints per issue row (e.g., → gh pr merge 419, → sequant run 422)
  • Add --offline flag for air-gapped/rate-limited scenarios
  • Wire MCP sequant_status tool through same reconciliation pipeline

AC Coverage

AC Description Status Evidence
AC-1 Batch GitHub query ✅ batchFetchIssueAndPRStatus() in github.ts, single GraphQL call
AC-2 Auto-heal unambiguous drift ✅ classifyDrift() + reconcileState() in reconcile.ts
AC-3 Next-action hints ✅ getNextActionHint() + hint column in table
AC-4 Relative timestamps + Last synced ✅ formatRelativeTime() + footer in status output
AC-5 --offline flag ✅ --offline in bin/cli.ts, offline option in reconcile
AC-6 MCP reconciled status ✅ MCP tool calls reconcileState() before returning data
AC-7 Graceful degradation ✅ Error from batch query → proceed with cached data
AC-8 Batch query <2s ✅ Single GraphQL call for all issues+PRs
AC-9 --cleanup, --rebuild, --json unchanged ✅ No changes to cleanup/rebuild paths
AC-10 Ambiguous drift flagged ✅ classifyDrift() returns ambiguous type, shown as warnings

Key Files Changed

  • src/lib/workflow/reconcile.ts — New reconciliation engine
  • src/lib/workflow/platforms/github.ts — Batch GraphQL query method
  • src/commands/status.ts — Replaced refreshMergedStatuses() with reconcileState()
  • src/mcp/tools/status.ts — Wired through reconciliation
  • src/lib/workflow/state-schema.ts — Added lastSynced field
  • bin/cli.ts — Added --offline flag
  • src/lib/workflow/reconcile.test.ts — 30 unit tests

Test Plan

  • 30 unit tests covering all AC items pass
  • npm run build passes
  • npm run lint passes
  • Full test suite: 1929/1930 pass (1 pre-existing timeout failure)
  • Manual: sequant status shows reconciled data with next-action hints
  • Manual: sequant status --offline shows local-only data
  • Manual: sequant status --json includes nextAction and lastSynced fields

Closes #423

🤖 Generated with Claude Code

Add reconciliation engine that fetches live issue/PR state from GitHub
via a single batch GraphQL query, auto-heals unambiguous drift (merged
PRs, closed issues, missing worktrees), flags ambiguous drift to users,
and shows next-action hints per issue row.

- Add batchFetchIssueAndPRStatus() to GitHubProvider for single-call batch queries
- Create src/lib/workflow/reconcile.ts with classifyDrift(), getNextActionHint(),
  formatRelativeTime(), and reconcileState() functions
- Add --offline flag to preserve pure local-state behavior
- Wire MCP sequant_status tool through reconciliation pipeline
- Add lastSynced field to WorkflowState schema
- 30 unit tests covering all AC items

Entire-Checkpoint: dff05e4f371d
When GitHub is unreachable and a worktree is missing, the ambiguous
drift warning previously said "issue still open" even though we don't
actually know the issue state. Split into two distinct messages:
confirmed open → "still open on GitHub", unknown → "GitHub state
unknown (API unreachable)". Both remain ambiguous (no auto-heal).

Entire-Checkpoint: dff05e4f371d
@admarble
admarble merged commit c210270 into main Mar 25, 2026
5 checks passed
@admarble
admarble deleted the feature/423-sequant-status-reconcile-on-read-with-github-as-so branch March 25, 2026 05:37
admarble added a commit that referenced this pull request Mar 25, 2026
Merge main into feature branch to resolve conflicts from #422, #423, #428.
CHANGELOG: keep both #420 and #423 entries.
status.ts: combine reconcile description (#423) with cross-tool guidance
and annotations (#420).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sequant status: reconcile-on-read with GitHub as source of truth

1 participant