Skip to content

feat(hotpath): fill daemon mcp/host-admission/io gaps - #789

Merged
ScriptedAlchemy merged 2 commits into
codex/tracedecay-total-redesign-plan-reopenedfrom
cursor/hotpath-gap-fill-leftovers-04d2
Sep 3, 2026
Merged

feat(hotpath): fill daemon mcp/host-admission/io gaps#789
ScriptedAlchemy merged 2 commits into
codex/tracedecay-total-redesign-plan-reopenedfrom
cursor/hotpath-gap-fill-leftovers-04d2

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Aug 31, 2026

Copy link
Copy Markdown
Owner

feat(hotpath): fill daemon mcp/host-admission/io gaps

Gap-fill hotpath coverage PR for the root daemon crate (crates/tracedecay), branched from codex/tracedecay-total-redesign-plan-reopened (PR #707 base; #707 is NOT merged by this PR).

Rebase note: the base later extracted src/daemon/store_runtime/session_registry.rs into the new tracedecay-store-runtime crate. The 12 session-registry sites in this PR followed that file move, so the diff now touches crates/tracedecay-store-runtime/src/session_registry.rs (same functions, same labels — no new scope). All other files remain in crates/tracedecay.

Scope guarantees:

  • Only the 12 originally targeted files touched (11 in crates/tracedecay, plus the rename-followed session_registry.rs above) — no Cargo.toml changes, no hooks/host-integration files, no *_benchmark.rs / *_tests.rs.
  • No existing #[hotpath::measure] site was modified, relabeled, or removed.
  • hotpath/hotpath-alloc/hotpath-cpu/hotpath-mcp remain out of default and production; macros no-op without --features hotpath. No metrics server, no output-format changes — the MCP hook-protocol stdout guard is untouched.
  • All new labels follow daemon.<area>.<verb> / mcp.<area>.<verb> and are unique repo-wide (re-verified after each rebase).

Verification: cargo check -p tracedecay (default features) passes on the rebased branch. cargo check -p tracedecay --features hotpath is currently blocked by a pre-existing base break unrelated to this PR: tracedecay-session-runtime fails with queries overflow the depth limit! at session_sync.rs:431 (base-side instrumentation; needs #![recursion_limit = "256"] or restructuring on the base). This PR's hotpath-featured build passed before that break landed.

Coverage table

102 new measure sites across 12 files (previously zero-coverage files first, then add-missing-only files):

File New sites New labels
crates/tracedecay/src/host_admission.rs 14 daemon.host_admission.{install_background_cpu, mount_sibling_project, open_runtime, scan_storage_bytes, digest_session_domain, replay_observations, count_temporal_rows, upsert_transcript_batch, count_transcript_rows, init_project_graph, open_project_graph, open_project_branch, open_graph_read_only, validate_authorities}
crates/tracedecay/src/mcp/server.rs 8 mcp.server.{construct, read_tokens_baseline, detect_worktree_mismatch, reconcile_automation, retrieval_scope_check, mount_work_evidence, mount_retained_surfaces, stats_snapshot}
crates/tracedecay/src/mcp/project_route.rs 9 mcp.project_route.{resolve_registered, forget_project, observe_route, select_route, snapshot_cache, store_cache, refresh_cache, forget_project_shared, protect_structural_ids}
crates/tracedecay/src/mcp/server/ledger.rs 7 mcp.ledger.{read_upload_policy, estimate_raw_tokens, persist_token_accounting, flush_worldwide, record_error_analytics, record_route_analytics, record_span_observation}
crates/tracedecay/src/tracedecay/queries/meta.rs 7 daemon.store_meta.{read_tokens_saved, write_tokens_saved, read_local_counter, reset_local_counter, add_local_counter, checkpoint, quick_check}
crates/tracedecay/src/profile_registry_maintenance.rs 7 daemon.profile_registry.{open_existing, open, list_projects, classify_storage, retire_paths, apply_orphan_relink, gc}
crates/tracedecay-store-runtime/src/session_registry.rs (moved from crates/tracedecay/src/daemon/store_runtime/ by base refactor) 12 daemon.session_registry.{list_ready_sessions, reserve_session_replacement, reserve_session_recovery, reconstruct_terminal_recovery, bind_memory_graph, admit_remote_node, admit_project_runtime, extend_project_runtime, reserve_runtime_retirement, retire_session_sync, rebind_session_sync, runtime_incarnation}
crates/tracedecay/src/daemon/http_application.rs 8 daemon.http.application.{build_registry_router, remote_status_read, local_admission, tls_bind, tls_accept, tls_validate_identity, observe_http_request, parse_body_length}
crates/tracedecay/src/daemon/engine.rs 4 daemon.engine.{git_watcher_health, log_version_skew, claim_catalog_refresh, cached_open_failure}
crates/tracedecay/src/daemon/scheduler.rs 9 daemon.scheduler.{settle_retained_automation, commit_exit, retire_scheduler, retained_project_graph, global_retention, read_automation_config, probe_scheduler_work, user_jobs_pass, mint_user_job_run_id}
crates/tracedecay/src/daemon/maintenance.rs 7 daemon.maintenance.{read_table_growth, read_store_size, compare_table_growth, sample_store_telemetry, mint_telemetry_context, load_cursor, persist_cursor}
crates/tracedecay/src/daemon/pr_autotrack.rs 10 daemon.pr_autotrack.{run_git, discover_gh, discover_ls_remote, activate_manual_branch, cleanup_manual_activation, cleanup_manual_retirement, activate_worktree, remove_store, prepare_worktree, cleanup_worktree}

Macro forms used: #[hotpath::measure(label = ...)] (sync fns), #[hotpath::measure(label = ..., future = true)] (async fns), hotpath::future! for two awaited startup stages inside McpServer::new_with_context and the two Box::pin(async move { ... }) boxed-future bodies in daemon/maintenance.rs (same pattern already used in daemon/engine.rs). The larger diff stat in maintenance.rs is indentation-only from those two wraps.

Open in Web Open in Cursor 

@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c36a294

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

@cursor
cursor Bot force-pushed the cursor/hotpath-gap-fill-leftovers-04d2 branch from d2e3546 to cf6f5ee Compare August 31, 2026 19:24
Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/hotpath-gap-fill-leftovers-04d2 branch from 69f3531 to e9efb28 Compare August 31, 2026 22:05
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Performance Comparison codex/tracedecay-total-redesign-plan-reopenedcursor/hotpath-gap-fill-leftovers-04d2

Total Elapsed Time: 5.32s → 5.14s (-3.4%)
CPU Baseline: 80.70µs → 80.08µs (-0.8%)
Benchmark ID: index-bench-timing

timing - Execution duration of functions.

+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| Function                                 | Calls                      | Avg                             | P95                             | Total                            | % Total                      |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| tracedecay-index-bench                   | 1 → 1 (+0.0%)              | 5.32s → 5.14s (-3.4%)           | 5.32s → 5.14s (-3.4%)           | 5.32s → 5.14s (-3.4%)            | 100.00% → 100.00% (+0.0%)    |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| query.artifact.append_pages              | 13 → 13 (+0.0%)            | 174.11ms → 184.48ms (+6.0%)     | 237.24ms → 256.90ms (+8.3%)     | 2.26s → 2.40s (+6.2%)            | 42.57% → 46.69% (+9.7%)      |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| query.artifact.batch.sqlite              | 13 → 13 (+0.0%)            | 118.99ms → 122.62ms (+3.1%)     | 163.05ms → 168.43ms (+3.3%)     | 1.55s → 1.59s (+2.6%)            | 29.10% → 31.03% (+6.6%)      |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| query.artifact.batch.postings            | 13 → 13 (+0.0%)            | 104.30ms → 107.47ms (+3.0%)     | 143.79ms → 149.95ms (+4.3%)     | 1.36s → 1.40s (+2.9%)            | 25.51% → 27.20% (+6.6%)      |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| code_index.workers.install               | 83 → 83 (+0.0%)            | 19.37ms → 16.77ms (-13.4%)      | 56.59ms → 61.34ms (+8.4%)       | 1.61s → 1.39s (-13.7%)           | 30.23% → 27.10% (-10.4%)     |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| CodeIndexProductionOwnerV1::extract_file | 276 → 276 (+0.0%)          | 6.36ms → 4.81ms (-24.4%) 🚀     | 12.59ms → 7.42ms (-41.1%) 🚀    | 1.75s → 1.33s (-24.0%) 🚀        | 33.00% → 25.83% (-21.7%) 🚀  |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| code_index.build.and_publish             | 2 → 2 (+0.0%)              | 634.37ms → 520.08ms (-18.0%)    | 652.21ms → 522.98ms (-19.8%)    | 1.27s → 1.04s (-18.1%)           | 23.86% → 20.25% (-15.1%)     |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| domain.canonical.sha256                  | 114526 → 114526 (+0.0%)    | 10.89µs → 9.04µs (-17.0%)       | 14.92µs → 14.95µs (+0.2%)       | 1.25s → 1.03s (-17.6%)           | 23.47% → 20.15% (-14.1%)     |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| query.artifact.finalization.advance_wake | 14 → 14 (+0.0%)            | 53.15ms → 54.89ms (+3.3%)       | 260.83ms → 275.25ms (+5.5%)     | 744.05ms → 768.47ms (+3.3%)      | 14.00% → 14.96% (+6.9%)      |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| query.artifact.prepare_pages             | 13 → 13 (+0.0%)            | 47.52ms → 53.80ms (+13.2%)      | 67.01ms → 81.72ms (+22.0%) ⚠️   | 617.72ms → 699.44ms (+13.2%)     | 11.62% → 13.62% (+17.2%)     |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| code_index.chunk.index_file              | 276 → 276 (+0.0%)          | 2.96ms → 2.22ms (-25.0%) 🚀     | 6.02ms → 3.20ms (-46.8%) 🚀     | 818.29ms → 612.79ms (-25.1%) 🚀  | 15.39% → 11.93% (-22.5%) 🚀  |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| code_index.extract.parser_artifact       | 276 → 276 (+0.0%)          | 2.69ms → 2.05ms (-23.8%) 🚀     | 5.79ms → 3.13ms (-45.9%) 🚀     | 742.35ms → 566.08ms (-23.7%) 🚀  | 13.96% → 11.02% (-21.1%) 🚀  |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| query.artifact.batch.parallel_prepare    | 13 → 13 (+0.0%)            | 37.35ms → 43.34ms (+16.0%)      | 52.49ms → 68.55ms (+30.6%) ⚠️   | 485.61ms → 563.42ms (+16.0%)     | 9.13% → 10.97% (+20.2%) ⚠️   |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| 🆕 code_index.build.assemble             | 0 → 2 (+100.0%) ⚠️         | 0.00ns → 188.97ms (+100.0%) ⚠️  | 0.00ns → 203.55ms (+100.0%) ⚠️  | 0.00ns → 377.94ms (+100.0%) ⚠️   | 0.00% → 7.36% (+100.0%) ⚠️   |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| code_index.chunk.build                   | 276 → 276 (+0.0%)          | 1.92ms → 1.35ms (-29.7%) 🚀     | 4.72ms → 1.95ms (-58.7%) 🚀     | 530.02ms → 373.01ms (-29.6%) 🚀  | 9.97% → 7.26% (-27.2%) 🚀    |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+
| 🗑️ code_index.chunk.identify             | 276 → 0 (-100.0%) 🚀       | 1.89ms → 0.00ns (-100.0%) 🚀    | 4.71ms → 0.00ns (-100.0%) 🚀    | 521.63ms → 0.00ns (-100.0%) 🚀   | 9.81% → 0.00% (-100.0%) 🚀   |
+------------------------------------------+----------------------------+---------------------------------+---------------------------------+----------------------------------+------------------------------+

Generated with hotpath-rs

@ScriptedAlchemy
ScriptedAlchemy merged commit 89e9e77 into codex/tracedecay-total-redesign-plan-reopened Sep 3, 2026
13 of 22 checks passed
@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

Review of record (integration lane, base 7f1f8e02c).

The base moved under this PR: 1f7e1f0d5 applied blanket #[hotpath::measure_all] and marked trivial functions #[hotpath::skip]; 3e26c7596 then removed every measure_all ("retain only labeled function spans"). ~43 of the functions this PR instruments still carry that now-inert skip marker, which is the source of the 43 merge conflicts. Labeled semantic spans are exactly what the base retains, so the PR is policy-compatible; conflicts resolve to the PR side.

Two hunks are rejected and will be reverted in a follow-up commit on the merged head:

  1. crates/tracedecay/src/host_admission.rs (14 sites) — 13 spans are on HostAdmissionTestRuntimeV1 (#[doc(hidden)], *_for_test methods) and one on the process background-CPU test fallback. That is test-fixture plumbing, not a production hot path; it inflates the label set with spans no operator journey crosses.
  2. mcp.server.read_tokens_baselinehotpath::future! around cg.get_tokens_saved(), whose body this same PR measures as daemon.store_meta.read_tokens_saved. Nested identical measurement of one await (same class as the doubled global_db.schema.persist.converge label in perf(global-db): bound schema convergence after project open #826).

Everything else (session_registry, engine, http_application, maintenance, pr_autotrack, scheduler, project_route, remaining server/ledger, profile_registry, store_meta) is accepted. hotpath::future! inside the Box::pin bodies in maintenance.rs is boxed so it adds no query depth; no target is a const fn.

The 9 red checks here are from a merge commit against a base that is ≥2 days stale (Format/Clippy/Test lanes fail on the base of that era); they will be re-judged on the merged #707 head. Gates before push: cargo check -p tracedecay --no-default-features --locked (production shape unaffected), --features hotpath check, clippy -D warnings, fmt, MCP suite ≥ 382/385.

@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

Integrated as merge commit 89e9e7711adfc2ff3473c6bfe006efaf997e4ed7 on codex/tracedecay-total-redesign-plan-reopened (current verified tip d4456c211c4be00503d7f32bdc6ba4c2ce81f953).

Evidence:

  • unresolved review threads: 0
  • all 102 intended PR feat(hotpath): fill daemon mcp/host-admission/io gaps #789 Hotpath labels retained after conflict resolution and latest-target integration
  • cargo check -p tracedecay --features hotpath --locked: passed on final tip
  • cargo check -p tracedecay --no-default-features --locked: passed on final tip
  • git diff --check: passed
  • full lib gate: merge 1513 passed / 39 failed versus clean target 1512 passed / 40 failed; the sole merge-only broad-suite failure passed exact on both target and merge, confirming baseline/non-deterministic suite failures rather than a PR feat(hotpath): fill daemon mcp/host-admission/io gaps #789 regression

The Hotpath future wrappers only wrap polling; newer target bodies, typed outcomes, lock scopes, cancellation paths, and daemon/MCP lifecycle ownership were retained.

ScriptedAlchemy added a commit that referenced this pull request Sep 3, 2026
host_admission.rs instruments HostAdmissionTestRuntimeV1, a doc(hidden)
test fixture runtime, and the process background-CPU test fallback; those
are not production hot paths. mcp.server.read_tokens_baseline wrapped an
await that daemon.store_meta.read_tokens_saved already measures, doubling
the same span.

Refs #789
@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

Follow-up on the review above, now landed on #707 as acf25b232 refactor(hotpath): drop test-fixture and duplicate spans from #789 (fast-forward on 77be8b23c):

  • crates/tracedecay/src/host_admission.rs is byte-identical to its pre-feat(hotpath): fill daemon mcp/host-admission/io gaps #789 state (7f1f8e02c): the 14 daemon.host_admission.* spans on HostAdmissionTestRuntimeV1 / the background-CPU test fallback are gone and the base's #[hotpath::skip] markers are restored.
  • mcp.server.read_tokens_baseline (hotpath::future! around cg.get_tokens_saved()) reverted to the plain await; daemon.store_meta.read_tokens_saved remains the single span for that read.
  • The other 87 labels from this PR count exactly once each in the tree.

Gates on the integrated head: cargo fmt --check, cargo check -p tracedecay --no-default-features --locked (production shape), cargo check -p tracedecay -p tracedecay-store-runtime --features hotpath --locked (no query-depth overflow), cargo clippy -p tracedecay -p tracedecay-store-runtime -- -D warnings — all pass. MCP suite: 384/385 (single failure is context_relevance_eval_test, a retrieval-eval floor on the base, unrelated to instrumentation).

ScriptedAlchemy added a commit that referenced this pull request Sep 3, 2026
host_admission.rs instruments HostAdmissionTestRuntimeV1, a doc(hidden)
test fixture runtime, and the process background-CPU test fallback; those
are not production hot paths. mcp.server.read_tokens_baseline wrapped an
await that daemon.store_meta.read_tokens_saved already measures, doubling
the same span.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants