Skip to content

fix(runway): ISS-001 reconcile stale merge retries - #675

Open
sbalabanov wants to merge 1 commit into
mainfrom
sergeyb/fix-runway-stale-retry
Open

fix(runway): ISS-001 reconcile stale merge retries#675
sbalabanov wants to merge 1 commit into
mainfrom
sergeyb/fix-runway-stale-retry

Conversation

@sbalabanov

Copy link
Copy Markdown
Contributor

Summary

Intent:

  • Let at-least-once merge deliveries converge when a prior attempt already updated Git but failed to publish its result.
  • Preserve staleness protection for superseded requests that would still modify the target.

Changes:

  • Apply transforming merge strategies locally before staleness validation and return success when the target already satisfies every step.
  • Check PROMOTE containment before freshness and account for head refs moved by a prior contention attempt.
  • Add real-Git fail-once end-to-end coverage, strategy-level regression tests, and adjacent reproduction documentation.

Generated by the 🪄 pr-create skill in devexp-agent-marketplace

Test Plan

AI Verification

Validated at 935e871 on Sep 4 22:05 UTC · 5 files analyzed · 1s

Validator Status Issues
android-lint not_applicable 0
java-coverage not_applicable 0
ios-lint not_applicable 0
web-repocheck not_applicable 0
java-lint not_applicable 0
go-coverage not_applicable 0
go-gazelle not_applicable 0
arc-lint not_applicable 0
visual-ios not_applicable 0
visual-android not_applicable 0
go-proto-lint not_applicable 0
android-coverage not_applicable 0
arc-unit not_applicable 0
go-thrift-lint not_applicable 0
ios-test not_applicable 0
uber-one not_applicable 0
web-lint not_applicable 0
web-coverage not_applicable 0
diff-template not_applicable 0
fix-disclosure not_applicable 0
go-lint not_applicable 0
web-typecheck not_applicable 0
web-unit not_applicable 0
merge-conflict not_applicable 0
visual-web not_applicable 0
ureview completed 0
custom not_applicable 0

0 issues detected

Skipped validators: claude · EngWiki

Prior runs

Run at c9ee7a8 on Sep 4 22:04 UTC · 5 files · 2s · 0 issues detected

Issues

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sbalabanov sbalabanov changed the title fix(runway): reconcile stale merge retries fix(runway): ISS-001 reconcile stale merge retries Sep 8, 2026

@sbalabanov sbalabanov left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed with the same lens as #678. The fix itself looks right: applying first and checking freshness only when the apply would actually change the target is the correct way to make a redelivery converge, and the terminal-vs-retryable split still holds (checkStale returns ErrInvalidRequest, the controller turns it into FAILED and acks). The e2e fail-once trigger is a genuinely good regression test.

My main comment is the one you flagged: the loop got much harder to read. Measured on git_merger.go:

cyclomatic max nesting
applyTransforming before 13 4
applyTransforming after 18 5

It is now the most complex function in the file (next is resolveAndValidate at 14). I tried a smaller shape, and it works — details inline.

Four smaller notes below.

🤖 [posted by agent] — automated review by Claude Code, requested by @sbalabanov.

Comment thread runway/extension/merger/git/git_merger.go
Comment thread runway/extension/merger/git/git_merger.go Outdated
Comment thread runway/extension/merger/git/git_merger.go Outdated
Comment thread runway/extension/merger/git/git_merger.go Outdated
Comment thread runway/extension/merger/git/objects.go Outdated
Comment thread test/e2e/submitqueue/git_suite_test.go
Summary:
Intent:
- Let at-least-once merge deliveries converge when a prior attempt already updated Git but failed to publish its result.
- Preserve staleness protection for superseded requests that would still modify the target.

Changes:
- Apply transforming merge strategies locally before staleness validation and return success when the target already satisfies every step.
- Check PROMOTE containment before freshness, once per request rather than once per contention attempt.
- Recognise a head branch an earlier delivery moved by the committer identity recorded on the commit, and resume moving it on.
- Extract one reset/apply/push cycle into attemptTransforming so applyTransforming holds only the retry decision.
- Add real-Git fail-once end-to-end coverage, strategy-level regression tests, and adjacent reproduction documentation.

A change's head branch moves before the target does, so a delivery can end
between the two pushes. The redelivery then finds the branch off the commit its
URI pins while the target is unchanged, which looks stale but is not: the branch
sits on a commit the merger itself made. The committer identity recorded on that
commit tells the two apart, and unlike the in-flight head-branch tracker it
survives the process that wrote it. A branch the change's author advanced still
carries their identity and is still rejected. The same signal lets the head
branch be moved on rather than stranded on a commit that never landed.

Extracting the attempt drops applyTransforming from 18 to 9 cyclomatic
complexity and from 5 to 2 levels of nesting, and ends the reuse of one err
variable for two different failures.

---

<sub>Generated by the 🪄 pr-create skill in devexp-agent-marketplace</sub>
@sbalabanov
sbalabanov force-pushed the sergeyb/fix-runway-stale-retry branch from 935e871 to 8dae6f1 Compare September 9, 2026 16:50
@sbalabanov
sbalabanov marked this pull request as ready for review September 9, 2026 16:51
@sbalabanov
sbalabanov requested review from a team and behinddwalls as code owners September 9, 2026 16:51
@sbalabanov
sbalabanov marked this pull request as draft September 9, 2026 16:57
@sbalabanov
sbalabanov marked this pull request as ready for review September 9, 2026 18:12
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.

3 participants