Full jcode-app-core --lib suite deadlocks at viewer_attach_reuses_live_owner_without_tracking_placeholder (pre-existing on v0.88.0)
Summary
The full jcode-app-core --lib test suite deadlocks deterministically at:
server::client_session::tests::concurrency::viewer_attach_reuses_live_owner_without_tracking_placeholderReproduces in both serial and parallel modes. This is pre-existing on v0.88.0 itself — it is not introduced by any downstream merge or fork patch.
Reproduction
Run the full library suite (not a filtered subset):
cargo test -p jcode-app-core --libThe run stalls at the test above. All threads are parked/sleeping and CPU usage is flat — a genuine deadlock, not a slow test. The blocked frame is a park inside reqwest::blocking::ClientHandle::new.
Provenance (three trees, identical harness)
| Tree | Full-parallel result | Signature | Target test stuck? |
|---|---|---|---|
Upstream v0.88.0 (ee4cd3db3) alone |
deadlock @ ok=283 |
reqwest::blocking::ClientHandle::new park |
yes |
Downstream fork pre-merge (115170054) |
2-test pair EXIT=137 |
same | yes |
Downstream merge of v0.88.0 |
deadlock @ ok=286 |
same | yes |
Control: running the target test alone in the same trees exits 0. So the target test is healthy in isolation and is killed only by contamination from other tests in the same process.
Bisection
Two tests in agent::tests are each independently sufficient to deadlock the target:
agent::tests::agent_drop_removes_its_configured_session_tool_policyagent::tests::agent_clear_moves_tool_policy_registration_to_new_session
Both mutate the global SESSION_TOOL_POLICIES static and swap JCODE_HOME via env. Either one alone reproduces the hang against the target test.
A skip-2 full serial run still deadlocked, so more contaminating tests exist beyond these two — this is a class of isolation bug, not a single pair.
No fork-added reqwest::blocking call sites reach this path; the call is reached transitively from code that is identical across both parents.
Suggested direction
Global-state pollution between the agent::tests module and the server tests, combined with a blocking reqwest client created while another test holds a lock the request path needs. Candidates:
- Scope
SESSION_TOOL_POLICIESand theJCODE_HOMEenv swap per-test (e.g. a lock held across the test, or thread-local state) soagent::testscannot mutate process-global state observed byservertests. - Avoid creating a
reqwest::blockingclient inside the test process —reqwest::blockingspawns a runtime thread and can deadlock when the pool is already parked or when the process is under test harness contention. - Audit remaining tests for the same
JCODE_HOME/global-static mutation pattern; the skip-2 result shows the pair above is not the whole set.
Impact
CI is unaffected today because .github/workflows/ci.yml never runs the full jcode-app-core --lib suite — it runs only filtered gates (retention_readiness, tool::bash::tests::test_stdin_forwarding) plus --no-run compile checks. That means the suite-wide deadlock is invisible to CI, but it blocks any contributor who runs the full suite locally.
Environment
- macOS (aarch64), Rust nightly toolchain
- Reproduced with
--test-threads=1(serial) and default (parallel) - Machine load does not affect reproduction; CPU goes flat on hang
Source: 1jehuang/jcode