Skip to content

fix(setup): preserve initial backups and Codex comments - #1204

Merged
N0zoM1z0 merged 1 commit into
mainfrom
fix/setup-initial-backup-retention
Oct 9, 2026
Merged

N0zoM1z0 merged 1 commit into
mainfrom
fix/setup-initial-backup-retention

Conversation

@N0zoM1z0

@N0zoM1z0 N0zoM1z0 commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #1163 and #1178. Uninstall still discarded comment-only Codex configuration and overwrote the original .rea.backup with the installed registration, making the first configuration snapshot unavailable.

Preserve Codex comments when removing or replacing REA tables and keep the first backup across setup, uninstall, and later setup. A failed uninstall restores the captured current configuration while retaining that original backup. Other TOML clients keep their existing editing behavior.

Validation:

  • Latest-main reproduction: seven regression cases fail before this change; four controls pass.
  • 125 focused tests pass, including quoted/dotted/inline TOML, BOM/CRLF, malformed input, idempotency, adjacent client formats, and failed-write recovery with an older backup.
  • npm run build:cached and npm run check:fast pass.
  • Full node scripts/verify-package.mjs passes against the installed tarball: CLI/MCP, four clients, exact Codex text round trip, initial backup retention, symlinks, and failure recovery; no surviving verifier descendants. Run with a temporary root outside the repository and no injected Ghidra/IDA configuration.

Configuration-only change. Real Hopper/Ghidra execution was not performed for this PR; packaged provider checks use the existing verifier fixtures.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 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-10-09T04:49:05.498499Z 99fe64a 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 99fe64ac48

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"failed",
"Configuration could not be backed up, so no change was made. Check file permissions, then rerun uninstall.",
);
if (!(cause instanceof Error && "code" in cause && cause.code === "EEXIST"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep a current recovery copy before uninstalling

When setup has already created .rea.backup, this EEXIST path proceeds without preserving the configuration captured in original. If uninstall then updates the file but its restoration also fails, the remediation at line 321 points to a pre-setup snapshot that omits any settings the user changed afterward, so following it can lose those changes. Preserve the first snapshot separately while creating a fresh uninstall-recovery copy, or fail before mutation when the current state cannot be recovered.

AGENTS.md reference: AGENTS.md:L7-L12

Useful? React with 👍 / 👎.

Comment on lines 834 to +836
* Replace REA's TOML server tables and assignments. Comments that introduce a
* following table stay. Text inside strings is not treated as a header. Only
* Grok Build reads the root `disabled_mcp_servers` list that registration
* also edits.
* following table stay. Codex also retains comments around REA's own table.
* Text inside strings is not treated as a header. Only Grok Build reads the

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve inline comments on removed Codex statements

The new preservation behavior only retains standalone # lines. For a valid Codex entry such as [mcp_servers.rea] # local setup notes or command = "old" # explanation, the header and assignment branches discard the entire physical line, including the comment, during setup or uninstall. Retain the comment suffix before dropping those statements, or narrow this newly documented preservation guarantee.

AGENTS.md reference: AGENTS.md:L53-L57

Useful? React with 👍 / 👎.

@N0zoM1z0 N0zoM1z0 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed backup retention and rollback paths against the merged #1178 fix. All 125 focused tests, the installed-package lifecycle verifier, and all 22 final-head CI checks pass; comments, symlinks, and the first backup survive setup/uninstall. Ready to merge.

@N0zoM1z0
N0zoM1z0 merged commit 6051cb2 into main Oct 9, 2026
22 checks passed
@N0zoM1z0
N0zoM1z0 deleted the fix/setup-initial-backup-retention branch October 9, 2026 04:57
darsrc pushed a commit to darsrc/rea that referenced this pull request Oct 10, 2026
@morluto morluto added bug Something isn't working area: setup Setup, packaging, upgrade, install, Doctor, and client registration labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: setup Setup, packaging, upgrade, install, Doctor, and client registration bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants