Skip to content

Log redacted Codex registry mutations - #989

Merged
Finesssee merged 1 commit into
mainfrom
port/codex-registry-logs
Oct 23, 2026
Merged

Finesssee merged 1 commit into
mainfrom
port/codex-registry-logs

Conversation

@Finesssee

@Finesssee Finesssee commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a diagnostic log line for each write to the managed Codex account registry, so a saved account that disappears can be traced to an add or re-auth, a removal, or another registry write.
  • Each line carries only a fixed operation name, the row count before the write, the row count requested, the row count written, and success or failure.
  • A successful deletion of a managed account home directory logs the operation name only.
  • No account IDs, emails, paths, tokens or error text are logged. The field construction lives in a pure helper (rust/src/codex_accounts/registry_log.rs) with unit tests that fail if a path, identifier, email or token fragment appears in the output.
  • Windows-applicable port of upstream bcc4c56 (feat(codex-accounts): log redacted registry mutations for account-loss diagnosis steipete/CodexBar#4699). Upstream's promotion operations are not ported, because the Windows port has no promotion flow. Upstream tags each mutation with a task-local value; the Windows port passes the operation explicitly as an argument instead.
  • Operation mapping: add and re-auth log add-or-reauth, account removal logs remove, and every other registry write logs registry-write.

Upstream references:

  • Sources/CodexBarCore/ManagedCodexAccountStore.swift (hunks at old lines 27, 73 and 87): the Mutation enum, the registry-write log fields operation, rows.before, rows.requested, rows.written, and logHomeDeletion.
  • Sources/CodexBar/ManagedCodexAccountService.swift (hunks at old lines 296 and 326): add and remove paths set the mutation.

Files changed:

  • rust/src/codex_accounts/registry_log.rs (new): operation enum, pure field builder, logging helpers, unit tests.
  • rust/src/codex_accounts/stores.rs: AccountStore::save delegates to a new save_with_operation, which counts existing rows, writes, and logs.
  • rust/src/codex_accounts/account_manager.rs: logs a home deletion after a failed add is torn down and after a removal deletes a managed home.
  • rust/src/codex_accounts/mod.rs: module wiring and re-export of RegistryOperation.
  • apps/desktop-tauri/src-tauri/src/commands/codex_accounts.rs: add and re-auth pass AddOrReauth, remove passes Remove, other saves pass RegistryWrite.

Checks

  • cargo fmt --all: clean.
  • cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings: passes.
  • cargo clippy --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml --all-targets -- -D warnings: passes.
  • cargo test --manifest-path rust/Cargo.toml --lib codex_accounts: 74 passed, 0 failed. Includes the 4 new registry_log tests.
  • cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml codex_accounts: 19 passed, 0 failed.
  • cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml (full): 804 passed, 0 failed, plus the 19 above in the same crate.
  • cargo test --manifest-path rust/Cargo.toml --lib (full): 5265 passed, 18 failed on the first run. All 18 were providers::grok::acp::process_tests, which need examples/fake_grok_acp built. cargo test --lib does not build examples, so the first run was missing the binary. After cargo build --manifest-path rust/Cargo.toml --example fake_grok_acp, cargo test --lib grok::acp passes 41 of 41.

Not covered:

  • No desktop app launch or UI proof. This change has no UI surface; it only adds log lines.
  • The log lines were not inspected in a running app. The tests check the field values, not the tracing output.

Summary by CodeRabbit

  • Improvements
    • Account addition, reauthentication, removal, and loading continue to use the existing account-management flows. Registry updates now record operation status and account counts, with sensitive details omitted from those records.
  • User-Facing Changes
    • No changes to account-management behavior or interface are noted in this update.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 96d5531 and df976f1.

📒 Files selected for processing: 5
  • apps/desktop-tauri/src-tauri/src/commands/codex_accounts.rs
  • rust/src/codex_accounts/account_manager.rs
  • rust/src/codex_accounts/mod.rs
  • rust/src/codex_accounts/registry_log.rs
  • rust/src/codex_accounts/stores.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Walkthrough

Account registry writes now carry operation labels and log row counts and outcomes. Account command flows assign labels for add or reauthentication, removal, and routine writes. Successful managed-home deletions also emit operation-tagged logs.

Changes: Account Registry Logging

Layer / File(s) Summary
Registry log records and operation labels
rust/src/codex_accounts/registry_log.rs, rust/src/codex_accounts/mod.rs
The registry module defines fixed operation names and logs write counts and outcomes, plus successful managed-home deletions. Tests check the permitted values and count formats.
Account store write logging
rust/src/codex_accounts/stores.rs
save delegates to save_with_operation with RegistryWrite. The new method captures available prior counts, writes the account file, logs the result, and returns the write result.
Operation tags in account flows
apps/desktop-tauri/src-tauri/src/commands/codex_accounts.rs, rust/src/codex_accounts/account_manager.rs
Add and reauthentication writes use AddOrReauth; removal writes use Remove; fetch and default persistence use RegistryWrite. Successful managed-home deletions log their operation. Authentication errors remain unchanged after best-effort cleanup.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Suggested reviewers: blazzzplay

Merge Risk: ⚪ Minimal · up to df976

No actionable issue is established for this change. Normal validation, including checking log output in a running app, remains appropriate.

Pre-merge checks: Passed 8
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title is a short imperative summary that accurately describes the main change: adding redacted logs for Codex registry mutations.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Provider Data Stays Siloed Passed The changed code adds only redacted Codex registry diagnostics and operation tagging. registry_log.rs emits fixed operation names, numeric row counts, and fixed result values; home-deletion logs emi…
Secrets Handled Safely Passed The new tracing events emit only fixed operation names, numeric row counts, and static success or failure values. They do not format account data, paths, errors, tokens, cookies, API keys, or authoriz…
No Unapproved Dependencies Passed The pull-request diff changes only five Rust source files. It does not change any Cargo.toml, package.json, npm/yarn lockfile, or pnpm packageManager setting. No dependency addition requires maintaine…
Ui Changes Include Windows Proof Passed PASS: The diff changes only Codex account persistence and redacted tracing diagnostics. It does not change files under apps/desktop-tauri/src, tray rendering, the float bar, settings, or window chro…
Full details: Provider Data Stays Siloed

Explanation

The changed code adds only redacted Codex registry diagnostics and operation tagging. registry_log.rs emits fixed operation names, numeric row counts, and fixed result values; home-deletion logs emit only the operation. stores.rs passes only account counts to the logger, and no identity, plan, label, email, path, token, or provider-specific data is added to logs or storage. The diff adds no cross-provider branching or matching on ProviderId in shared code.

Full details: Secrets Handled Safely

Explanation

The new tracing events emit only fixed operation names, numeric row counts, and static success or failure values. They do not format account data, paths, errors, tokens, cookies, API keys, or authorization headers. Account persistence still uses secure_file, and the new save_with_operation does not alter credential-file writes. Home deletion behavior was pre-existing and remains restricted to app-owned managed homes; the PR only adds a fixed-operation log after an explicit removal or failed add cleanup.

Full details: No Unapproved Dependencies

Explanation

The pull-request diff changes only five Rust source files. It does not change any Cargo.toml, package.json, npm/yarn lockfile, or pnpm packageManager setting. No dependency addition requires maintainer approval.

Full details: Ui Changes Include Windows Proof

Explanation

PASS: The diff changes only Codex account persistence and redacted tracing diagnostics. It does not change files under apps/desktop-tauri/src, tray rendering, the float bar, settings, or window chrome. The PR description also states that the change has no UI surface.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Finesssee
Finesssee merged commit 972dc64 into main Oct 23, 2026
4 checks passed
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