Skip to content

perf(sessions): skip empty JSONL scope resolution on re-offer - #4806

Open
ScriptedAlchemy wants to merge 10 commits into
masterfrom
fix/4374-unchanged-jsonl-reoffer
Open

ScriptedAlchemy wants to merge 10 commits into
masterfrom
fix/4374-unchanged-jsonl-reoffer

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Refs #4374 — focused partial performance repair

Source-backed cause and change

Even when a Codex rollout has an unchanged, fully covered durable source cursor, the shared JSONL admission code still invokes the provider initializer. Codex's initializer submits a blocking-worker task to rebuild the scope matcher and walk context, despite zero frames to classify. This adds one unnecessary blocking dispatch per unchanged rollout, including the issue's large project re-offer pass.

Codex explicitly opts in to an otherwise-disabled with_skip_empty_initialization() admission setting. In admit_jsonl_observations, an opted-in no-op admission bypasses that initializer only when the durable cursor is for the same generation, the scanned window has zero new bytes/frames/skips, its starting position matches that exact durable cursor, and it is not deferred or a replacement scan. It preserves the same source-cursor validation, prefix verification, cancellation check, durable complete_source_rewrite call, typed error propagation, progress and tracing. A pending interrupted rewrite therefore still gets a chance to retire unoffered records; the optimization does not infer rewrite absence from an unchanged cursor. Any appended bytes, partial page, changed generation or rewrite follows the normal path.

Nonvacuous behavioral regression

A real Codex rollout is admitted, then the shared admission is repeated 16 times with an initializer that deliberately returns an error if invoked. The test requires every unchanged re-offer to read zero new bytes, retain the exact durable cursor, perform zero captures, and still call the source rewrite-completion authority 16 times. It then appends a real Codex message and proves the next normal admission persists exactly one new record without losing prior provenance. The failing initializer makes the regression fail on master. A second regression requires that a provider without opt-in still executes its initializer and keeps its refusal and durable cursor unchanged; Pi's header-witness safety check is therefore unaffected.

Validation limits

  • Published three single-parent commits ending at 1d4e01528aa2fd1434584e770d097fe12438a08a, based on master 91c72aba7750a398dd28e83d64bf0c6d6fef4172. Compare shows three sessions files changed (the shared implementation, Codex opt-in and focused regressions). Follow-up fixed a cross-provider safety concern found by auditing Pi/Cursor/Kimi/Vibe callers; Pi explicitly requires header verification on a zero-frame page.
  • This execution environment lacks a repository checkout and Bazel. No Rust compilation, Bazel test, rustfmt or native macOS pass is claimed. CI must execute a nonzero bazel test //crates/tracedecay-sessions:unit_test --test_output=errors and formatting/Clippy on this exact head; independent review is required. Never substitute Cargo.
  • The 16 re-offers quantify eliminated initializer calls, not wall-clock milliseconds. Real host measurement remains necessary: compare TRACEDECAY_SPAN_TIMINGS=1 project/profile traces for the same 2,010-rollout corpus before/after, including store cursor/rewrite-completion cost and restart profile behavior.

Boundaries / outstanding issue acceptance

This cannot yet claim elimination of the originally measured ~28 ms/file project-scope latency, or complete restart/provenance/cache acceptance. Existing #4380, #4706, #4757, #4767 remain intact. The separate #4756/#4793 owner handles historical projection backlog; no files in its PR were changed. Keep #4374 open until proven on master.

Do not merge or auto-merge held draft Kev/decision-model PRs or mixed #4776. Release #4763, other owner branches, CI protections, production, credentials, tags and infrastructure are untouched.

Consolidation of overlapping #4374 PRs (2026-11-08)

Fail-closed regression and CI follow-up (2026-11-08)

  • 29a9150 adds a regression for the new no-op fast path when the durable rewrite-completion read fails. The existing admission spy injects a one-shot retryable failure; the test requires a typed, retryable refusal instead of false convergence, unchanged committed cursor/rows/captures, and a successful retry that checks the rewrite again without rereading frames. The commit changes tests only and was appended with an exact-old-head nonforce fast-forward.
  • The previous exact-head Bazel Linux fleet run passed //crates/tracedecay-sessions:unit_test (31.1 s), Repository gates, Clippy, feature gates, dashboard and harness self-tests. Its overall fleet failed: three automation scheduler tests reproduce exactly on master (master run); separate global-db and dashboard API tests timed out and MCP suite failed under that fleet run. These other suites are outside this PR's four source/test files; attribution of their CI failures is not established.
  • New exact-head CI run was queued when inspected. The newly added retryable-failure regression has not yet executed. Confirm a nonzero sessions unit test run, formatting, required CI and independent review before merging. A real 2,010-rollout affected-host before/after timing remains outstanding; issue Codex discovery re-offer costs about 28 ms per unchanged rollout in project scope, and profile scope re-offers on every restart #4374 stays open.

@changeset-bot

changeset-bot Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 53ef680

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

Follow hosted Bazel formatting diagnostics and confine the test spy
MutexGuard to its own scope. This preserves all assertions and keeps
the later asynchronous cursor and re-offer checks outside the lock.

Refs #4374
Reuse the production-path 16-rollout / 96-reoffer Git-scope and
append-transition tests on the original issue-specific PR. Keep
rewrite-completion and provider opt-in regressions already present.

Refs #4374
Preserve the trace boundary when consolidating the alternate
re-offer implementation and behavioral tests.

Refs #4374
Ensure a failed durable rewrite-completion read remains a typed block on
an unchanged empty page, leaves the accepted cursor/rows intact, and is
retried without re-reading transcript frames.

Refs #4374
Apply the pinned Bazel rustfmt formatting from repository gates.
Preserve the failure injection and nonvacuous assertions.

Refs #4374

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

Copy link
Copy Markdown
Owner Author

#4374 exact-head Bazel gate repair — 2026-11-08

The hosted Repository gates job on prior head 29a9150 failed only on pinned rustfmt_check_2024 formatting in the newly added rewrite-refusal regression (jsonl_observation_admission/tests.rs:2037). The dependent Feature gates job consequently failed its prerequisite, not an independently diagnosed feature test.

Published c691483 as a one-file, formatting-only child of exact observed head 29a9150, through force=false plus expected-old-head branch lease. Inspected the immutable commit diff: only the three-line Some(HostAdmissionOutcome::retained_unavailable(...)) formatting changes; all injected failure and retry assertions remain intact.

New exact-head CI is queued. No current-head Rust/Bazel pass, independent approval, affected-macOS 2,010-rollout timing, merge, or issue closure is claimed. Refs #4374 remains partial. No Cargo, CI changes, model/draft/release changes, or other owner branch writes.

Copy link
Copy Markdown
Owner Author

Exact-head CI blocker: external Bazel artifact download (2026-11-08)

Reviewed run 42463541427 at PR head c69148305633159cc828076921ea8ed1039a7742. Repository gates, benchmark harness self-tests, change scope, and feature gates passed. Dashboard, Clippy, and Linux fleet failed during Bazel analysis because GitHub returned HTTP 504 Gateway Time-out fetching the pinned hermetic-launcher runfiles-stub-x86_64-linux (and Dashboard's finalize-stub-x86_64-linux) from github.com/hermeticbuild/hermetic-launcher/releases/download/binaries-20261025/. Those logs show analysis failures, not an attributed Rust regression. The aggregate Linux job then failed because its shards failed; Windows was still running at inspection. The exact-head //crates/tracedecay-sessions:unit_test was not shown executing in the Linux fleet log; earlier-head passes do not qualify the new regression.

A targeted re-run of the failed Linux fleet job was attempted through GitHub Actions but rejected with HTTP 403, "The workflow run containing this job is already running". Once the current run has terminated, retry only the failed jobs via the normal Actions mechanism, without modifying CI, dependencies, or protections. Do not claim a pass/merge/issue closure until exact-head nonzero sessions Bazel tests, applicable native checks, real 2,010-rollout before/after host timings, and review are established. Refs #4374; no source change is justified by the external 504.

Copy link
Copy Markdown
Owner Author

#4374 — exact-head CI retry result (2026-11-08; Refs #4374)

CI run 42463541427, attempt 2 on unchanged PR head c69148305633159cc828076921ea8ed1039a7742 cleared the earlier external hermetic-launcher HTTP 504 fetch failure. The Bazel //crates/tracedecay-sessions:unit_test passed in 28.5s (reported as executed, not cached). Repository gates/rustfmt, Clippy, feature gates, dashboard and benchmark harness checks passed as well. session_suite and transcript_ingest_suite also passed in the Linux fleet.

Full Linux acceptance is still blocked by exactly two failing Bazel targets among 183: //crates/tracedecay:automation_runner_test (167 passed, three known scheduler failures also observed on master) and //crates/tracedecay-global-db:unit_test (300.2s timeout). The latter is not yet attributed to this sessions-only PR; do not increase its deadline or claim it harmless without isolation. Windows is still running; macOS was skipped, not qualified. The Linux fleet and aggregate Test Linux jobs are red.

Source diff and review of the existing four-file #4806 optimization found no defensible additional #4374 fix without the affected-host per-rollout span distribution. In particular, do not bypass the authoritative complete_source_rewrite pending-rewrite check to chase unmeasured latency. A distinct #4756 owner has a separate Codex directory-discovery optimization in #4815 (nonoverlapping files) and projection queue changes in #4793; neither branch was touched.

No PR merge or #4374 closure. Still require the same 2,010-rollout macOS corpus before/after timing, restart-profile/frontier evidence, independent approval and full applicable exact-head CI/native qualification. Refs #4374 only. Protected draft #4776 and Kev work, release #4763, production, infra and CI protections remain untouched.

Repair three hosted automation_runner_test failures by supplying the
configured executable identity required by the production prefilter.
Use the same identity for the prefilter and retained runner, preserving
manual-schedule, exact-ledger, live-lock and lock-race assertions.

Add a production-prefilter regression for unconfigured refusal,
deduplication and same-occurrence recovery after binding, with zero
backend calls and no effectful terminal. Do not relax backend admission,
change timeouts, or alter the graph publication changes.

Refs #4532

Copy link
Copy Markdown
Owner Author

Refs #4374 — new cross-owner PR scope blocker (2026-11-08)

Reviewed current master (91c72aba), root AGENTS.md (no nested AGENTS.md in the full tree), all three #4374 issue comments, current source/tests and review threads, and exact-head CI. The current #4806 head is now 01c0b168, not the previously verified c691483.

The new ninth commit 01c0b168 is test(automation): bind scheduler fixtures to backend identities, Refs #4532. It modifies crates/tracedecay/tests/automation_runner_test/jobs.rs, which is unrelated to the Codex empty-page fix. The same complete file blob (7342786381bcaf3c08454d2dc2711a6c731e7151) is already present on concurrently owned #4815, head e85d460. Thus #4806's current five-file diff contains a duplicated cross-owner scheduler repair; #4806 is no longer strictly #4374-specific. This is a review/scope blocker, not a claim the scheduler repair is incorrect or that the Codex fix regressed.

I did not rewrite or revert that concurrent work: preserve its commit and branch ownership until the scheduler repair is landed/isolated through its designated owner. Do not count an eventual green #4806 fleet as isolated evidence for #4374 while the unrelated fifth file remains in its diff. No force-push, draft/CI bypass, or other-branch mutation.

Current-head CI 42525816007 is queued; its native macOS job is skipped. Prior c691483 retry passed a nonzero //crates/tracedecay-sessions:unit_test in 28.5s but failed Linux fleet on three master-reproduced scheduler assertions and a global-DB 300.2s timeout. Independent human approval, native macOS qualification, and comparable same-host before/after 2,010-rollout timing remain absent. The authoritative per-rollout complete_source_rewrite read is still required, not a safe shortcut.

Keep #4374 open with Refs only. #4776 and Kev/decision-model PRs stay DRAFT; release #4763, production, credentials, tags, CI protections and other owners' branches are untouched.

Restore the unrelated scheduler fixture file to the current master blob
on this #4374 branch. The identical scheduler repair remains preserved
in the separately owned #4815 branch; do not duplicate its CI/review
surface here. Preserve all Codex admission and regression changes.

Refs #4374

Copy link
Copy Markdown
Owner Author

Refs #4374 — isolated the source PR from overlapping scheduler work (November 8, 2026)

Published 53ef680 onto this PR by an exact-old-head, nonforce fast-forward from 01c0b168. It restores only crates/tracedecay/tests/automation_runner_test/jobs.rs to the exact current master blob (740283d56e858902fe168f5dbcfe7afd03f4ce9b). The previous duplicate scheduler repair's commit/history is retained, and its exact implementation blob remains on the separately owned #4815, where it can be reviewed and landed by that owner. No peer ref was changed.

Verified GitHub compare against current master: the resulting #4806 diff now has exactly four files, all under crates/tracedecay-sessions/: Codex admission, shared JSONL admission, and their behavioral regressions. All Codex source/test bytes from the preceding head are preserved. This removes the previously reported cross-owner review blocker; it does not mean #4374 is complete.

Fresh exact-head CI 42527302258 is queued. Prior-head sessions Bazel unit tests passed, but this new head has no current-head pass yet. Native macOS qualification, independent approval, and comparable before/after measurements for the original 2,010 Codex rollouts remain outstanding. No Cargo, CI bypass, merge, issue closure, draft/release, infrastructure or production actions. Refs #4374 only.

This branch has not been deployed

No deployments
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