Skip to content

fix(roadmap): fix-conflict runs its fixers only in a runner Job #6618

Closed

Description

@dan-petty

Problem

devops roadmap step fix-conflict cannot reach its tier 1. Its clone is a single-branch shallow clone (--depth=50), so git fetch origin <head> writes only FETCH_HEAD, and git checkout <head> fails (src/devops_cli/roadmap/steps/fix_conflict.py about :670-672). The docs and lockfile path of tier 1 also fails: it passes dict(os.environ, GIT_EDITOR="true") to git rebase --continue, and the process runner refuses that override with SecurityError.

Tier 1 runs project code of the checked-out pull request (uv run devops docs generate, uv lock). The step runs on a workstation with the GitHub token of the person, and it fetches and pushes through the named remote origin. So a fix of the checkout alone must not ship: tier 1 must first run only where the project's other steps run project code.

Expected

  • --confirm needs a runner Job (require_runner), and the step makes its process unreadable and adopts orphans before any project code runs, as fix-checks does. Without --confirm, the step only plans and runs no project code.
  • The step reads the URL of origin right after the clone, and every fetch and push goes through OriginGit, with a lease on the judged head.
  • Every local git call of the step runs with hooks off.
  • rebase --continue takes the editor from -c core.editor=true, with no environment override.
  • The checkout of the head branch works in the runner Job.

Proof

Tests that fail on main: a tier-1 program that writes a hook, a push URL or an insteadOf rule into the clone changes neither what the step runs outside a runner nor where it pushes inside one.

Alternatives check of 2026-11-21: none.
Tool: none found.
Reason: Searches for automated git conflict resolution and shallow-clone head checkout found only general Git and MDN documentation, no open tool that gates a fixer on a runner Job, uses OriginGit with a lease, or disables clone hooks. The need is an internal change to fix_conflict.py.

Lacks:

  • Runner-Job guard before untrusted project code runs
  • OriginGit fetch and push with a lease on the judged head
  • Local git calls with hooks disabled
  • Rebase continue without a GIT_EDITOR environment override

Proposed design

Problem statement

devops roadmap step fix-conflict can run tier-1 project code on a workstation with the GitHub token of a person. Its shallow single-branch clone cannot check out the pull request head, and its GIT_EDITOR override is refused. The change gates --confirm on a runner Job, hardens the process, routes every fetch and push through OriginGit with a lease, disables hooks and checks out the fetched head.

Acceptance criteria

Requirement: Confirm requires a runner Job

The fix-conflict step SHALL refuse --confirm outside a runner Job before it runs any project code.

Scenario: Confirm outside a runner stops

  • WHEN run_fix_conflict runs with confirm=True and no runner marker.
  • THEN The test asserts the runner guard refuses the call and no uv or openspec project-code subprocess runs.

Requirement: Confirm hardens the process before project code

When --confirm is set inside a runner Job, the step SHALL make its process unreadable and adopt orphans before it runs any project code.

Scenario: Process hardening runs first

  • WHEN run_fix_conflict runs with confirm=True inside a runner Job and reaches tier 1.
  • THEN The test asserts the process-hardening calls complete before the first uv or openspec subprocess.

Requirement: No confirm runs only the plan

Without --confirm, the step SHALL plan only and SHALL NOT run tier-1 project code.

Scenario: No confirm skips tier 1

  • WHEN run_fix_conflict runs with confirm=False and tier 1 is enabled.
  • THEN The test asserts resolve_tier1 and every uv and openspec project-code subprocess are not called.

Requirement: Origin URL is read after the clone

The step SHALL read the URL of origin right after the clone and SHALL use that URL for every OriginGit call.

Scenario: Origin URL is captured after clone

  • WHEN The step clones a repository.
  • THEN The test asserts origin_url(worktree) is called once after the clone and before the first OriginGit fetch or push.

Requirement: Fetch and push use OriginGit

Every fetch and push of the step SHALL go through OriginGit.

Scenario: Direct git fetch and push are absent

  • WHEN The step fetches the base and the head and pushes the resolved head.
  • THEN The test asserts no run_subprocess call runs git fetch or git push and OriginGit.fetch and OriginGit.push are called.

Requirement: Push leases the judged head

The push SHALL use a lease on the judged head SHA.

Scenario: Push uses the judged head lease

  • WHEN Tier 1 resolves a conflict and pushes the new head.
  • THEN The test asserts the OriginGit.push call has a lease that names status.head_sha.

Requirement: Local git calls disable hooks

Every local git call of the step SHALL run with -c core.hooksPath=/dev/null.

Scenario: A hook in the clone does not run

  • WHEN A tier-1 program writes an executable hook into the clone and the step runs a local git command.
  • THEN The test asserts the hook did not run and the git argv contains -c core.hooksPath=/dev/null.

Requirement: Rebase continue uses the config editor

The step SHALL pass -c core.editor=true to git rebase --continue and SHALL NOT set GIT_EDITOR.

Scenario: Docs and lockfile rebase continues

  • WHEN Tier 1 resolves generated docs or lockfile conflicts and continues the rebase.
  • THEN The test asserts the argv contains -c core.editor=true and no environment override sets GIT_EDITOR.

Requirement: Head checkout works in the runner Job

The step SHALL check out the head commit returned by the OriginGit fetch in the shallow single-branch clone.

Scenario: Shallow clone checks out the fetched head

  • WHEN The runner Job fetches the pull request head into a --depth=50 single-branch clone.
  • THEN The test asserts the local checkout uses the fetched commit SHA and HEAD equals status.head_sha.

Requirement: Clone-written git config cannot redirect the step

A hook, a push URL or an insteadOf rule written into the clone by tier-1 code SHALL NOT change what the step runs outside a runner or where it pushes inside one.

Scenario: Hostile clone config is ignored

  • WHEN A tier-1 program writes a hook, a push URL or an insteadOf rule into the clone.
  • THEN The test asserts no project code runs outside a runner and the runner push target is the origin URL read after the clone.

Existing Tool Considered

The alternatives check in the issue body records the verdict none on 2026-11-21 and names no tool. No open, maintained tool or library covers this internal roadmap step, so the change builds its own code in src/devops_cli/roadmap/steps/fix_conflict.py and reuses OriginGit and the process-hardening helpers. Written cost: about 4,000 tokens to write the runner guard, the OriginGit wiring, the hook and editor changes and the tests, about 1,500 tokens for each later fix, and about 6 hours of elapsed work.

Key questions

  • Where does the current step run tier-1 project code without a runner check?: _attempt_rebase_and_tier1 calls resolve_tier1 when settings.tier1_mode is on. The confirm flag changes only the stop reason. _clone_or_reuse_source clones with --depth=50, and the step runs its git calls through the local _git helper. [sources: src/devops_cli/roadmap/steps/fix_conflict.py]
  • Does the runner gate apply to fix_rebase_conflict?: No. fix_rebase_conflict is the programmatic helper for the implement runner Job, so it already runs inside a runner. The gate applies to the --confirm path of run_fix_conflict. [sources: src/devops_cli/roadmap/steps/fix_conflict.py, CONTEXT.md]
  • How should the step gate --confirm and process hardening?: Call the runner guard of fix-checks and the process-hardening helpers before any project code runs. Without --confirm, do not call resolve_tier1. (best practice) [sources: src/devops_cli/roadmap/steps/fix_conflict.py, src/devops_cli/roadmap/steps/fix_checks_repair.py, src/devops_cli/core/process_hardening.py, CONTEXT.md]
    • Chosen: Reuse the fix-checks runner guard and hardening helpers. It keeps one runner boundary and one process-hardening path.
    • Rejected: Add a second runner check in fix-conflict. It duplicates a security boundary, and the two copies can drift.
    • Rejected: Run tier 1 on the workstation when --confirm is set. The workstation holds the token of a person, and project code is untrusted.
  • How should the step check out the pull request head in a shallow single-branch clone?: Fetch the head through OriginGit and take the commit SHA that the fetch returns. Check out that SHA with a local git checkout -B <head_ref> <sha> that disables hooks. Do not check out the branch name from the clone. (best practice) [sources: src/devops_cli/roadmap/steps/fix_conflict.py, src/devops_cli/roadmap/implement/git_isolation.py:280]
    • Chosen: Check out the SHA returned by OriginGit.fetch. A shallow single-branch clone writes only FETCH_HEAD, so the branch name is not local.
    • Rejected: Keep git checkout <head_ref>. It fails because the branch is not in the clone.
    • Rejected: Check out the clone's FETCH_HEAD. OriginGit fetches in its own bare folder, so the clone's FETCH_HEAD is not the fetched head.
  • How should every fetch and push use the origin URL and a lease?: Read origin_url(clone) right after the clone and build one OriginGit with that URL. Use that object for every fetch and push. Push with --force-with-lease on status.head_sha. (best practice) [sources: src/devops_cli/commands/roadmap_step_review.py, src/devops_cli/roadmap/implement/git_isolation.py:280]
    • Chosen: One OriginGit built from the URL read after the clone. It keeps the trusted URL before tier-1 code can change origin.
    • Rejected: Read origin again before each fetch or push. Tier-1 code can rewrite the remote URL between the calls.
    • Rejected: Keep direct git fetch and git push. They read the clone configuration that tier-1 code can write.
  • How should local git calls disable hooks?: One local-git helper adds -c core.hooksPath=/dev/null to every call. Use the helper for the direct git calls too. (best practice) [sources: src/devops_cli/roadmap/steps/fix_conflict.py]
    • Chosen: Set core.hooksPath=/dev/null on each local git call. It disables hooks for every subcommand, not only commit and push.
    • Rejected: Use --no-verify on commit and push. It does not cover checkout, rebase, merge-tree or diff.
    • Rejected: Trust the hook configuration of the clone. Tier-1 code can write an executable hook.
  • How should rebase --continue get its editor?: Pass -c core.editor=true in the git argv and do not pass GIT_EDITOR in the environment. (best practice) [sources: src/devops_cli/roadmap/steps/fix_conflict.py, src/devops_cli/config/constants.py, tests/core/test_subprocess_env_boundary.py]
    • Chosen: Use -c core.editor=true. It is a command-line config and needs no environment override.
    • Rejected: Keep dict(os.environ, GIT_EDITOR="true"). The process runner refuses the GIT_EDITOR override with SecurityError.
    • Rejected: Unset GIT_EDITOR and rely on the default editor. An interactive editor can block the step.
  • What regression test proves that the hostile clone config cannot change the step?: Add a test with a tier-1 program that writes a hook, a push URL and an insteadOf rule into the clone. Assert that no project code runs outside a runner, and that inside a runner the push target is the origin URL read after the clone. (best practice) [sources: src/devops_cli/roadmap/steps/fix_conflict.py, src/devops_cli/roadmap/implement/git_isolation.py:280]
    • Chosen: Hostile clone config regression test. It covers the three ways that the clone can redirect a git call.
    • Rejected: Test only the checkout path. It proves neither the push target nor the hook behavior.
    • Rejected: Test only the runner guard. It does not prove that OriginGit ignores a rewritten push URL or an insteadOf rule.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    source/agent
    scope/roadmap
    status/new
    effort/medium
    on Nov 21, 2026
  2. dan-petty commented on Nov 21, 2026

    @dan-petty
    OwnerAuthor
    • Priority: P1-High. The step runs untrusted PR code on a workstation with the person's token, which is a live high security vulnerability requiring manual invocation.
    • Related: feat(roadmap): a fix-conflict step settles merge conflicts #5019, which asks for a different change. Both target the fix-conflict step; #5019 delivered it, this candidate fixes its checkout failure, security exposure on a workstation, and missing runner-Job guard.
  3. added
    value/high
    priority/p1-high
    owner/agent
    on Nov 21, 2026
  4. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

  5. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (3)

    Searches run:

    • automated git rebase conflict resolution CLI tool, results: 5
    • shallow clone single-branch fetch pull request head checkout tool, results: 5
    • git rerere reuse recorded resolution documentation, results: 5

    Sources:

  6. added
    status/ready
    and removed
    status/new
    on Nov 21, 2026
  7. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  8. added a commit that references this issue on Nov 21, 2026
    b0c60ad
  9. 28 remaining items

  10. removed
    status/ready
    owner/agent
    on Nov 21, 2026
  11. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor
  12. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-21 19:37 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p1-highscope/roadmapsource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions