Skip to content

[WRONG BRANCH] fix(codex): preserve legacy history manifest job targets - #528

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-history-manifest-issue
Draft

luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-history-manifest-issue

Conversation

@luvs01

@luvs01 luvs01 commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Normalizing Win32 extended-length prefixes changed the canonical backup filename for some state DB paths and caused production history jobs to pass a canonical-only path to Workers, which bypassed the provider's legacy manifest fallback and made pre-upgrade manifests unreachable.
  • The intent is to preserve existing on-disk manifests written under the pre-normalization identity so upgrades do not lose recoverability for Windows installations that recorded the extended-length prefix.

Description

  • Use the provider's canonical-first, legacy-fallback resolver by calling resolveExistingHistoryBackupPath(stateDb) when resolving a history job target in src/codex/history-job.ts instead of emitting the canonical-only historyBackupPathFor value.
  • Add a Windows regression test that exercises an extended-length-prefixed CODEX_SQLITE_HOME and asserts the job target preserves a pre-normalization legacy manifest in tests/codex-integration/codex-sqlite-home.test.ts.
  • Update the existing call-time unit test to assert the job target uses resolveExistingHistoryBackupPath.
  • Sync documentation notes in structure/* to record that Worker job targets preserve the canonical-first legacy-manifest fallback across the Worker boundary.

Testing

  • Ran node_modules/.bin/bun test tests/codex-integration/codex-sqlite-home.test.ts which passed (6 tests) with one Windows-only test skipped on Linux.
  • Ran node_modules/.bin/bun test tests/codex-integration/codex-history-provider.test.ts which passed (92 tests).
  • Ran node_modules/.bin/bun run structure:check and node_modules/.bin/bun run typecheck, both of which succeeded.
  • node_modules/.bin/bun run test:changed could not run in this checkout because a comparison dev ref was unavailable, and an initial bun binary mismatch in the environment required using the repository-installed Bun to run the tests successfully.

Codex Task

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 79a95628-f36c-4230-8f5a-db42490d1d25


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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 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-09-14T01:04:15.498428Z db0b5bb 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: db0b5bb931

ℹ️ 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/codex/history-job.ts
// Resolve through the provider's canonical-first compatibility rule. Passing
// only the newly normalized name would hide a pre-#4442 Windows manifest from
// the Worker and make an upgrade look like an empty backup.
canonicalBackupPath: resolveExistingHistoryBackupPath(stateDb),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Resolve the manifest only after acquiring the history lock

On affected Windows homes, this existence-based choice is made before the Worker acquires withHistoryWriteSerialization; if another history job removes the legacy manifest or publishes the canonical one while this job waits, the frozen target becomes stale. A restore or migration can then read an empty/stale legacy path and report zero-row convergence even though the canonical manifest still owns pending entries. Resolve or revalidate the canonical/legacy choice inside the locked Worker callback, while still passing enough explicit path context to avoid ambient-environment drift.

Useful? React with 👍 / 👎.

@github-actions

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Sep 14, 2026
@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown

⏳ DRAFT

  • wrong target branch (main); retarget to dev.

What to do

  • Retarget this PR to dev — all contributions go to dev.

Its title has been prefixed with [WRONG BRANCH].
This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@github-actions github-actions Bot changed the title fix(codex): preserve legacy history manifest job targets [WRONG BRANCH] fix(codex): preserve legacy history manifest job targets Sep 14, 2026
@github-actions
github-actions Bot marked this pull request as draft September 14, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant