Skip to content

fix: keep automatic rollbacks agent-free - #2986

Merged
numnx merged 2 commits into
devfrom
fix/automatic-rollback-invocation
Jul 12, 2026
Merged

fix: keep automatic rollbacks agent-free#2986
numnx merged 2 commits into
devfrom
fix/automatic-rollback-invocation

Conversation

@numnx

@numnx numnx commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • Kept every automatic rollback worktree operation rooted in the source repository and addressed the temporary checkout with git -C.
  • Prevented containerized Git from invalidating the worktree .git pointer between add, switch, revert, and push operations.
  • Added a hard orchestration boundary that repairs automatic rollback audit tasks to completed/merged and excludes them from task dispatch, task QA, and intervention paths.
  • Made automatic rollbacks create a PR, wait for green checks, auto-merge, and complete only after the Git host confirms the merge.
  • Preserved the configured merge policy for agent-assisted rollbacks, while still enforcing the remote PR boundary.
  • Added regression coverage and updated canonical and published rollback documentation.

Root cause

Two independent paths could start an unnecessary invocation after the safety assessment selected automatic mode:

  1. git worktree add ran through the containerized Git helper and wrote metadata relative to its /workspace mount. Later commands changed their host cwd to the temporary worktree, causing the helper to remount a different directory at /workspace; the metadata pointer no longer resolved, so the service treated the infrastructure failure as an automatic-revert failure and created an agent task.
  2. The already-settled audit task could be projected as pending during a later orchestration cycle and was still eligible for the normal task dispatcher, even though the revert and merge workflow did not require provider work.

User impact

A clean automatic rollback now remains invocation-free: the visible rollback sprint contains only its settled audit task while Code UX reverts, pushes, opens the PR, waits for CI, merges, and finalizes automatically. Custom instructions and genuinely unsafe rollback histories continue to use the agent-assisted path.

Validation

  • pnpm run ci — passed
    • Backend: 435 files, 5,481 tests passed, 7 skipped
    • Coverage: 82.61% statements, 72.36% branches, 83.74% functions, 83.86% lines
    • Dashboard: 241 files, 2,149 tests passed, 2 skipped
    • Audit, strict typecheck, quality guardrails, and production build passed
  • Focused rollback service and finalization policy suites: 11 passed
  • Post-guard validation: pnpm run lint, pnpm run test:backend, and pnpm run build passed
    • Backend: 435 files, 5,482 tests passed, 7 skipped
  • Focused rollback and cycle-runner suites: 64 passed
  • Real containerized Git worktree sequence passed through add, switch, merge revert, and cleanup
  • git diff --check passed

Risk and rollback

  • The change affects rollback Git command context, rollback finalization policy, and automatic rollback cycle dispatch eligibility.
  • Standard sprints are unchanged.
  • Reverting this commit restores the prior behavior; no schema or persisted-data migration is involved.

@numnx
numnx marked this pull request as ready for review July 12, 2026 21:36
@numnx
numnx merged commit c030c8f into dev Jul 12, 2026
40 checks passed
@numnx
numnx deleted the fix/automatic-rollback-invocation branch July 12, 2026 21:51
@numnx numnx mentioned this pull request Jul 14, 2026
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.

1 participant