Skip to content

state.json is only reconciled by a sequant run — read paths can present stale ready_for_merge between runs #849

Closed as not planned

Description

@admarble

Found during pre-2.10.0 release verification against the ad-motion and matcha-maps dogfood projects.

Four issues sit in .sequant/state.json with status: ready_for_merge and every phase completed, but all four are already merged and closed on GitHub:

Project Issue state.json GitHub
ad-motion 132 ready_for_merge PR 134 MERGED, issue CLOSED
matcha-maps 708 ready_for_merge PR 714 MERGED, issue CLOSED
matcha-maps 730 ready_for_merge PR 741 MERGED, issue CLOSED
matcha-maps 731 ready_for_merge PR 740 MERGED, issue CLOSED

Local state was never reconciled after a human merged the PR. lastUpdated is 2026-07-27 (ad-motion) and 2026-07-20 (matcha-maps), so this has persisted across many subsequent runs.

Why it matters beyond stale display: the human merge gate is precisely the seam --ready-gate (#817) hands off at. If nothing reconciles state after the human acts, every issue driven through the gate accumulates as a permanent phantom, and --ready-gate's own resume/skip logic reasons over that same status field.

Note sequant state --cleanup exists but evidently is not run automatically, and would not by itself fix the root cause.

Acceptance Criteria

  • AC-1: A merged-and-closed issue is reconciled to a terminal status rather than remaining ready_for_merge indefinitely.
  • AC-2: Reconciliation happens without the user having to remember a separate cleanup command.
  • AC-3: Reconciliation is safe offline — no GitHub query means no state change, never a wrong downgrade.
  • AC-4: The four phantom entries above are covered by a regression fixture.

Activity

  1. admarble commented on Jul 29, 2026

    @admarble
    ContributorAuthor

    Correcting this issue — the original diagnosis was wrong.

    While running a --ready-gate E2E in matcha-maps, the very first lines of the run were:

      #708: PR #714 is merged
      #730: PR #741 is merged
      #731: PR #740 is merged
    State: Pruned 9 expired issue(s): #107, #578, #585, #653, #665, #706, #709, #726, #727
      State reconciled: #708, #730, #731 → merged
    

    So reconciliation exists and works, and it fixed all three matcha-maps phantoms cited in the issue body automatically. AC-1 and AC-4 as written are already satisfied.

    What I actually observed was not "state is never reconciled" but a much narrower and less severe thing: reconciliation is only triggered by a sequant run. Between runs, state can sit stale indefinitely — matcha-maps' entries were 8 days stale purely because no run had been invoked in that window. Reading state.json (or anything derived from it) in that window shows merged work as ready_for_merge.

    That is a real but much smaller gap, and it may well be acceptable as-is: reconciliation costs GitHub queries, and doing it on every read would be worse. Retitling and rescoping accordingly.

    The remaining question worth deciding is whether any read path that surfaces status to a human (sequant status, the dashboard, /assess) should note that state may be stale, rather than presenting ready_for_merge as current fact.

    Apologies for the noise — I filed this from static inspection of state.json without first checking whether a run reconciles it.

  2. changed the title [-]state.json is never reconciled after a human merges — four dogfood issues stuck at ready_for_merge (the seam --ready-gate hands off at)[/-] [+]state.json is only reconciled by a sequant run — read paths can present stale ready_for_merge between runs[/+] on Jul 29, 2026
  3. admarble commented on Jul 29, 2026

    @admarble
    ContributorAuthor

    #849 — state.json is only reconciled by a sequant run — read paths can present stale ready_for_merge between runs
    Open
    ────────────────────────────────────────────────────────────────

    → CLARIFY — Author's correction retracted the original diagnosis; body ACs are stale (AC-1/AC-4 already satisfied) and the rescoped question is undecided

    Need: Decide whether read paths (sequant status, dashboard, /assess) should surface staleness, or stale-between-runs is acceptable as-is
    If a staleness note is wanted, rewrite the ACs around the read paths (the body's AC-1/AC-4 are already satisfied by run-time reconciliation). If acceptable as-is, close the issue.
    ────────────────────────────────────────────────────────────────
    ⚠ Do not implement from the body as written — the author's 2026-07-29 comment supersedes it
    ────────────────────────────────────────────────────────────────

  4. admarble commented on Jul 29, 2026

    @admarble
    ContributorAuthor

    Closing after tracing every read path: the rescoped concern — "read paths present stale ready_for_merge as current fact" — is already handled.

    Evidence per read path:

    • sequant status reconciles on every invocation (src/commands/status.ts → runReconciliation → reconcileState). It auto-heals exactly this issue's phantom class — reconcile.ts:73 classifies PR-merged-on-GitHub as unambiguous drift and sets status = "merged" — warns on ambiguous drift, and prints a Last synced: <ago> footer.
    • Offline safety (the AC-3 concern) is already implemented: GitHub unreachable → "showing cached data" warning, no state change; --offline skips queries entirely.
    • MCP sequant_status tool reconciles per call and returns lastSynced + githubReachable.
    • MCP sequant://state resource doesn't reconcile but exposes lastUpdated/lastSynced for the consumer to judge freshness; server instructions route agents to sequant_status.
    • Dashboard reads state raw but displays per-entry relative ages, and is a live-SSE view used almost exclusively during runs.
    • /assess queries GitHub live and never trusts state.json.

    The 8-day matcha-maps staleness could only persist because nothing was invoked in that window — not even sequant status; any status read would have healed it. The one conceivable remaining change (dashboard-side reconciliation) would add GitHub queries to a live view that already shows entry ages — disproportionate to the residual gap.

    Original ACs: AC-1/AC-4 satisfied by run-time reconciliation (per the 2026-07-29 correction above), AC-2 satisfied by status-read reconciliation, AC-3 already implemented as described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions