Raju Dandigam’s DEV article Retrieval Ran First. Was Its Result Actually Ready? uses a controlled promise to test what an agent trace can say about dependencies. Dandigam maintains AgentInspect and ran the fixture against version 6.31.35. The generation step returns a fixed answer, so the experiment needs neither a model call nor a live search service.
Hold the result open until generation starts
A sleep can make a race intermittent. The fixture gives retrieval a promise that only the test can resolve. It starts retrieval, runs the generation step, then releases the promise. The trace therefore records retrieval first even though generation never had access to the result. The first-occurrence check passes while both the happens-before and all-occurrences checks fail for this fixture.
The positive control changes the application dependency by awaiting retrieval before invoking generation. That version passes the tested all-occurrences check. Together the fixtures distinguish a recorded start order from an actual completion boundary. The article marks the TraceContract interface as beta and its ordering relations as experimental in the tested release.
Scope the check to the result the application needs
The article’s two-turn example shows why a single global ordering rule can be too broad. A sequence of retrieve, generate, retrieve, generate can satisfy both turn-level dependencies while failing a rule that puts every retrieval ahead of every generation. Separate runs or application-owned result references give a test a way to associate an answer with its own retrieval.
Completion needs its own check as well. In the companion fixture, an early generation remains pending and a later one finishes. The isolated all-occurrences rule passes, while the contract with run completion enabled fails. A test for real generation can also compare the bounded reference produced by retrieval with the reference passed downstream. That establishes wiring. Assessing whether the answer used the evidence correctly calls for a separate check.