Skip to content

Fix atomic reindex repair metadata after PR 86 - #89

Merged
BigSimmo merged 1 commit into
mainfrom
codex/pr86-cleanup
Jun 28, 2026
Merged

Fix atomic reindex repair metadata after PR 86#89
BigSimmo merged 1 commit into
mainfrom
codex/pr86-cleanup

Conversation

@BigSimmo

Copy link
Copy Markdown
Owner

Summary

  • mark freshly committed atomic reindex generations as pending for the v3 repair agent before the commit window closes
  • keep the final completed metadata path intact
  • add a worker visual-capture regression assertion for the early core-index repair reason

Verification

  • npx vitest run tests/worker-visual-capture.test.ts
  • npm run typecheck
  • npm run verify:cheap
  • npm run check:production-readiness (blocked in this isolated worktree: missing NEXT_PUBLIC_SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY, OPENAI_API_KEY)

No dependency versions were changed.

@chatgpt-codex-connectorchatgpt-codex-connectorBot 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:9759c55c5e

ℹ️ 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 threadworker/main.ts
Comment on lines +1545 to +1548
indexing_v3_agent_status: "pending",
indexing_v3_agent_last_error: coreAgentMessage,
indexing_v3_agent_repair_reason: "core_index_committed",
indexing_v3_agent_updated_at: indexedAt,

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 Reset stale v3 retry state for fresh generations

When atomically reindexing a document whose existing metadata has an exhausted indexing_v3_agent_attempt_count/indexing_v3_agent_max_attempts pair or a future indexing_v3_agent_next_run_at, this new pending marker still inherits those stale fields from job.documents.metadata; claim_indexing_v3_agent_jobs filters on attempt_count < max_attempts and next_run_at <= now, so if the worker stops after the core-generation commit, the fresh generation remains unclaimable despite being marked pending. Clear/reset the retry and schedule fields alongside the fresh pending status.

Useful? React with 👍 / 👎.

Comment threadworker/main.ts
Comment on lines +1545 to +1548
indexing_v3_agent_status: "pending",
indexing_v3_agent_last_error: coreAgentMessage,
indexing_v3_agent_repair_reason: "core_index_committed",
indexing_v3_agent_updated_at: indexedAt,

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 Delay v3 agent visibility until metadata rewrites finish

When the cron claims this document after commitDocumentIndexGeneration returns but before processJob reaches the later whole-metadata updateDocument (especially while WORKER_INLINE_ENRICHMENT=true is still enriching), claim_indexing_v3_agent_jobs can set the v3 agent lock/status to processing; the local worker then writes its precomputed finalMetadata and erases that lock/attempt state, allowing the same document to be claimed again while local and edge enrichment race over the same artifacts. Avoid making the row claimable until the local worker is done rewriting metadata, or preserve any intervening agent claim.

Useful? React with 👍 / 👎.

@BigSimmo
BigSimmo merged commit c03b029 into mainJun 28, 2026
4 checks passed
@BigSimmo
BigSimmo deleted the codex/pr86-cleanup branch June 29, 2026 04:29
Sign up for freeto 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

@BigSimmo