perf(effect-runtime): reuse a private source digest across processes #7748
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 599 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.383
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7748"
general
weight: 0.35
JasonBuildAI
Delivery brief
heartbeat-prompt,quota should-run,status,refresh-state,todo) starts a fresh Python process for each step, and each step computes the managed TypeScript runtime fingerprint once..ts/.jsonsources in every process. Fresh-process measurement on macOS shows the cost is dominated byopen(), not by hashing orstat(a stat-only pass is ~1 ms). It was 0.15–0.55 s per command, and 100% of the first explore-validation cost on the measured route.loopx/control_plane/effect_runtime.py(_runtime_fingerprint_for_snapshot). This does not change TS authority, the fingerprint value, runtime locators, scheduling, settlement, defaults or output contracts.Change
On POSIX, after a successful full hash plus the existing freshness recheck, the digest is recorded in the existing private per-user runtime namespace as
source-digest-<id>.json, mode0600, written atomically.sys.executable, Python version, normalized release root and the complete(path, mtime_ns, ctime_ns, size)source snapshot. That snapshot is already computed for the in-process cache.O_NOFOLLOW, it is a regular0600-style file owned by the user, and both the key and thesha256digest validate. Otherwise the code falls back to the unchanged full read.- after a read failure or a source change during hashing;
- when any source changed within the last 2 s, since a coarse ctime clock could otherwise preserve timestamps across a rewrite;
- when the namespace does not exist, because the memo never creates it.
runtime-.json, the.ts-effect.locknames andstart-.lock. Locator retirement, fixture cleanup and lock observation are therefore unaffected.The bilingual TypeScript migration RFC replaces "still reads every admitted byte" with this trade-off and its residual risk. Another file with identical size, mtime and ctime (for example a retargeted symlink), or a filesystem that does not maintain ctime, can hide a change.
Evidence
Base
04c5799b8and head were run alternately in fresh processes against one isolated private namespace, on macOS with a synthetic SQLite fixture and 0.6 s gaps between runs:| Measure | Base median | Head median |
|---|---:|---:|
|
_runtime_fingerprint()in a fresh process (n=12) | 298 ms | 13 ms (first run 380 ms) ||
heartbeat-prompt --thintotal (n=6) | 1.34 s | 0.77 s ||
quota should-runtotal (n=6) | 2.40 s | 1.64 s ||
statustotal (n=6) | 1.13 s | 0.79 s |The fingerprint value is identical on base and head. After the run,
canaryfixture retirement completed normally, and the namespace contained only the digest record and the existing compile cache.Validation at head
249773887:tests/control_plane/test_runtime_source_read_batching.py, checked against an independent serial reference:- cross-process reuse with zero source reads;
- edit, add and remove each rotate the fingerprint;
- a copied release root misses the cache;
- a foreign-mode file, symlink, shared namespace, corrupt JSON, stale key or invalid digest each recompute;
- an unsettled source, a read failure or a missing namespace records nothing.
- The reuse test fails on base.
pytestover the fingerprint, readiness, status-scan, alltest_effect_runtime_, managed-fixture, telemetry-isolation, performance-diagnosis, local-delegation and goal-portfolio suites: 388 passed, 1 skipped.ruff checkon changed Python: passed.scripts/check_rfc_bilingual.py --base origin/main --head HEAD: passed.loopx canary premerge --from-git-diff --git-diff-base origin/main(standard tier):- 6 direct checks and 15 selected checks, 0 failures, 0 manual holds;
- surfaces: control_plane, docs_project_content, public_boundary, python.
Not covered
loopx/*, so it needs maintainer review and merge authorization. It is not self-merged.