Skip to content

test(code-index): fence the expired-proof read with the scheduler - #1867

Merged
ScriptedAlchemy merged 1 commit into
masterfrom
fix/reconcile-expired-proof-fence
Sep 19, 2026
Merged

ScriptedAlchemy merged 1 commit into
masterfrom
fix/reconcile-expired-proof-fence

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

long_text_projection_renews_source_before_seating_and_noop_follow_up_settles failed TRY 1 and passed TRY 2 on master run 35462174752's predecessor at 17:31 UTC and again on PR #1807's run 35465539562. The nextest ci profile marks that red.

The test ages the source proof and reads it back, expecting the read to decline. The fence it held was the background admission permit plus the pass counter. Neither closes the window: the worker releases the permit after source reconciliation and drops its pass guard before the graph tail, and the tail's two renewing steps take a guard only once a blocking thread reaches their closure. On a loaded box the test settled inside that gap, aged the proof, and the tail renewed it before the read.

Every renewing step takes the worktree's scheduler mutex and no read does, so the test now holds that mutex across the aging and the read through a new cfg(test) accessor. Production code is unchanged.

Reproduced under CPU contention (two spinners and the test pinned to the same two cores) at 4 failures in 30 runs before the change and 0 in 100 after, run twice. Forcing the elapsed arm of snapshot_is_recently_verified true makes the test fail at the same assertion, so it still detects a served expired proof.

Two other tests in the same module, reopened_current_text_generation_resolves_publication_identity_without_graph_seat and resident_memory_graph_refusal_seats_text_serving_without_graph, fail together about one run in four under the same contention on unmodified master. They are not touched here and need their own fix.

🤖 Generated with Claude Code

The admission permit and pass counter both read idle between the
worker dropping its pass guard and the graph tail picking up its own,
so a renewal already committed to run re-proved the aged source before
the test read it. Hold the scheduler mutex, which every renewing step
takes and no read does, across the aging and the read.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Sep 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a2fdc56

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 19, 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-19T20:59:46.215738Z a2fdc56 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: a2fdc566cf

ℹ️ 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 on lines +561 to +564
pub(crate) async fn scheduler_for_root(
&self,
project_root: &Path,
) -> Option<Arc<std::sync::Mutex<super::super::CodeIndexWorktreeSchedulerV1>>> {

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 Reuse the existing scheduler_handle accessor

CodeIndexSchedulerRegistryV1::scheduler_handle in registry.rs already canonicalizes the root and clones the same Arc<Mutex<CodeIndexWorktreeSchedulerV1>>, and it is enabled under cfg(test). Adding this identical accessor creates a second test-only registry surface that can drift from the existing authority; call scheduler_handle from hold_scheduler_for_root and remove this duplicate.

AGENTS.md reference: AGENTS.md:L124-L130

Useful? React with 👍 / 👎.

@ScriptedAlchemy
ScriptedAlchemy merged commit a02e628 into master Sep 19, 2026
25 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