A workspace cargo test with COSI_CORPUS_DIR set indexes all nine corpus checkouts in place, which turns every corpus gate red #314
Labels
No labels
code-review
correctness
dos
performance
security
severity/high
severity/low
severity/medium
tech-debt
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
h-dv/code-index#314
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Observed (2026-10-05, v0.33.0 release candidate
8879fd84). The local full gate run exportedCOSI_CORPUS_DIR=$HOME/.cache/cosi-corpusfor every step, includingcargo test --workspace. CI never does that: only the corpus jobs set the variable.At 06:37:19–06:37:23Z, a
.code-index/directory appeared in all nine pinned checkouts (cs-dapper … ts-zod), during the workspace run. As a result:crates/indexer/tests/corpus/mod.rs:263) refused every corpus suite;query_cli::the_cli_log_level_reaches_the_spawned_serveransweredwarming_up, because indexing Django and rust-analyzer in the background starved it. It passes 20/20, three times, on a quiet machine.Cause.
code-index-mcphonoursCOSI_CORPUS_DIR(#191 corpus links). It links each pinned repo as a project and indexes it IN PLACE, so its state lands in the checkout.tests/support/mcp.rsscrubs the variable, but at least one other spawner of the server does not. Candidates that spawncode-index-mcpwithoutenv_remove("COSI_CORPUS_DIR"):crates/daemon/tests/common/mod.rsmcp_smoke.rswarmup_e2e.rsworkspace_e2e.rsharness_store_isolation.rscli/tests/blast_radius_hook.rsThese were not yet bisected.
Why it matters. CLAUDE.md tells developers to run the corpus gates with
COSI_CORPUS_DIRset. Anyone who also has it exported in their shell, or runs the workspace and corpus gates together, gets a corpus that every gate refuses. Without the corpus guard, they would get silently skewed numbers instead.Fix shape (structural, not per test). Every test spawn of the server should go through one helper that scrubs
COSI_CORPUS_DIR, with a registry test that fails when a test spawnsCARGO_BIN_EXE_code-index-mcpsome other way. Optionally, corpus links could keep their index state outside the checkout.Found during the v0.33.0 full gate run. It does not block the release, because CI's test job does not set the variable.
Now breaks CI, not just local runs. Nightly run 5754 (master
407c4925), job "Plugin path cost + pool throughput (nightly)": all 4language_package_overheadtests stopped at the corpus guard (crates/indexer/tests/corpus/mod.rs:263):Source: the step right before it,
python3 tests/phase2_acceptance.py --bin-dir target/phase2-packages-only/release …(ci.yml ~1599).COSI_CORPUS_DIR: /tmp/cosi-corpus(ci.yml ~1548).code-index-mcpit spawns links every corpus repo (#191) and indexes them in place.Fix in progress with #318 phase 2:
COSI_CORPUS_DIRfrom its children, and the step runs with it unset.code-index-mcpgoes through one scrubbing helper.A local reproduction of CI's corpus job (2026-10-07, on the zammad-fixes integration branch) left
.code-index/directories in three corpus checkouts: cs-dapper, python-flask and rust-ripgrep.mcp agent_task_bench. ci.yml's corpus job setsCOSI_CORPUS_DIRat job level, and this suite spawns the MCP server with it. The integration lane attributed the directories to it.code_index_test_support::product::commandand themcp_spawn_registryguard. Eitheragent_task_benchdoes not go through that spawn path, or it indexes the corpus on purpose./tmp/cosi-corpus. Those directories are what the corpus contamination guard refuses on later runs that share the cache.Verified the structural fix and the remaining benchmark contamination path are already shipped in v0.41.34; the relevant source is byte-identical at current candidate
d641f8ec.code_index_test_support::product::command, which removes the exact corpus variable the server reads. The registry currently scans 593 sources and identifies 23 sources reaching the MCP server; all three permanent registry checks pass.env_removein a private copy makes both the permanent helper check and the actual-child check fail. No repository source was changed.agent_task_benchpath now creates a disposable shared Git clone, checks out the pinned oracle revision there, and indexes a database under its temporary directory. Published qualification job 60198 ran all three real repositories (cs-dapper, python-flask and rust-ripgrep); all five benchmark tests passed. The full Linux qualification passed 5,355 tests.Closing the original inherited-environment and benchmark-in-place defects with verified shipped behavior. No extra CI run or production change was needed. Local receipt:
/tmp/cosi-314-verification.json.