feat(cli): --revise-from-branch on foreman dispatch for in-place PR refresh#1043
Open
joryirving wants to merge 1 commit into
Open
feat(cli): --revise-from-branch on foreman dispatch for in-place PR refresh#1043joryirving wants to merge 1 commit into
joryirving wants to merge 1 commit into
Conversation
…efresh issue-fix tasks can already restore a prior attempt and force-with-lease push an update to the same branch via payload.reviseFromBranch, but the flag was unreachable from the CLI. Add --revise-from-branch <ref>: when set, both payload.branch and payload.reviseFromBranch are stamped with that ref, so the executor restores the prior attempt and refreshes the open PR instead of cutting a new branch. Requires exactly one issue. Closes defilantech#996 Signed-off-by: Jory Irving <jory@jory.dev>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Defilan
requested changes
Jul 10, 2026
Defilan
left a comment
Member
There was a problem hiding this comment.
Nice flag, but there's a merge-order gotcha with #1042 that makes it a no-op as written. #1042 gated the reviseFromBranch restore behind BranchStrategy == rebase, and the default is now reset — so a dispatched task that sets ReviseFromBranch but not BranchStrategy falls through to the fresh-cut path and never restores the prior attempt.
buildTask needs to also stamp BranchStrategy: BranchStrategyRebase on the revision path. The unit test passes because it only checks payload stamping, not the executor behavior — worth asserting the strategy too so this can't regress. Fix that and it's good.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add
--revise-from-branch <ref>tollmkube foreman dispatch. When set, the dispatched AgenticTask has bothpayload.branchandpayload.reviseFromBranchstamped to that ref, so the executor restores the prior attempt and force-with-lease pushes an update to the same branch (and open PR) instead of cutting a new one.Why
Post-PR iteration (a failing E2E, a reviewer request-changes) shouldn't require regenerating the whole branch — that wastes compute, tokens, and power for a one-line fix. The CRD field (
payload.reviseFromBranch) and executor path already exist (#951, #978); today the only way to trigger them ad-hoc is hand-writing anAgenticTask. This flag makes incremental revision first-class for CLI-driven dogfooding.Closes #996
How
dispatchOptions.reviseFromBranchfield, bound to--revise-from-branch.validateReviseFromBranchhelper: when the flag is set, requires exactly one issue (a revision targets a single branch — matches the issue's "Notes").buildTaskstampsBranchandReviseFromBranchtogether from the flag on the revision path; both stay empty on the fresh-branch path.TestBuildTask_ReviseFromBranch(table: unset+set),TestValidateReviseFromBranch(table: 5 cases),TestRunDispatch_ReviseFromBranchFiresBeforeFetch(asserts the rule fires before the GitHub fetch).The executor (
pkg/foreman/agent/executor_native.go) and the WorkloadReconciler (internal/foreman/controller/workload_iteration.go) already consumeReviseFromBranch; nothing underapi/foreman/orcharts/changes.Checklist
make testpasses locallymake lint-allpasses locally (darwin + linux)git commit -s) per DCOllmkube foreman dispatch --helpexample block shows the new flag.