Skip to content

perf: harden sync planning and journal throughput - #76

Merged
Dailin521 merged 5 commits into
mainfrom
codex/v0.4.1-performance-hardening
Aug 7, 2026
Merged

perf: harden sync planning and journal throughput#76
Dailin521 merged 5 commits into
mainfrom
codex/v0.4.1-performance-hardening

Conversation

@Dailin521

Copy link
Copy Markdown
Owner

Summary

  • reuse validated Windows journal leases and avoid repeated whole-journal reads on normal append paths
  • merge rollout content scans and reuse immutable hashes for plan preview while preserving checked-apply revalidation
  • cache backup inventory size/file-count metadata for faster status and prune reporting
  • add controller/UI metric formatting and focused performance, recovery, and parity coverage

Validation

  • dotnet test CodexProviderSync.sln --configuration Release --no-build — 380 passed, 1 skipped
  • npm test — 208 passed
  • real isolated Windows Automation and Node CLI switch/restore runs over 824 rollout files / ~2.33 GB, with committed journals and restored dal alignment

Safety

  • no credentials were copied into the test fixtures or backups
  • src/cli.js remains an unrelated local working-tree change and is intentionally excluded

@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: c2e0646fc7

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

Comment thread desktop/CodexProviderSync.Core/BackupService.cs
Comment thread desktop/CodexProviderSync.Core.Tests/CoreIntegrationTests.cs Outdated
@Dailin521

Copy link
Copy Markdown
Owner Author

@codex 重新审查

@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: f487720a43

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

Comment thread desktop/CodexProviderSync.Core/CodexSyncService.cs Outdated
Comment thread desktop/CodexProviderSync.Core/SessionRolloutService.cs
Comment thread desktop/CodexProviderSync.Core/CoreWritePlanning.cs
Two regressions from this branch's sync hardening.

A rollout that grows while its content digest is being folded threw
CoreWritePlanStaleException out of CollectSessionChangesAsync. The
skipLockedReads catch filters only match busy and unreadable I/O errors, so
an ordinary unchecked sync aborted entirely instead of skipping the file an
active Codex session is appending to. Report it as a locked rollout when
skipLockedReads is set, matching the documented partial-success contract, and
keep throwing on the strict path where a stale hint must not be cached.

Refreshing the backup inventory ran unguarded right after the journal reached
committed. Because the outer handler rethrows once transactionCommitted is
set, a failed metadata.json write reported a fully durable sync as failed and
skipped automatic backup pruning. Degrade it to a warning on both the sync and
restore paths, in Core and in the Node service.

Adds a scan-phase test seam so the mid-scan mutation is exercised
deterministically, and covers both fixes on both implementations.

@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: 54fc74263c

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

Comment thread src/service.js
Comment thread desktop/CodexProviderSync.Core/CodexSyncService.cs
Second review round on the backup inventory work, plus the folder-open
false error.

Rollback paths left metadata.json stale. RolledBackAsync and
RecoveryRequiredAsync append journal records into the retained backup
after its inventory was written, and GetBackupDirectorySize trusts the
recorded sizeBytes unconditionally, so status and pruning read a size
and file count that no longer match disk. Both rollback exits now
refresh the inventory, swallowing any failure so the original sync
error and its rollback details reach the caller unchanged.

The Node CLI dropped restore's backupInventoryWarning, silently hiding
a warning the service already produced.

OpenPath treated a null Process as a failure. With UseShellExecute the
shell may satisfy the request through a process it already owns -
Explorer reusing an open window is the common case - and then returns
no handle even though the path opened, so the folder opened while the
GUI reported "Unable to open". A genuine failure still surfaces as
Win32Exception, and OpenBackupFolder now reports it the same way
OpenLogFolder does instead of escaping to the message loop.

@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: 62c4bf287f

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

Comment thread test/sync-service.test.js Outdated
The chmod(0o444) fault only works when the suite runs as a user that
Unix permission bits actually constrain. As root the atomic metadata
rewrite succeeds, backupInventoryWarning stays undefined and the test
fails, which is what happens in the repository container.

runRestore now accepts a faultInjector and threads it into the
post-restore refresh, matching how runSync already exposes one, so the
test drives the failure through a deterministic seam.
@Dailin521
Dailin521 merged commit 7927cb2 into main Aug 7, 2026
8 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