Skip to content

perf(sessions): isolate settled Codex scan optimization - #4848

Merged
ScriptedAlchemy merged 2 commits into
masterfrom
fix/4756-codex-witness-master
Nov 9, 2026
Merged

ScriptedAlchemy merged 2 commits into
masterfrom
fix/4756-codex-witness-master

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Refs #4756 — independently reviewable Codex-only slice

Partial fix. Not Fixes #4756. Do not close the issue or merge until required tests and review complete.

Why a new issue-specific PR

PR #4815 already implements this narrow Codex directory-witness improvement, but it was retargeted onto the draft Git parity fixture #4829, leaving an unrelated, unmerged PR as a prerequisite. This successor uses current master at cf54e0322bf574ae32068d6330bceff4426cea3d and includes exactly the two Codex source/test blobs from #4815 at 8f4d6462ed0d02bbd6843a11a8f9cdba327272ff. The two affected master blobs were verified byte-identical to #4815's original base before creating this commit. Neither existing branch nor its history was rewritten.

The new commit 803521383016b55214dce59b4420e6ea600bec3a was published through an exact-old-head, non-force fast-forward. It excludes the scheduler fixture owned by merged #4821 and Git parity fixture owned by draft #4829. Do not merge the same Codex changes from both #4815 and this PR.

Source change and behavioral tests

  • Settled historical Codex directories retain their native stat/change-time witness without an additional read_dir + O(entries log entries) filename sort; unsettled directories keep a name fingerprint.
  • Use stable native change-time identity for unsettled directory comparisons rather than the freshly random file-content uncertainty token. Metadata changes invalidate, unchanged unsettled directories compare entry names, and a transition from settled to unsettled invalidates conservatively.
  • Avoid rechecking already-probed hot-prefix directories during a rotating idle cycle while advancing the cursor.
  • Existing real-directory Rust regressions cover settled and unsettled change detection, newly added rollouts in a hot bucket, and continued scan convergence. No budgets, API contracts, or CI policy are changed.

Evidence and remaining acceptance

The exact two Codex code/test blobs already passed the hosted Linux tests on the #4815 path (run 42527923673); its later head workflow 42547953400 passed Linux fleet, Windows, Clippy, repository and dashboard gates. These results apply to the same two source blobs on the earlier prerequisite tree, not to this new master-based commit. Require fresh nonzero bazel test --test_output=errors //crates/tracedecay-sessions:unit_test, applicable host/integration CI, and independent review for this exact head before merging. A Bazel workspace/runner is unavailable in the authoring environment; no local Rust test pass is claimed, and Cargo was never used.

Still open: the process-retained ReadDir position is lost on daemon restart; the durable Codex frontier saves only whole-sweep epoch/completion. The four-hour 1.5–1.8-core import, profile writes at 125–160 ms, cross-provider restart continuation, and incident-scale write/CPU improvement are not proven resolved on master. #4793 separately owns projection-queue/recovery and source-presence batching. Keep #4756 open and this change scoped.

Protected mixed #4776 and every Kev/decision-model PR stay DRAFT / NO MERGE, with no work moved through them; release #4763 read-only. No production, infrastructure, tag, secret, Kody, Copilot, or delegated agent action.


Devin Review

Refs #4756

Publish the exact Codex-only source and regression blobs previously tested
in PR #4815 directly against master. This removes the Git fixture draft
branch from the merge prerequisite without rewriting the original history.

Skip redundant name enumeration on settled historical directories. Retain
native change evidence and conservative unsettled directory detection.
The change is partial: durable mid-scan continuation and affected-host CPU
and SQLite write-latency measurements remain outstanding.
@changeset-bot

changeset-bot Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4be9f0a

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

@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

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