Skip to content

docs(code-index): plan graph-rebuild receipt speed - #1568

Closed
ScriptedAlchemy wants to merge 5 commits into
masterfrom
cursor/graph-rebuild-speed-plan-a983
Closed

ScriptedAlchemy wants to merge 5 commits into
masterfrom
cursor/graph-rebuild-speed-plan-a983

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Sep 17, 2026 •

Copy link
Copy Markdown
Owner

Draft. Do not merge. Do not raise the 90s receipt.

The seat-swap commit versus master is #1562 (b80dd58). This PR does not change that behavior. Interim pstack reorders the cuts. Full text: docs/plans/graph-rebuild-receipt-speed.md.

Outcome

90 seconds is not too short for the predicate. The window is spent twice. The wait helper busy-polls status (~16k calls) and each poll recaptures a fingerprint. The workers spend CPU on clone-body JSON, canonical rewrite, and token deserialize. Edge projection is not the burn. edge_count 0 with 98305 symbols is the no-call fixture. Cut that work and make the readiness check cheap.

seated_generation_age_seconds is seal age (status.rs:296), not time since the serving swap. At ~89s the generation has existed for almost the whole receipt and line 176 still has not returned. Seat match and search hits are not the predicate.

Pstack, mapped to tip

Poll. The wait is yield_now with no sleep (graph_rebuild_status_test.rs:171), on 4 worker threads (:248). ~16k full tracedecay_status calls fit in 90s. Compact status still builds branch diagnostics before the include flag (status.rs:331-335) and opens gix via current_branch (branch.rs:107-117). The named capture is GitMetadataFingerprintV1::capture (identity.rs:166-176): gix open, HEAD read, hash of loose refs, used by ready_without_stat (reconcile.rs:540-562). dashboard_freshness must not open git (serving_reads.rs:243-245). A readiness poll returns the last ladder.

Workers. Not collect_edge_evidence. Every callable is tokenized before the 30-token exclusion (clone_body.rs:157-185, exclusion at :229). Tokens are cloned into the payload (clones.rs:413-443), serde-encoded, and rewritten by canonicalize_json_into (partitioned_codec.rs:1230-1236, named in canonical_json.rs:654). The successor deserializes them again (clone_census.rs:46-49, clone_successor.rs:440-458).

Ranked changes

Do not amend #1562. Do not touch graph publication on this evidence.

  1. Readiness poll must not recapture a fingerprint. Stop compact status from calling build_branch_diagnostics / current_branch. Status freshness does not call GitMetadataFingerprintV1::capture. A sleep in the test loop is optional only after the capture is gone. Estimate: a 2–5ms gix open times 16k is 30–80s of the receipt, on the same 4 threads that are sealing. Largest cut that does not change indexed bytes.

  2. Do not tokenize, serialize, or canonically rewrite a body under 30 tokens. Count or bound the body before rename_fields and before retaining token vectors. An excluded body stores eligibility and the span. It never enters from_extracted, the file-segment JSON, or canonicalize_json_into. Eligible bodies keep V16. No new layout. Estimate: this fixture is 98305 one-line functions, and pstack says that is the worker CPU. The fix(code-index): diagnose graph-rebuild timeout and withhold a lagging seat #1557 1024/2305 walk was walking these payloads. If they are not sealed, that body loop is empty. Real clones stay.

  3. Successor off the receipt only if a payload remains. serving.rs:3212-3217, guard drop at mount.rs:1168-1173, search wake at query_runtime.rs:718-720. The ~200s page-walk estimate (2305/1024) only matters if row 2 did not delete it. Do not ignore graph in dashboard_terminal_status.

What lands where

Change Where
Seat fix #1562. Leave it. Do not merge it as a green receipt.
Row 1, then row 2 One follow-up from b80dd58. Land row 1 first so the next sample is not 16k captures. Row 2 in that PR only if the sample still shows clone-body serde.
Row 3 Only if excluded bodies are still sealed.
Graph publish Not this evidence.

Success criteria

scripts/require-exact-test.sh cargo test -p tracedecay --features test-transport \
  --test transport_acceptance_suite -- \
  graph_rebuild_status_test::background_refresh_and_reopen_report_only_servable_generations -- --exact

Same 90s. The interim pstack already ordered the rows. After row 1:

  • stacks still in capture or current_branch under status: row 1 is incomplete
  • stacks in canonicalize_json_into, clone-body serde, or token deserialize: row 2
  • stacks in publish_verified_snapshot with graph not ready: only then look at graph

Pass means the second wait returns, code_graph_serving is ready, the probe path is in search results, both reopen waits return inside their own 90s, and nothing edits RECEIPT_TIMEOUT, GRAPH_BACKGROUND_OPERATION_BUDGET, or ACTIVATION_RETRY_BACKOFF_FLOOR.

Checklist

  • No secrets
  • CHANGELOG not updated (plan only)
  • No timeout or budget change
Open in Web Open in Cursor 

cursoragent and others added 3 commits September 17, 2026 23:11
A retryable graph activation used to erase the prepared serving
candidate, and an unfinished clone-fingerprint successor withheld the
same seat after exact and lexical owners were ready. Keep the candidate
in both cases so search can move off the predecessor while graph retries.

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
The 90s receipt stays. The plan cuts clone-fingerprint replay off that
predicate instead of raising the timeout after the seat fix.

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
The prove command must match the module path and fail when the filter
matches nothing.

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e1e9319

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

@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

Cross-link / collaboration note

Plan aligns with Mac sample + #1562 prove (seat match, search hits, edge_count 0 = no-call fixture, fail ~93.7s).

Also open:

Please keep this PR docs/plan-only until #1562 lands, then open implementation commits on a fresh branch off master+#1562. No merge from this comment.

Pstack shows the 90s spent on status fingerprint capture and clone-body
serde, not edge projection. Keep the timeout.

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

Closing as stale.

Evidence from the triage: git diff --stat origin/master...origin/cursor/graph-rebuild-speed-plan-a983 = docs/plans/graph-rebuild-receipt-speed.md +195 PLUS the 3 files of b80dd58, i.e. doc-only once #1562's fix is attributed to #1562; merge-base 918 behind

Reopen with a rebase if the remaining value is wanted.

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.

2 participants