Skip to content

[FEATURE] Make branchStrategy/reviseFromBranch coupling foolproof (silent no-op footgun) #1047

Description

@Defilan

Feature Description

Make the payload.branchStrategy / payload.reviseFromBranch coupling foolproof, so that setting reviseFromBranch without also setting branchStrategy: rebase cannot silently no-op.

Problem Statement

As someone dispatching an in-place PR revision, I want setting reviseFromBranch to actually restore the prior attempt, not silently cut a fresh branch.

#1042 gated the reviseFromBranch restore in setupTaskBranch behind branchStrategy == rebase, and made the default reset:

strategy := task.Spec.Payload.BranchStrategy
if strategy == "" { strategy = BranchStrategyReset }
if strategy == BranchStrategyRebase &&
    task.Spec.Payload.ReviseFromBranch != "" &&
    task.Spec.Kind == AgenticTaskKindIssueFix { /* restore + rebase */ }

So a task that sets reviseFromBranch but leaves branchStrategy unset defaults to reset and skips the restore entirely — it cuts a fresh branch and does the opposite of what the caller intended. There is no error and no warning; the payload just silently does nothing with reviseFromBranch.

This already bit #1043 (the --revise-from-branch CLI flag stamped reviseFromBranch but not branchStrategy, so the flag was a no-op post-#1042). Every future caller that sets reviseFromBranch is one forgotten field away from the same silent failure.

Proposed Solution

Pick one (or combine):

  1. Default to rebase when reviseFromBranch is set (recommended). In setupTaskBranch, when branchStrategy is empty and reviseFromBranch != "", treat the effective strategy as rebase. Restore-and-rebase is the only sensible intent when a prior attempt is named; the explicit reset still wins when set. Callers can stop threading branchStrategy on the revision path.
  2. Validate the pairing. The AgenticTask validating webhook (and/or the CLI) rejects reviseFromBranch set with branchStrategy: reset as a contradiction, so the mistake fails loud at admission instead of silently at execution.
  3. Warn. Log a clear warning when reviseFromBranch is set but the effective strategy is reset, so the no-op is at least visible in the executor logs.

Alternatives Considered

Additional Context

Priority

  • Medium - Nice to have (prevents a recurring silent-no-op class)

Willingness to Contribute

  • Yes, I can submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/foremanForeman: the agentic fleet orchestrator add-onenhancementNew feature or requestpriority/mediumMedium priority

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions