Skip to content

test(code-index): wait for the worker's permit, not its phase - #4250

Merged
ScriptedAlchemy merged 1 commit into
masterfrom
fix/4238-source-hint-permit-order
Oct 18, 2026
Merged

ScriptedAlchemy merged 1 commit into
masterfrom
fix/4238-source-hint-permit-order

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Refs #4238

What was broken

source_hint_interrupts_attribution_and_owned_noop_retries_same_generation hung to the test timeout under parallel load.

Cause

The test waited for AwaitingAdmission, assumed the worker's permit request was then queued, and queued its own request behind it. The worker sets that phase before it first polls acquire_owned, and it runs on a native runtime thread, not the test's current-thread runtime. Traces from a hung run show the test's request polled and granted before the worker's first poll. The test then held that permit while waiting for the seat, and the seat needs the worker's pass, which needs the permit.

Fix

Release the test's permit and wait until available_permits() reads 0. Only the worker holding the permit can cause that, so the test's request then queues behind the source pass and ahead of the optional preparation, as the test intends. Test-only change.

Evidence

Same command before and after, 20 parallel jobs pinned to 8 cores: bazel test //crates/tracedecay-code-index-runtime:unit_test --test_arg=<module path>::source_hint_interrupts_attribution_and_owned_noop_retries_same_generation --test_arg=--exact --runs_per_test=40 --local_test_jobs=20 --test_timeout=60 --run_under=taskset -c 0-7

  • master f20e92b: TIMEOUT in 5 out of 40
  • this branch: 40 of 40 pass

rustfmt_check_2024 and --config=clippy on the crate pass.


Devin Review

The source-hint attribution test queued its own admission request once
the worker reported AwaitingAdmission, then held the granted permit
while waiting for the seat. The worker sets that phase before it first
polls its permit request, on another runtime thread. When the test's
request queued first it took the permit, and the worker that must seat
the generation waited on the test: a deadlock, 5 of 40 runs under load.

Release the only permit and wait until it is gone, which only the
worker holding it can cause, then queue behind that source pass.

Refs #4238
@changeset-bot

changeset-bot Bot commented Oct 18, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 96c7b45

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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@ScriptedAlchemy
ScriptedAlchemy merged commit c446ea0 into master Oct 18, 2026
10 of 20 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