Skip to content

fix(benchmark): install the authorities the observation path needs - #723

Merged
ScriptedAlchemy merged 2 commits into
codex/tracedecay-total-redesign-plan-reopenedfrom
claude/fix-test-linux-benchmark
Aug 25, 2026
Merged

fix(benchmark): install the authorities the observation path needs#723
ScriptedAlchemy merged 2 commits into
codex/tracedecay-total-redesign-plan-reopenedfrom
claude/fix-test-linux-benchmark

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Fixes Test Linux on #707

Three claude_observation_benchmark tests fail, all on missing process-wide authorities:

runner.rs:116: run production observation pipeline:
  SourceFailures { failed_sources: 1,
                   first_reason_code: "background_cpu_unavailable",
                   first_retryable: false }

runner.rs:550: run Codex production provider path:
  BackgroundResourceUnavailable { provider: "codex",
                                  resource: "process resident-memory authority" }

Why it happens

These benchmarks drive the real observation pipeline. Host admission now refuses every capture when the process background-CPU authority is absent, and the Codex provider path additionally refuses without configured resident-memory preparation resources. Production installs both during daemon bootstrap — which a benchmark never runs.

Why it wasn't caught by the existing harness

tracedecay-global-db's harness does install both, in profile_with_session_capture_resources. But that helper is #[cfg(test)] and pub(crate), so it is reachable only from inside that crate. The benchmark calls plain HostAdmissionTestRuntimeV1::profile(), which installs neither.

So this is not a test that drifted — it is a production prerequisite that grew, with the only fixture that satisfies it locked inside another crate.

The fix

One ensure_background_cpu_authority() helper in the benchmark runner, wired into both constructors. It reproduces the harness's own race-tolerant pattern: install at NonZeroUsize::MIN, and if a sibling benchmark already won the process-wide race at a different canonical width, adopt that authority rather than making success depend on execution order.

Test-side only. No production code changed, and no ceiling, width, or admission rule is relaxed — the tests now satisfy the contract instead of the contract being weakened to suit them.

Verification

Summary [18.174s] 19 tests run: 19 passed, 4115 skipped

Before: 18 passed, 1 failed (and 3 failed prior to the background-CPU half). cargo check -p tracedecay --lib --locked clean, cargo fmt clean.

Not addressed here: Build Windows tests, Test Windows (its cascade), and Dashboard accessibility are separate failures on the same run.

🤖 Generated with Claude Code

Test Linux fails on three claude_observation_benchmark tests. They drive
the real observation pipeline, which host admission now refuses without
the process background-CPU authority (background_cpu_unavailable) and,
on the Codex provider path, without configured resident-memory
preparation resources.

Production installs both during daemon bootstrap, which a benchmark
never runs. tracedecay-global-db's harness installs them in
profile_with_session_capture_resources, but that helper is
#[cfg(test)] pub(crate) and unreachable from here, so this reproduces its
race-tolerant pattern locally.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 1592e28

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f245016b2c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// A sibling benchmark can win the process-wide installation race at a
// different canonical width; reuse that authority rather than making
// success depend on execution order.
if install_process_background_cpu(NonZeroUsize::MIN).is_err() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use the production CPU width for benchmark measurements

On a fresh run of the documented benchmark command, no daemon authority exists, so this permanently installs width 1. Codex derives shared_jsonl_preparation_workers() from that width and acquires those permits around its Rayon frame-preparation work, whereas production installs the worker plan's effective_workers; the provider benchmark therefore serializes Codex preparation and records non-production latency and throughput. Initialize the canonical production worker plan rather than using the minimum width.

AGENTS.md reference: AGENTS.md:L7-L12

Useful? React with 👍 / 👎.

Comment on lines +68 to +69
let _ = tracedecay_sessions::runtime::codex::CodexDiscoveryHub::default()
.configure_preparation_resources(memory);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use the canonical resident-memory authority

When a nonignored benchmark fixture runs before daemon bootstrap tests in the same cargo test --lib process, this benchmark-owned Arc permanently wins the shared JSONL OnceLock; bootstrap then configures its scheduler-owned memory and receives InvalidFrameState, making the suite execution-order dependent. If bootstrap wins first, discarding this result instead makes the benchmark silently use an unrelated authority. Compose the fixture with the canonical process authority rather than installing a shadow one.

AGENTS.md reference: AGENTS.md:L82-L84

Useful? React with 👍 / 👎.

…plan-reopened' into claude/fix-test-linux-benchmark
@ScriptedAlchemy
ScriptedAlchemy merged commit a10e46d into codex/tracedecay-total-redesign-plan-reopened Aug 25, 2026
1 check passed
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.

1 participant