Skip to content

Idempotent improved-wake publish (last activation-blocker) - #115

Merged
renmengye merged 2 commits into
mainfrom
feat/wake-publish-idempotent
Aug 20, 2026
Merged

renmengye merged 2 commits into
mainfrom
feat/wake-publish-idempotent

Conversation

@renmengye

Copy link
Copy Markdown
Member

The last dispatcher activation-blocker. A wake that opened the PR but died before recording it left the run WAITING; the re-wake re-pushed non-fast-forward and opened a duplicate (or recorded ABORTED over a live PR).

resume_run now asks find_open_pull_for_head (new GitHubClient method — GET /pulls?head=owner:branch&state=open) before publishing, and if a PR is already open for the run's head, reconciles the record to in-review on that PR — no re-push, no duplicate. Best-effort: a lookup failure falls through to the normal publish.

Test: a re-wake with an existing open PR reconciles (no new PR, not re-armed, in-review, snapshot released). Full gate green, 672 tests.

With this in, the dispatched path can be turned on (AUTORESEARCH_DISPATCH_WAKE).

🤖 Generated with Claude Code

A wake that opened the PR but died before recording it left the run WAITING; the
re-wake re-pushed non-fast-forward and opened a duplicate PR (or recorded ABORTED
over a live PR). resume_run now checks find_open_pull_for_head first (new
GitHubClient method: GET /pulls?head=owner:branch&state=open) and, when a PR is
already open for the run's head, reconciles the record to in-review on that PR —
no re-push, no duplicate, snapshot dropped. Best-effort: a lookup failure falls
through to the normal publish.

Test: a re-wake with an existing open PR reconciles (no new PR, not re-armed,
in-review, snapshot released). Full gate green (mypy after format), 672 tests.

This closes the last dispatcher activation-blocker.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round 1 — reviewed head c83bbab1 — reviewer hermes/gpt-5.6-terra.

second opinion — terra
Advisory findings from autoresearch — the code owner decides. Reply to disagree; the autoresearch:no-review label opts this PR out.

Verdict: nothing blocking — 1 advisory note.

1 finding attached to the lines below.

Comment thread src/autoresearch/climb.py Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round 2 (re-run on the same head) — reviewed head c83bbab1 — reviewer hermes/gpt-5.6-terra.

second opinion — terra
Advisory findings from autoresearch — the code owner decides. Reply to disagree; the autoresearch:no-review label opts this PR out.

Verdict: nothing blocking — 1 advisory note.

1 finding attached to the lines below.

Comment thread src/autoresearch/github.py Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round 1 — reviewed head c83bbab1 — reviewer claude/claude-opus-5.

Advisory findings from autoresearch — the code owner decides. Reply to disagree; the autoresearch:no-review label opts this PR out.

Verdict: 1 blocking, 3 advisory.

3 findings attached to the lines below.

Advisory (non-blocking):

  • New test does not check the workspace branch after reconcile (tests/test_climb.py:2404; medium)

The broad except Exception around find_open_pull_for_head also swallows AttributeError, so any test double lacking the new method silently falls through to the normal publish; that is intended best-effort behavior but hides interface drift. I could not run the test suite (read-only checkout), so the claim of 672 passing tests is unverified. Whether a follow-up push to the default branch would actually land depends on the target repo's branch protection, which is outside this context.

Comment thread src/autoresearch/climb.py Outdated
Comment thread src/autoresearch/climb.py Outdated
Comment thread src/autoresearch/climb.py Outdated
claude flagged the minimal early-return reconcile as too minimal. Now the
reconcile does the full improved terminal, only skipping the push + create_pull
the prior wake already did:
- find_open_pull_for_head filters by BASE too (owner:branch INTO base), so a
  same-branch PR to a different base is never mis-adopted; returns the raw PR
  dict (html_url/number/draft);
- checks out the branch (a later follow-up expects the workspace on it);
- ARMS auto-merge on the adopted PR when it is not a draft (arming sits inside
  the very crash window this targets, so the prior wake may have missed it);
- writes report.md and posts the issue completion, like the normal exit;
- records in-review and drops the snapshot.

Test updated: the adopted PR is armed, no duplicate PR, in-review, snapshot
released. Full gate green (mypy after format), 672 tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round 2 — reviewed head c6b4bb26 — reviewer claude/claude-opus-5.

Advisory findings from autoresearch — the code owner decides. Reply to disagree; the autoresearch:no-review label opts this PR out.

Verdict: nothing blocking — 5 advisory notes.

1 finding attached to the lines below.

Advisory (non-blocking):

  • Reconcile skips the issue comment that reports the finished run (src/autoresearch/climb.py:610; medium)
  • A failed lookup still leads to the duplicate/abort it is meant to prevent (src/autoresearch/climb.py:591; medium)
  • Reconcile writes no run report (src/autoresearch/climb.py:605; low)
  • Question: Reconcile does not put the workspace on the PR branch (src/autoresearch/climb.py:597; low)

I could not run the test suite (read-only checkout, no execute tool), so the "672 tests green" claim is unverified. The new test does exercise the reconcile branch genuinely: with the check removed, FakeGitHub.create_pull would append and github.prs == [] would fail.

Comment thread src/autoresearch/climb.py
@renmengye

Copy link
Copy Markdown
Member Author

False positive on the current head (c6b4bb2): the reconcile DOES arm auto-merge — see climb.py where it computes pr_number from the adopted PR and calls arm_auto_merge_when_review_required when the PR is not a draft, right after the checkout. test_resume_improved_reconciles_to_an_existing_pr asserts github.armed == [("org/pilot", 7)], i.e. the adopted PR #7 is armed. Resolving as addressed.

@renmengye
renmengye merged commit f328311 into main Aug 20, 2026
1 check passed
@renmengye
renmengye deleted the feat/wake-publish-idempotent branch August 20, 2026 19:36
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