Skip to content

Follow dispatched fixes to the merge (0.9.7) - #33

Merged
iamwhatever merged 1 commit into
mainfrom
feat/fix-pr-state
Oct 1, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
feat/fix-pr-state

Conversation

@iamwhatever

Copy link
Copy Markdown
Owner

Summary

Dispatched fixes are now followed to the merge. Before this, Re-analyze only saw a dispatched fix when its Slack thread moved, and nothing read the PR, so a merged fix stayed triaged under Fixes in flight.

  • PR state read (backend/github_state.py, called from watch.poll_once after the digest step): gh pr view <url> --json state,mergedAt,closedAt,isDraft with the owner's own gh, read-only, asyncio.to_thread(subprocess.run, timeout=20). At most 10 URLs a cycle, oldest-checked first, each at most every 30 min, never again once merged/closed. gh missing / logged out / rate-limited / timed out: unknown with a short why, no read for 1 h. Per-URL readings in <data>/pr_states.json; each item gets fix_handoff.pr_state = {state, at, checked_at, merged_at?, why?}. On the first merged: one dispatch event PR #N merged and a possibly_resolved flag (fix PR #N merged) for the Thread Watcher, unless one is already there. Nothing sets resolved, regenerates a draft, posts, or writes to GitHub.
  • Re-analyze set: store.needs_reanalysis is also true when pr_state is merged/closed and pr_state_seen_at is older than pr_state.at. send_reanalyze stamps pr_state_seen_at. The prompt prints PR <url> · merged 2026-09-30 / · open / · closed, not merged and the merged/closed rule.
  • Record tool: a fix_handoff carrying pr_state or pr_state_seen_at is refused; a Lead rewrite keeps both; a new dispatch clears both.
  • Board: a merged fix is back in Needs a decision as Fix merged · PR #N with Done; its line reads Dispatched · <title> · PR #N merged ✓; Fixes in flight leaves it out and shows the other PRs' state; the Ledger row tags it fix merged / fix PR closed. The Re-analyze count includes it.
  • Brief v9, README (both halves), desk/CHARTER.md, desk/CONTRACT.md, app.json 0.9.7.

Deviation from the request: the request said the Lead should "set possibly_resolved". The record tool has no field for that (only clear_possibly_resolved), and an unknown field refuses the whole row. So the gateway sets the flag on the merge, the same way the poller flags a thread, and the prompt and brief tell the Lead to leave that flag to the Watcher or set resolved when the thread also confirms. /now has no dispatched-fix summary today, so nothing was added there.

Tested

  • python -m pytest tests -q -p no:cacheprovider: 354 passed (25 new in tests/test_pr_state.py, all with an injected fake gh runner; an autouse fixture fails any real gh call).
  • npm run build: clean; ui/dist/index.mjs rebuilt.
  • docs/screenshots/capture/shoot.mjs: all checks pass, including the new fix-merged check (row reads PR #412 merged, link, Done only, Re-analyze 3 stale, fold excludes it and shows PR #418 open, Ledger tag fix merged). New frame docs/screenshots/fix-merged.png.

A merged fix back in Needs a decision

The gateway reads each dispatched fix's PR state with the owner's own gh,
read-only, after every poll: at most 10 PRs a cycle, oldest-checked first,
each at most every 30 minutes, never again once merged or closed; gh
missing, logged out or rate-limited records unknown and backs off an hour.
The state lands on fix_handoff.pr_state (app only; the record tool refuses
it). A merge logs one "PR #N merged" event and flags possibly_resolved for
the Thread Watcher.

A merged or closed fix the Lead has not seen joins the Re-analyze set
(fix_handoff.pr_state_seen_at, stamped by send_reanalyze), and the
re-analyze prompt names each PR's state with the rule for a merged or
closed-unmerged PR. The Board brings a merged fix back to Needs a
decision as "Fix merged · PR #N" with Done, its line reads
"PR #N merged", and Fixes in flight drops it and shows the other PRs'
state; the Ledger tags it "fix merged". Brief v9, README, charter and
contract updated.
@iamwhatever
iamwhatever merged commit 864905c into main Oct 1, 2026
2 checks passed
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.

1 participant