Skip to content

fix(backup): attach configured remote to local repositories - #1304

Merged
steipete merged 1 commit into
mainfrom
fix/gog-round19-backup-remote
Nov 5, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/gog-round19-backup-remote

Conversation

@steipete

@steipete steipete commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Allow a local backup repository to acquire its first configured origin. After gog backup init without a remote, gog backup init --remote URL now adds the missing origin so subsequent pushes use it. Existing origins are never replaced, even when a different remote is supplied in configuration.

Follow-up to #1303 and #1287. Synthetic proof first reproduced the missing-origin failure, then verified initialization, a push to a temporary local bare repository, and preservation of the existing origin. No real backup was run or personal configuration changed.

Full gate: make ci passed on the dedicated Linux Crabbox lease (run run_1fd82869a516d40c0c3e78f16c0b3efc). Independent Codex P0–P2 final review is clean.

Allow a local backup repository to acquire its first configured origin. After `gog backup init` without a remote, `gog backup init --remote URL` now adds the missing origin so subsequent pushes use it. Existing origins are never replaced, even when a different remote is supplied in configuration.

Follow-up to #1303 and #1287. Synthetic proof first reproduced the missing-origin failure, then verified initialization, a push to a temporary local bare repository, and preservation of the existing origin. No real backup was run or personal configuration changed.

Full gate: `make ci` passed on the dedicated Linux Crabbox lease (run `run_1fd82869a516d40c0c3e78f16c0b3efc`). Independent Codex P0–P2 final review is clean.
@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T18:40:47.557430Z e99ede3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 5, 2026
@clawsweeper

clawsweeper Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

Attach the configured backup remote as origin when an existing local backup repository has no origin.

Example: Run gog backup init locally, then gog backup init --remote /tmp/private-backup.git.

  • Before: The remote is saved in backup configuration, but the existing repository never acquires an origin.
  • After: The repository acquires /tmp/private-backup.git as origin, enabling subsequent snapshot uploads.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused patch appears correct, but the required destination-authority and existing-state evidence is incomplete.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Following the documented instructions to enable uploads after local initialization leaves backups without a Git origin.
Reason: The collaborator-authored direction completes the existing documented workflow without adding configuration or replacing user-selected origins.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep this PR open: it fixes a source-confirmed setup gap on main, has owner-approved direction, and introduces no definite correctness defect.

Priority: P2
Reviewed head: e99ede3d962659b8c0b7e9de860a8857b0dff63e

Before merge

  • Add real behavior proof - Authority-chain proof required: the body reports synthetic initialization and a successful push to a temporary bare repository, and the added test exercises real Git through backup.Init and PushSnapshot. It does not show a final push after supplying conflicting remote B while preserving origin A, nor removal of both saved destination and origin before subsequent snapshot/checkpoint retry dispatch. Supply redacted production-path output proving A receives the allowed upload, B receives nothing, and revoked destinations receive no subsequent upload. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Resolve security review attention item - No concrete security defect was found, but persistent upload-destination authority still needs final-effect validation.
  • Resolve merge risk - The PR owner must establish that the newly persisted destination cannot redirect uploads to a conflicting destination or remain effective after destination authorization is removed, including subsequent checkpoint retries.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Supply final-effect destination exclusion and revocation output plus a latest-stable upgrade run preserving existing configuration, identity, and backup contents; base-failure/head-success is reported but no execution transcript is supplied.
Agent review details

How this fits together

Backup commands resolve saved configuration and CLI options, prepare a Git repository, write encrypted snapshots, and optionally push commits through its origin.

flowchart LR
  A[Backup CLI] --> B[Resolve backup configuration]
  B --> C[Prepare write repository]
  C --> D[Attach missing origin]
  D --> E[Commit encrypted snapshot]
  E --> F[Push through Git origin]
Loading

Technical review

Best possible solution:

Keep the focused ensureRepo change and validate destination exclusion, revocation, and existing-state compatibility through the production upload paths.

Do we have a high-confidence way to reproduce the issue?

Yes: main saves the requested remote but skips attaching it whenever .git already exists, and upload helpers require origin; no target code was executed during this review.

Is this the best way to solve the issue?

The implementation is the smallest complete source fix: it uses the existing write-repository owner, preserves existing origins, and leaves read preparation separate.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against ce1a8f519184.

Merge-risk options

Maintainer options:

  1. Validate destination authority before merging (recommended)
    The PR owner supplies a production-path trace showing uploads reach the selected origin, never reach a conflicting configured remote, and stop after both the saved destination and origin are removed, including later checkpoint retry dispatch.

Provenance checked

  • Write repository preparation keeps the original intent (e49e9f4: The initial encrypted-backup implementation reused existing repositories and pulled them; the later read-command separation preserved this write owner.)
  • Explicit remote setup and existing-origin preservation keeps the original intent (fix(backup): keep backups local until a remote is configured #1303: Make new backups local-only until a remote is configured while preserving explicit saved destinations and existing origins.)

Testing

Proof path: in-process harness.

Security

Needs attention: No concrete security defect was found, but persistent upload-destination authority still needs final-effect validation.

Evidence

What I checked:

  • Main retains the missing-origin path: The existing-repository branch returns through pullRepo without applying cfg.Remote; the PR adds five lines to that shared write owner. (internal/backup/git.go:30, e99ede3d9626)
  • Focused regression coverage: The added test initializes local state, attaches a real temporary bare Git remote, checks the pushed commit exists there, and verifies a later different remote does not replace origin; it stops before pushing after that conflicting selection. (internal/backup/backup_test.go:1075, e99ede3d9626)
  • Existing destination contract: The merged predecessor fix(backup): keep backups local until a remote is configured #1303 established local-only defaults while preserving explicit saved destinations and existing origins; this PR completes its documented remote-configuration path. (docs/backup.md:25, 330b98709934)
  • Destination reaches the final effect: Init saves resolved configuration before repository preparation; snapshot and checkpoint writes share ensureRepo, while synchronous and asynchronous uploads ultimately push through origin. (internal/backup/git.go:176, e99ede3d9626)
  • Policy and feature history: The complete root AGENTS.md applies; no nested AGENTS.md, maintainer notes directory, or pr-simplify skill exists. Feature history identifies the original backup implementation and later read/write separation and local-only changes. git log --follow encountered an unavailable historical object; the original implementation blob was independently readable. (AGENTS.md:1, ce1a8f519184)

Likely related people:

  • Peter Steinberger: Raw commit 330b987 adds internal/backup/git.go:161 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 330b98709934; files: internal/backup/git.go)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Change footprint Production +5 lines; tests +36 lines; documentation +5/-1 lines The change uses the existing repository owner and Git helpers, with focused coverage for attachment, upload, and origin preservation.

Labels

Label changes:

  • add P2: A documented advanced backup setup sequence fails to enable uploads; local commits remain available.
  • add merge-risk: 🚨 security-boundary: The change persists a configured upload destination, and final-effect exclusion and revocation evidence is not supplied.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P2: A documented advanced backup setup sequence fails to enable uploads; local commits remain available.
  • merge-risk: 🚨 security-boundary: The change persists a configured upload destination, and final-effect exclusion and revocation evidence is not supplied.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add final-effect proof for the conflicting destination and prove destination removal prevents subsequent snapshot and checkpoint retry uploads.
  • Show an upgrade from v0.47.1 with existing configuration, identity, and backup contents preserved.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 5, 2026, 1:53 PM ET / 18:53 UTC.

@steipete
steipete merged commit 5a36a35 into main Nov 5, 2026
18 checks passed
@steipete
steipete deleted the fix/gog-round19-backup-remote branch November 5, 2026 18:55
@steipete

steipete commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

The local-to-remote setup path is now complete in #1304, merged as 5a36a35. After local initialization, gog backup init --remote URL adds origin only when missing. Existing origins remain unchanged.

The regression first reproduced the missing-origin failure, then passed for initial remote configuration, pushing to a temporary bare repository, and preserving an existing origin. Full make ci, independent P0–P2 review, and exact-head Linux/minimum-Go/macOS/Windows/worker/Docker/CodeQL checks passed: https://github.com/openclaw/gogcli/actions/runs/42086419098. No real backup or personal configuration change was performed.

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

Labels

merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant