Orchestrata Ultimate › Plans › suite-runtime-and-graph-defects-plan

Suite runtime + graph-defect remediation plan

Source: plans/suite-runtime-and-graph-defects-plan.md at 8a2cb42ad · last changed 2026-08-12 · first committed 2026-08-12 · 140 lines.

Prose pending.

Plan text

Suite runtime + graph-defect remediation plan

Date: 2026-08-12 Status: CLOSED — production-side DELIVERED; suite-side objective PROVEN FAILURE, rolled back Measure-first state: checklist completed 2026-08-12 and disarmed (.kimi/measure-first.json removed)

Final record (2026-08-12, user-directed): the suite-side program (§3, work items WI-4..WI-8) is a proven failure — the authoritative full run on the merged tree measured 455s wall vs the 445.7s baseline (+2%) and 2,250s call CPU vs 2,312s (−2.7%), both inside the ~24% run-to-run noise band. No suite-level win exists. Per user directive the five suite-side merge commits were reverted on master (c7043047, 3097834c, f44c64a0, b55077e3, 8bafe038). Kept: the production-side defect fixes (D1, D2, D2b, D7 — merge 429fd08c, merge 5d3ed30c, purity fix db0609f9) and this documentation. The module-level "savings" measured standalone during the swarm did not transfer to the saturated 8-lane suite; treat standalone module benchmarks as non-evidence for suite wall claims from now on.

This plan contains only adversarially-reviewed numbers. Two claims were corrected and one projection was withdrawn during the first adversarial review; a second independent review (2026-08-12, §6b) corrected four more and left the measurement core intact. Anything not marked WEAK is reproduced-evidence-backed.


1. Baseline (measured)

Artifact: reports/run-tests-latest.json @ cf59d5c8, scope=full.

2. Defect register — production-side (adversarially verified)

D1 — MemgraphSemanticGraph.retrieve N+1 (semantic_graph/adapters/memgraph.py:512)

D2 — CodeIntelligenceGraph.impact_score recompute-per-query (refactor/codemod/_cig.py:401)

D2b — CodeIntelligenceGraph.centrality exact Brandes (refactor/codemod/_cig.py:357)

D3 — FactExtractor live pipeline repeated per test (gates/fact_extractor.py)

D7 — permanent errors enter the memgraph retry storm (semantic_graph/adapters/memgraph.py:899)

3. Suite-side program (levers 1+3, from the decomposition)

All classes adversarially confirmed in size; per-lever savings are NOT projected (the "~340-360s" figure was withdrawn — see §6). Each fix is verified against its own module baseline.

Target definition (corrected 2026-08-12, §6b-1): work the ≥1.0s cut — 581 tests holding 1,678.1s / 72.6% of call CPU — not the "2-60s band", which is 264 tests / 1,261.4s / 54.6%. The two were fused in the research record; the ≥1s cut is both the larger mass and the one the 581 figure actually described.

  1. Fixture sharing where semantics allow (lever 1): probe measured fixture shares 11% / 52% / 2% across three modules (test_trace_intel / test_search / test_cli). Start with the high-share modules; use session-scoped clients/fixtures. The 793s bucket is WEAK — module-by-module measurement decides, not the suite estimate.
  2. Pipeline-once fixtures (lever 3): test_agent_check_e2e (3 tests, 39.6s) + test_agent_check (24.8s) run real ruff/mypy/pytest per test + sleep(1.5) handshakes; run once module-scope (T4 pattern, e.g. _async_multi_results_json precedent) and replace sleeps with events.
  3. Retry-budget DI in tests (lever 3): core/graph/retry.py MAX_ATTEMPTS=8 exponential ceilings to 3.2s; tests exercising retry paths inject a shortened budget (precedent: test_session_graph_store.py 42.7→4.24s on 2026-08-11).
  4. AST/index sharing (lever 3): extend the AST-daemon session-fixture pattern (shipped 2026-08-11, 4–6× on CLI tests) to test_gen_brief_pack (41.2s), test_orchestrata_tools matcher (18.5s), test_evaluate_semantic_graph_qa (24.8s).
  5. Nested-runner modules (132s CPU total): smaller nested targets + shared fixtures (test_run_tests.py 56.1s, test_test_executor.py 32.7s, test_run_tests_main_infra.py 29.6s).

4. Execution order (implementation phase, post-signoff)

Reversed 2026-08-12 (§8-1). The original order ran the four production defects first. Measured against this plan's own objective that is backwards: tests/semantic_graph/ holds 26.8s (1.16%) of baseline call CPU and tests/refactor/codemod/ 77.4s (3.35%), so D1/D2/D2b/D7 move the 446s by approximately nothing, while §3 holds the mass. Suite-side first; production defects follow on their own merits (per-call latency), not on suite-wall grounds.

  1. D3 (test-infra pattern, contained, 32.7s of one module's 34.1s) — it is a suite-side fix that happens to live in the production-defect register.
  2. Suite-side §3, order 2→3→1→4→5 by module, each with its own targeted run_tests.py --force verification against that module's baseline CPU.
  3. D7 (smallest production item, unblocks sane failure modes).
  4. D1 (biggest production latency) — gated on the §2 D1 semantics decision (§6b-3) being settled first.
  5. D2 + D2b (same file, same lazy-cache discipline, one rename).
  6. Final gate: full scripts/run_tests.py --force; report PASS/FAIL and total wall vs the 445.7s baseline (same measurement method, same -j 8 -b 6). No intermediate 8-minute runs — targeted modules only until the final gate. Report call CPU alongside wall: at 24% run-to-run CPU variance (§6b-5), a wall comparison alone cannot separate a real win from a quiet run.

Work happens in a wt-* worktree per item or small item group (scripts/worktrees.py create), merge --no-ff into master, push from a worktree (git push origin master:master). No AI attribution in commits. Never mutate git state while a suite runs (git_sentinel).

RUL-008 (§8/R4). --no-verify on the in-worktree commits is a hook-time convenience, not a review waiver: scripts/gates.py plus the code/test/architecture reviewer pass run per item, before the --no-ff merge, and every defect they surface gets fixed regardless of whose scope it was (RUL-006/RUL-024). An item whose gates were not run does not merge.

5. Ruled out (read and rejected, not skipped)

6. Withdrawn / corrected claims (adversarial review record)

6b. Second adversarial review — corrections (2026-08-12)

Independent re-derivation from the artifacts (fresh segmentation of test-durations.ndjson, fresh _prepare_batches replay, AST-toolkit reads of every cited site). The measurement core reproduced exactly — 2,312.0s call CPU, 289.0s floor, 51 batches, 3,104.6s cache mass / 792.6s bucket, the 8.4/35.9/53.3/85.3% distribution, the 3/24/48/189-test histogram, the module CPU table, the 32.7-of-34.1s D3 attribution, and the 75.75s backoff sum. Four inferences did not survive.

7. Open decision

Scope of the sign-off: production-side only (D1, D2, D2b, D7), suite-side only (§3), or both. The measured floor/ceiling for the suite wall is 289–358s (floor, sample-dependent) to 446s regardless; the production defects carry their own per-call measured costs independent of the suite.

Reviewer recommendation: both. The order reversal is already applied in §4 (§8-1) and each production defect now carries the scale guard it lacked (§8-2), so the two scopes no longer compete: the suite-side program holds 96%+ of the leverage on the objective that triggered this plan and runs first; the production defects follow on their own per-call merits. One item still needs a decision, not an implementation — D1's matching semantics (§6b-3) — and it gates §4 step 4 rather than the sign-off itself.

8. Second-review findings — all folded into the plan body (2026-08-12)

Every item below is now implemented in the sections named at the end of each entry; this section is kept as the evidence record, not as an open list.