Skip to content

Read rebase preflight and recovery state in Go #895

Description

@tbhb-agent

Problem

Rebase preflight computes the target and preserves the old range when another workflow started the replay. The lifecycle at packages/agents/source/skills/rebase/shared/scripts/preflight.sh:121 prevents an aborted run from becoming the next comparison point. The recommendation at packages/agents/source/skills/rebase/shared/scripts/preflight.sh:189 resembles commit preflight but differs for missing refs; blindly sharing the answer would change behavior.

Part of #588 and #326.

Acceptance criteria

  1. AC1: Given each default-branch and local/remote-ref combination, when preflight runs, then the recommended base and reason match the frozen rebase report.
  2. AC2: Given fetching is enabled, disabled, fails or reaches its configured deadline, when preflight runs, then it reports the corresponding fetch outcome.
  3. AC3: Given a replay above the configured commit cap, when preflight reports it, then its listing matches the frozen capped report.
  4. AC4: Given an active merge-backend rebase started elsewhere, when preflight runs, then durable verification evidence identifies that replay's original tip and target.
  5. AC5: Given incomplete saved evidence with no active rebase, when preflight runs, then that stale evidence is removed.
  6. AC6: Given completed saved evidence with no active rebase, when preflight runs, then the evidence is retained.
  7. AC7: Given staged, unstaged and untracked changes, when preflight runs, then its working-tree report matches the frozen report.
  8. AC8: Given predicted conflicts and paths changed on both sides, when preflight runs, then its advisory conflict report matches the frozen report.
  9. AC9: Given Git preferences and available gate tasks, when preflight runs, then it reports their effect without running the tasks.
  10. AC10: Given worktree readiness refuses, when preflight runs, then it stops with that refusal.
  11. AC11: Non-functional: preflight leaves tracked contents and the index unchanged; permitted writes are fetched Git data, merge-preview objects and recovery evidence.
  12. AC12: Non-functional: native preflight cases execute without skips on macOS, Linux and Windows.

Scope and non-goals

Scope: preflight and the rebase evidence lifecycle used by later commands.

Non-goal: shared context (#321), commit readiness and commit base selection (#322), PRs (#323), merges (#324), or guards (#328 and #753). Non-goal: correcting missing-ref recommendations in this parity port. Keep shell and coupled Python frozen through N-2, with no new shell logic. Do not switch callers or retire tests in this child.

Approach

Use packages/agents/source/skills/rebase/shared/scripts/preflight.sh:106 as the report contract and preserve the evidence consumed at packages/agents/source/skills/rebase/shared/scripts/verify-rebase.sh:65. Reuse #321's repository context and #322's readiness deliverable rather than porting them again. Expose preflight through agentrepo rebase. Pin display settings and compare full transcripts, normalizing only fixture roots and commit IDs. Cover active apply/merge backends, interrupted operations, detached state and preview failures.

Dependencies

Blocked by: #753 (before registration), #851 (child 02 of #322, the worktree readiness deliverable).

Prerequisite: #321's repository-context deliverable. This child depends on those deliverables, not on closure of either whole area.

Size

M. Forecast 740 code lines: 320 implementation, 350 tests and fixtures, 70 registration/integration. Measured source baseline: 243 code lines. Prose allowance: 250 lines.

scc could not run in the isolated checkout. Measured baselines count non-blank lines other than full-line # comments, including Python docstrings and embedded code conservatively. Forecasts include implementation, tests, fixtures and registration; they are estimates, not measured future Go. Generated output is excluded only under packages/agents/claude/.apm/skills/, packages/agents/codex/.apm/skills/, .claude/skills/, .agents/skills/ and tokens.json. The source under packages/agents/source/ and copies anywhere else count. The final diff must be at most 800 code lines and 2,000 prose lines, with no exception; split before implementation if either forecast grows beyond its limit.

Verify plan

  • AC1, AC2, AC3: compare ref-matrix, fetch-outcome and cap-boundary transcripts with the frozen script; use a bounded timeout stub.
  • AC4, AC5, AC6: port the active, aborted and completed-state cases at tests/skills/rebase/scripts/rebase-workflow.bats:40 and inspect evidence after each transition.
  • AC7, AC8, AC9: compare reports for dirty trees, merge previews, common changed paths, Git preferences and task availability.
  • AC10: inject readiness refusals from packages/agents/source/lib/worktree-ready.sh:13 and assert no later work runs.
  • AC11: snapshot content, index and metadata and account for each permitted write.
  • AC12: inspect executing native cases in the three-platform Go CI matrix.
  • Definition of done: D1 each AC is verified at the merged head, with the commands and results cited in the pull request's Verification. D2 an independent review approves the exact merged head, and every finding has a recorded disposition. D3 required checks pass with no gate loosened. D4 the leak scans the repository specifies are clean, and every post made for this work passes the per-post leak review before it is posted. D5 every commit is signed. D6 the documentation matches the change or the Verification says why there is no impact. D7 every commit has an Assisted-by trailer and the pull request has the provenance:agent-assisted label. D8 the pull request stays within the size limits. D9 follow-ups are filed as issues and listed under Related. D10 the merge closes the issue through a closing reference, the board shows Done, and the final Status: comment names the merge commit.

Risks

A changed target or stale original tip can replay or compare the wrong work. Undo: revert this Go-only child; frozen callers remain in use.

Operator authority

None.

Activity

  1. tbhb-agent commented on Oct 27, 2026

    @tbhb-agent
    ContributorAuthor

    Refinement: READY — Read rebase preflight and recovery state in Go
    Model: gpt-6-astra

    Child 01 Read rebase preflight and recovery state in Go

    Verdict: READY

    Checked: Prior scope, dependencies, verification and 740-line forecast remain consistent; neither correction affects this child.

    Gaps: None.

    Split: None required.

    Definition of done

    The definition of done for this issue (Feature). Tick each item and give its evidence.

    • D1 The author verified each AC on the merged head, and the Verification section of the pull request cites each AC ID with its evidence: the command and its result, or a link.
    • D2 An independent reviewer approved the exact merged head, and the author resolved each finding or filed it as a follow-up.
    • D3 The required checks pass on that head, and any loosened gate has the owner's approval of that exact head.
    • D4 The leak scans come back clean: gitleaks, devtools' check-leaks.sh with the repository's private-strings list, and the leak review of each post.
    • D5 The author signed each commit, the squash included.
    • D6 The docs match the change (README, docs/, CHANGELOG or help text), or the Verification section says "No doc impact" and why.
    • D7 The commits and the squash have Assisted-by trailers, and the pull request has the provenance:agent-assisted label.
    • D8 The pull request stays within the size limits, or the owner approved its exact head over the hard limit.
    • D9 The author files follow-ups and deferred findings as issues with at least a Problem and numbered AC and lists them under the Related section of the pull request. Any work left in the code links its issue.
    • D10 The merge closes the issue through a closing reference and the board shows Done. The final Status: comment names the merge commit.
    • devtools-1 mise run check is green, and so are the coverage floors mise run cover-go-check and mise run cover-py-check, which check doesn't run.
    • devtools-2 A change to skill sources under packages/agents/source/ commits what mise run generate-skills, then mise run skill-tokens, then apm install rewrite, in that order, and check-generated-skills (part of lint) passes.
    • devtools-3 A consumer-visible change (the vendored payload, a skill, a reusable workflow, a task or a pin) has its consumer steps in docs/agent-skills-migration.md or the adoption docs, or the PR's Verification says "No consumer impact" and why.

    Round: 2 of 3

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

    refinement:readyPassed the Definition of Ready; may be picked up

    Fields

    Priority

    None yet

    Work type

    None yet

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions