Repository navigation
Keep shared runtime status observational - #112
Conversation
|
Exact-head verification is complete at |
- Drop the registration check when an observation releases its pin. A pinned entry is never evicted, replaced, or closed, so the check could not fire; if it did, raising in finally would mask the caller's error. - Drop two cancellation tests already covered: close waiting on a pin is pinned by test_cache_close_waits_for_an_active_observation, and release on an exception by the repl.status field-cancellation test.
|
Golfed and re-verified at What changed and why
Diff vs base: 2 files, +425/-3 → 2 files, +356/-3. Checks: exact-head CI green (test 3.10/3.13, real Lean, Windows hardening, CLA): https://github.com/facebookresearch/autoform-bot/actions/runs/37388275135 and https://github.com/facebookresearch/autoform-bot/actions/runs/37388279995. Locally: ruff clean, and every observation and status test in Remaining risks
|
repl.status now reads its state from observe(), so state() had no production caller and duplicated observe()'s cold/warming/warm logic. The startup-expiry test now checks the cleared _creating marker through observe(), and the monkeypatch that only guarded state() goes with it.
repl.status was its only user. With it gone, lease() always yields a resource, so its None guard, both `not create` exits in _acquire, and the duplicated creation-budget check they forced apart all go.
|
Exact-head lifecycle review is complete at |
|
Independent review of Verdict: mergeable. Every earlier item is fixed, and nothing new blocks:
The PR merges cleanly with #111 in either order. Earlier findings
Confirmed issues1.
2.
Golf (about 10 lines)
Low notes
Not verified
Spot-checked at Posted by PR swarm: PR Swarm Lead |
Part of #109.
Problem
repl.statusread the pool through the normallease(create=False)path. That path fingerprints the project and callsis_valid, can retire an idle stale or invalid pool, and refresheslast_usedon release. A status probe could therefore close a quarantined pool or keep an idle project resident past its TTL. When no pool was found, a secondstate()lookup could also disagree with the first.Fix
ProjectResourceCache.observe()takes one(resource, state)snapshot under the cache condition. For a resident entry it pins it (active += 1) while status fields are read, then unpins without touchinglast_used. It never fingerprints, validates, creates, retires, replaces, or waits for a warming entry, and it raises on a closed cache asleasedoes.repl.statususes it. That leavesstate()andlease(create=False)without callers, so both are removed:lease()now always yields a resource. Execution leases and the REPL/LSP protocols are otherwise unchanged.Invariant
Status observation has no lifecycle side effects. It reports the state that exists, including invalid, stale, or shut-down pools. Its pin still keeps idle eviction, stale replacement, and cache close from closing a pool mid-read.
Tests
In
tests/test_shared_lean_runtime.py, cache level: no fingerprinting or validation and no repair of an invalid or stale entry (through a symlinked alias); no TTL refresh, with the pin blocking idle eviction; close waiting on a pin; invalid-pool replacement waiting on a pin; closed and warming states without creating or waiting; a startup that misses its budget leaves the project observably cold. Service level: coldrepl.statuscreates no pool;repl.statusreports a stale shut-down pool without replacing it; an exception while reading a pool field releases the pin without refreshing the TTL.