Skip to content

Use a deterministic clock in the benchmark TTFT test - #3783

Merged
ashhart merged 2 commits into
ashhart:mainfrom
AIflow-Labs:codex/stabilize-cache-ttft-test
Nov 19, 2026
Merged

ashhart merged 2 commits into
ashhart:mainfrom
AIflow-Labs:codex/stabilize-cache-ttft-test

Conversation

@AIFlowML

@AIFlowML AIFlowML commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

The TTFT unit test added synthetic arrival offsets to a real send timestamp and allowed floating-point rounding to determine whether its exact three-second assertion passed. Pin the test's send clock and require a nonempty result set before checking every row. The test still distinguishes first content from response headers and role or usage frames.

  • Issue Fixes Benchmark TTFT fixture can fail depending on the clock origin #3779. It includes a deterministic reproduction and links to both failed CI jobs.
  • Stacked on main at 8cbef9777b9a05dfaff99d5aa9c2ce52fe2b00f8.
  • Overlap ATC reported zero conflicts on 18 November UTC with capped discovery. The paginated file audit of 455 open PRs found no shared changes to the test file. Test merges with main and all 24 pending AIFlowML heads were clean.

Checks on this head

  • Head commit b7c22f8593c9035fd572d2f0fd8825a558f56c83.
  • Preflight 221 inherited lean findings on base and head, zero new. Formatting and whitespace checks passed.
  • Deterministic control Forcing the old fixture's ambient clock origin to 1.1 fails the exact assertion. It passes with the patched fixture. A planted change to measure from headers still fails the test.
  • Benchmark checks M5 Max and Python 3.11.14 passed all 31 cache-agent tests and 32 evidence tests. Olares x86-64 Linux, Python 3.14.4, passed all 180 benchmark tests and 32 evidence tests. These were model-free checks.
  • Broader Mac checks With Python 3.11.14, both clean main and this head's root pytest run had 553 passes, 103 skips and the same 14 failures by test name. Eleven are separate loopback conformance fixture failures, one is an existing sandbox fixture failure, and two are existing Zig cache fixture failures. The full Mac benchmark command reports those same 11 conformance failures. The affected TTFT test passed.
  • CI All 9 applicable upstream checks passed on this head. Two scheduled nightly jobs were skipped.
  • Not run Windows and inference hardware. The change affects one Python test.

Receipt

N/A. This change pins the clock inside a benchmark test fixture.

Checklist

  • Title, description, test receipt and head agree.
  • The test fails as planted before the change and passes on this head.
  • Source and public identity checks passed.

Igor Lessio - AIFLOW LABS

@ashhart

ashhart commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Thanks @AIFlowML. This is a clear fix.

  • With a real send time, the old test compared (sent + 3) - sent to exactly 3. That depends on the clock value: for example, (1.1 + 3) - 1.1 gives 2.9999999999999996. Pinning perf_counter to 10.0 makes the comparison exact.
  • The new assertTrue(report["rows"]) stops the all(...) check from passing on an empty report.
  • The test still checks that TTFT starts at content, not at headers, the role frame or usage.

The diff applies cleanly to current main, and the test file passes 31/31 with it. No changes requested from our side.

  • Synthena

@ashhart
ashhart force-pushed the codex/stabilize-cache-ttft-test branch from b7c22f8 to 3d320e3 Compare November 19, 2026 00:02
@ashhart
ashhart merged commit 6fdc313 into ashhart:main Nov 19, 2026
2 of 11 checks passed
@ashhart

ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Thank you @AIFlowML. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

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.

Benchmark TTFT fixture can fail depending on the clock origin

2 participants