• Stefy Lanza (nextime / spora )'s avatar
    runpod: hours nobody ledgered, and a flag the ledger threw away (v0.3.63) · d8984250
    Stefy Lanza (nextime / spora ) authored
    Two gaps I left open last night, both about the ledger telling the truth.
    
    **A pod that went away without a pool noticing was never billed to anyone.** A
    pool closes its own pods' bills — `_terminate` for one it retires, `forget` for
    one RunPod says is gone — and neither runs for a pod only the REGISTRY knew
    about: one orphaned by a restart, or terminated from the console or straight
    through the RunPod API. Observed: pod lgdgfs749chkib, killed by hand, never
    appeared in the ledger while two pods that went through coderai did.
    `close_bill_from_registry()` now computes the hours from the registry's own
    `created` — the only record of when a pod started once no handle exists — and
    records them against the pool it belonged to. Both reaper paths use it, so the
    "terminated as stale" and "vanished from the account" cases cannot drift apart,
    and a pod a pool still holds is deliberately skipped: `forget` ledgers that one,
    and counting it here as well would double-count every pod RunPod reclaims.
    
    **`record_spend` dropped the `reaped` flag it was being handed.** It keeps a
    deliberate allow-list, which is right — the file is persisted and pruned for
    every pod — but the list has to carry what distinguishes one kind of charge from
    another. A pod the reaper killed looked in the file exactly like one a pool
    retired on purpose. `reaped` and `reason` are kept now.
    
    Writing the test for the first fix found a third thing, and it was mine: v0.3.56
    made a stale registry entry stop counting as "known" so the reaper could kill the
    pod it named — but the reconcile was only ever asked about known ids, so that
    same change stopped stale entries being RECONCILED. An entry for a pod that no
    longer exists was then never pruned and its hours never attributed. The reaper
    now reconciles against the whole registry; `known` keeps its one job, which is
    deciding what is shielded from reaping.
    
    9 tests in tests/test_ledger_out_of_band.py, including the double-count guard
    and the pruning regression. test_runpod_client_scale's source anchor moves with
    the change and says why.
    Co-Authored-By: 's avatarClaude Opus 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01PxYHWbCAjjjD7A1rhFKtaW
    d8984250
Name
Last commit
Last update
..
__init__.py Loading commit data...
_film_net.py Loading commit data...
_rife_ifnet.py Loading commit data...
app.py Loading commit data...
archive.py Loading commit data...
audio_backends.py Loading commit data...
audio_clean.py Loading commit data...
audio_gen.py Loading commit data...
audio_stems.py Loading commit data...
audiocraft_worker.py Loading commit data...
canary_worker.py Loading commit data...
characters.py Loading commit data...
colibri_worker.py Loading commit data...
compose.py Loading commit data...
crisperwhisper_worker.py Loading commit data...
custom_pipelines.py Loading commit data...
diarization.py Loading commit data...
ds4_kv_janitor.py Loading commit data...
ds4_worker.py Loading commit data...
embeddings.py Loading commit data...
environments.py Loading commit data...
faceswap.py Loading commit data...
fastlog.py Loading commit data...
h3_worker.py Loading commit data...
host_worker.py Loading commit data...
hub_compat.py Loading commit data...
images.py Loading commit data...
k3_worker.py Loading commit data...
kt_worker.py Loading commit data...
lipsync.py Loading commit data...
log.py Loading commit data...
longcat_worker.py Loading commit data...
lora_archs.py Loading commit data...
loras.py Loading commit data...
melotts_worker.py Loading commit data...
model_test.py Loading commit data...
models_transfer.py Loading commit data...
mux_remote.py Loading commit data...
ocr.py Loading commit data...
parler_worker.py Loading commit data...
pipelines.py Loading commit data...
pod_http.py Loading commit data...
pod_tls.py Loading commit data...
podlog.py Loading commit data...
prompt_cache.py Loading commit data...
pyannote_worker.py Loading commit data...
ratelimit.py Loading commit data...
remote_gateway.py Loading commit data...
rerank.py Loading commit data...
runpod_client.py Loading commit data...
runpod_ledger.py Loading commit data...
runpod_worker.py Loading commit data...
spatial.py Loading commit data...
speaker_embeddings.py Loading commit data...
speaker_registry.py Loading commit data...
state.py Loading commit data...
stt_backends.py Loading commit data...
text.py Loading commit data...
transcriptions.py Loading commit data...
tts.py Loading commit data...
tts_backends.py Loading commit data...
uploads.py Loading commit data...
urlutils.py Loading commit data...
video.py Loading commit data...
vllm_worker.py Loading commit data...
voice_clone.py Loading commit data...
voice_convert.py Loading commit data...
vpr_salad_server.py Loading commit data...
xtts_worker.py Loading commit data...