Skip to content

BUG: Git delivery: Gitea bypasses adoption and uses unconditional branch deletion (Codex F7) #450

Closed

Description

@ephico2real2

Part of #286. Found by Codex (another model family) reviewing the Git delivery layer on main b8ee59e (PRs #288, #299), 2026-11-19. Severity per Codex: High.

Location: cmapi/src/cmapi/core/git/gitea.py:63–:69, :111–:119; architecture exclusion core/git/__init__.py:26.

An existing PR is sufficient to adopt an arbitrary branch head without trailers, parent or folder checks. Without a PR, the adapter deletes the existing branch unconditionally. Cleanup separately reads the head then performs REST DELETE, which can erase a person's concurrent push between those requests. This contradicts arbitration rulings 3 and 8 even though the implementation labels Gitea a stand-in.

Full fix: fail closed on existing-branch adoption/replacement and on deletion of an existing ref, with explicit errors requiring Git transport. No unconditional delete remains in these paths. Appendix C: core/git/gitea.py.

Tests: test_gitea_never_deletes_or_adopts_an_unverified_existing_branch[push] and [delete]: 2 fail main; 2 pass fixed. The baseline deletion sends DELETE, observed in MockTransport. The concurrent-loss scenario is an inference from that unconditional endpoint; no live Gitea service was contacted.

Operational limitation: this is a safety fix, not full Gitea migration. Interrupted REST pushes may require an operator, existing refs are not automatically removed, and cleanup will report failure. To provide automatic retry plus conditional mutation on this adapter, move it onto GitWorkspace in a separate, deployment-tested change. Do not describe this patch as restoring all of G2/G8 for Gitea.

Evidence: workbench/cmapi/review-288b/codex-report.md (F7) and its regression test in codex-fixes.patch; Codex ran it failing on main and passing with its fix. Reviewer 2 (OB3) checks the fix and runs the PostgreSQL and SSH checks the sandbox could not, before it is applied.

Activity

  1. added
    bug
    status:open
    sev:high
    Backlog
    on Nov 19, 2026
  2. added
    Done
    and removed
    Backlog
    on Nov 19, 2026
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

    Donebugsev:highstatus:open

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions