openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Flaky test: memory_tree pipeline_status_reports_chunk_aggregates_after_ingest

Open senamakel opened this issue 6 months ago • 2 comments

Summary

The test openhuman::memory_tree::tree::rpc::tests::pipeline_status_reports_chunk_aggregates_after_ingest is flaky in CI. It intermittently fails with an assertion mismatch at src/openhuman/memory_tree/tree/rpc.rs:1137.

Evidence

  • Observed in PR #3182 CI run: https://github.com/tinyhumansai/openhuman/actions/runs/26856779545/job/79201663237
  • 10,951 tests pass; only this one fails non-deterministically
  • The PR changes are in agent_meetings domain — completely unrelated to memory_tree

Failure output

thread 'openhuman::memory_tree::tree::rpc::tests::pipeline_status_reports_chunk_aggregates_after_ingest' panicked at src/openhuman/memory_tree/tree/rpc.rs:1137:9:
assertion `left == right` failed

Impact

Blocks unrelated PRs from merging when the Coverage Gate depends on Rust Core Coverage (cargo-llvm-cov) passing.

Suggested fix

Investigate the assertion at rpc.rs:1137 for a race condition or ordering dependency. The test likely depends on timing or state that isn't deterministic in CI. Consider:

  • Adding explicit synchronization or ordering guarantees
  • Marking the test as #[ignore] with a TODO until fixed
  • Retrying the test in CI with --retry 1

senamakel avatar Jun 03 '26 01:06 senamakel

Resolved on `main` by PR #3264 ("fix(memory): group selector ingests by source scope"), commit `5f60b548` (2026-06-03 01:03 UTC). The relevant chunk in `src/openhuman/memory_tree/tree/rpc.rs` now accepts either `running` or `degraded` after ingest and tightens the `degraded` branch to assert `reason` contains `"semantic recall disabled"`:

match out.status.as_str() {
    "running" => assert!(out.reason.is_none()),
    "degraded" => assert!(
        out.reason
            .as_deref()
            .unwrap_or_default()
            .contains("semantic recall disabled"),
        "degraded status should explain semantic recall loss: {:?}",
        out.reason
    ),
    other => panic!("expected running or degraded after ingest, got {other}"),
}
assert!(!out.is_syncing);

Same root cause I documented over in #3273: `derive_pipeline_status` reads the process-global `SEMANTIC_RECALL_DEGRADED` flag set by `build_read_embedder` on its `NoProvider` branch without any lock, so `test_guard()` can't actually serialise against production code paths a parallel test happens to take.

I had a duplicate fix open at #3273; closing that in favour of the upstream version, which is strictly better. Feel free to close this issue — PR #3264 just didn't include a `Closes #3256` line in its body so it didn't auto-close on merge.

YOMXXX avatar Jun 03 '26 06:06 YOMXXX

@senamakel This is resolved on main by PR #3264 (commit 5f60b548, merged 2026-06-03).

The flaky test pipeline_status_reports_chunk_aggregates_after_ingest had a rigid assert_eq!(out.status, "running") at rpc.rs:1137. That fails non-deterministically because provider availability differs between CI and local — a completed ingest can land in running or degraded (semantic recall skipped). The root cause is the process-global SEMANTIC_RECALL_DEGRADED flag set by build_read_embedder without a lock, so test_guard() can't fully serialise against a parallel test path.

PR #3264 replaces the rigid assert with a match accepting both terminal, non-syncing states (running / degraded), preserving the aggregate-counter assertions. @YOMXXX confirmed and closed the duplicate fix #3273 in favour of this.

PR #3264 didn't carry a Closes #3256 line, so it didn't auto-close on merge. Closing manually as resolved.

oxoxDev avatar Jun 04 '26 06:06 oxoxDev